aboutsummaryrefslogtreecommitdiffstats
path: root/main/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'main/zsh')
-rw-r--r--main/zsh/APKBUILD12
-rw-r--r--main/zsh/fix-zle-segfault.patch94
2 files changed, 102 insertions, 4 deletions
diff --git a/main/zsh/APKBUILD b/main/zsh/APKBUILD
index 6d8f49ed4a..1346e5a3a2 100644
--- a/main/zsh/APKBUILD
+++ b/main/zsh/APKBUILD
@@ -11,7 +11,8 @@ depends=""
makedepends="ncurses-dev"
install="zsh.post-install zsh.post-upgrade zsh.pre-deinstall"
source="http://www.zsh.org/pub/$pkgname-$pkgver.tar.xz
- zprofile"
+ zprofile
+ fix-zle-segfault.patch"
subpackages="$pkgname-doc"
builddir="$srcdir/$pkgname-$pkgver"
@@ -50,8 +51,11 @@ package() {
}
md5sums="afe96fde08b70e23c1cab1ca7a68fb34 zsh-5.2.tar.xz
-a5e93cd6880da04a63fc4fcaaa03987f zprofile"
+a5e93cd6880da04a63fc4fcaaa03987f zprofile
+1413688affa980b053dd2cdc784f8626 fix-zle-segfault.patch"
sha256sums="f17916320ffaa844bbd7ce48ceeb5945fc5f3eff64b149b4229bbfbdf3795a9d zsh-5.2.tar.xz
-e3c3625d966c8277274798f26241857df5fc520e18674deba6cc356f6b022d63 zprofile"
+e3c3625d966c8277274798f26241857df5fc520e18674deba6cc356f6b022d63 zprofile
+7b8bfec6f7c0df6954eb27a000ff1d077e37a1ec9fd9f37c247a53922cf0c9be fix-zle-segfault.patch"
sha512sums="9938af95e09203a0a313f441e0c23279136806f6f087475ca9a66c678c57ecffc87f73ece8133a36700af8de7cb5d1bec8559eabdec2b66102062e64026c2e72 zsh-5.2.tar.xz
-59182b99447872ded8adf0d890e9359ee47fce0b7acb2808f4308f945885fbf6d977a0917bbb5c0f21454caf3ba06ab092127732da4f84292d6ab0989a0110fe zprofile"
+59182b99447872ded8adf0d890e9359ee47fce0b7acb2808f4308f945885fbf6d977a0917bbb5c0f21454caf3ba06ab092127732da4f84292d6ab0989a0110fe zprofile
+f17016b4cb95932caabdfca273696f4a444f1e45c8e7d458db54ae12542fce87bdd6fc6c4cd070948041f50760389179c69c12296665b7b9651007faafbdbee7 fix-zle-segfault.patch"
diff --git a/main/zsh/fix-zle-segfault.patch b/main/zsh/fix-zle-segfault.patch
new file mode 100644
index 0000000000..faf6522f91
--- /dev/null
+++ b/main/zsh/fix-zle-segfault.patch
@@ -0,0 +1,94 @@
+From 0c2d823a7955981e88f7cb5b718a7081d97104f0 Mon Sep 17 00:00:00 2001
+From: Peter Stephenson <pws@zsh.org>
+Date: Mon, 7 Dec 2015 14:32:52 +0000
+Subject: [PATCH] 37337: Delay freeing widget until not in use.
+---
+Alpine notes:
+Fixes http://bugs.alpinelinux.org/issues/5699
+---
+index 2d672de..e9b1428 100644
+--- a/Src/Zle/zle.h
++++ b/Src/Zle/zle.h
+@@ -213,6 +213,8 @@ struct widget {
+ #define ZLE_KEEPSUFFIX (1<<9) /* DON'T remove added suffix */
+ #define ZLE_NOTCOMMAND (1<<10) /* widget should not alter lastcmd */
+ #define ZLE_ISCOMP (1<<11) /* usable for new style completion */
++#define WIDGET_INUSE (1<<12) /* widget is in use */
++#define WIDGET_FREE (1<<13) /* request to free when no longer in use */
+
+ /* thingies */
+
+index 38427e8..1f0c07d 100644
+--- a/Src/Zle/zle_main.c
++++ b/Src/Zle/zle_main.c
+@@ -1344,6 +1344,8 @@ execzlefunc(Thingy func, char **args, int set_bindk)
+ eofsent = 1;
+ ret = 1;
+ } else {
++ int inuse = wflags & WIDGET_INUSE;
++ w->flags |= WIDGET_INUSE;
+ if(!(wflags & ZLE_KEEPSUFFIX))
+ removesuffix();
+ if(!(wflags & ZLE_MENUCMP)) {
+@@ -1367,6 +1369,12 @@ execzlefunc(Thingy func, char **args, int set_bindk)
+ ret = w->u.fn(args);
+ unqueue_signals();
+ }
++ if (!inuse) {
++ if (w->flags & WIDGET_FREE)
++ freewidget(w);
++ else
++ w->flags &= ~WIDGET_INUSE;
++ }
+ if (!(wflags & ZLE_NOTCOMMAND))
+ lastcmd = wflags;
+ }
+@@ -1387,6 +1395,8 @@ execzlefunc(Thingy func, char **args, int set_bindk)
+ int osc = sfcontext, osi = movefd(0);
+ int oxt = isset(XTRACE);
+ LinkList largs = NULL;
++ int inuse = w->flags & WIDGET_INUSE;
++ w->flags |= WIDGET_INUSE;
+
+ if (*args) {
+ largs = newlinklist();
+@@ -1402,8 +1412,15 @@ execzlefunc(Thingy func, char **args, int set_bindk)
+ opts[XTRACE] = oxt;
+ sfcontext = osc;
+ endparamscope();
+- lastcmd = w->flags;
+- w->flags = 0;
++ lastcmd = w->flags & ~(WIDGET_INUSE|WIDGET_FREE);
++ if (inuse) {
++ w->flags &= WIDGET_INUSE|WIDGET_FREE;
++ } else {
++ if (w->flags & WIDGET_FREE)
++ freewidget(w);
++ else
++ w->flags = 0;
++ }
+ r = 1;
+ redup(osi, 0);
+ }
+index 271fd8e..21495b6 100644
+--- a/Src/Zle/zle_thingy.c
++++ b/Src/Zle/zle_thingy.c
+@@ -253,9 +253,14 @@ unbindwidget(Thingy t, int override)
+ /* Free a widget. */
+
+ /**/
+-static void
++void
+ freewidget(Widget w)
+ {
++ if (w->flags & WIDGET_INUSE) {
++ w->flags |= WIDGET_FREE;
++ return;
++ }
++
+ if (w->flags & WIDGET_NCOMP) {
+ zsfree(w->u.comp.wid);
+ zsfree(w->u.comp.func);
+--
+2.10.0
+