psss / rpms / zsh

Forked from rpms/zsh 5 years ago
Clone
Blob Blame History Raw
From a7b7f90b87289bf68c3175f867f77f68f1ef6a26 Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@zsh.org>
Date: Tue, 2 Jun 2015 14:43:08 +0100
Subject: [PATCH 1/4] users/20243: turn off GLOB_ASSIGN in completion system.

Upstream-commit: 6b4d6eaa9b040a05ad9796d20cda0b797209a443
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 Completion/compinit | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Completion/compinit b/Completion/compinit
index 9470c92..79f9d42 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -142,6 +142,7 @@ _comp_options=(
     NO_cshnullglob
     NO_cshjunkiequotes
     NO_errexit
+    NO_globassign
     NO_globsubst
     NO_histsubstpattern
     NO_ignorebraces
-- 
2.4.3


From 589d031cc414f44542f335e37052594b7fc89aa6 Mon Sep 17 00:00:00 2001
From: Mikael Magnusson <mikachu@gmail.com>
Date: Tue, 2 Jun 2015 15:33:07 +0200
Subject: [PATCH 2/4] GLOB_ASSIGN should only affect scalar assignments

Upstream-commit: 4dc4e23376888697234e00e0c34184bb308886e1
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 Src/exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Src/exec.c b/Src/exec.c
index 9f163a6..daed3b1 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2264,14 +2264,14 @@ addvars(Estate state, Wordcode pc, int addflags)
 		state->pc = opc;
 		return;
 	    }
-	    if (!isstr || (isset(GLOBASSIGN) &&
+	    if (!isstr || (isset(GLOBASSIGN) && isstr &&
 			   haswilds((char *)getdata(firstnode(vl))))) {
 		globlist(vl, 0);
 		/* Unset the parameter to force it to be recreated
 		 * as either scalar or array depending on how many
 		 * matches were found for the glob.
 		 */
-		if (isset(GLOBASSIGN))
+		if (isset(GLOBASSIGN) && isstr)
 		    unsetparam(name);
 	    }
 	    if (errflag) {
-- 
2.4.3


From e4ca35f21b2497fd7fc1477733f5549b399597f5 Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@zsh.org>
Date: Tue, 2 Jun 2015 16:23:08 +0100
Subject: [PATCH 3/4] 35369: better GLOB_ASSIGN testing

Upstream-commit: 897ad466920e6d46d317e0630b5263d4c37c907f
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 Test/A06assign.ztst  | 25 ++++++++++++++++++++++---
 Test/E01options.ztst | 10 +---------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/Test/A06assign.ztst b/Test/A06assign.ztst
index 0ad9a0a..a4401cb 100644
--- a/Test/A06assign.ztst
+++ b/Test/A06assign.ztst
@@ -419,14 +419,14 @@
 >worldliness
 >world
 
- integer i n x
+ (integer i n x
  float f
  setopt globassign
  i=tmpfile1
- n=tmp*
+ n=tmpf*
  x=*2
  f=2+2
- typeset -p i n x f
+ typeset -p i n x f)
 0:GLOB_ASSIGN with numeric types
 >typeset -i i=0
 >typeset -a n
@@ -434,6 +434,25 @@
 >typeset x=tmpfile2
 >typeset -E f=4.000000000e+00
 
+  setopt globassign
+  foo=tmpf*
+  print $foo
+  unsetopt globassign
+  foo=tmpf*
+  print $foo
+0:GLOB_ASSIGN option
+>tmpfile1 tmpfile2
+>tmpf*
+
+  (setopt globassign
+  typeset -A foo
+  touch gatest1 gatest2
+  foo=(gatest*)
+  print ${(t)foo}
+  rm -rf gatest*)
+0:GLOB_ASSIGN doesn't monkey with type if not scalar assignment.
+>association-local
+
  A=(first second)
  A="${A[*]}" /bin/sh -c 'echo $A'
  print -l "${A[@]}"
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 5c453c8..d64f7ac 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -473,15 +473,7 @@
 >outside2 scalar
 >inside3 scalar-export
 
-  setopt globassign
-  foo=tmp*
-  print $foo
-  unsetopt globassign
-  foo=tmp*
-  print $foo
-0:GLOB_ASSIGN option
->tmpcd tmpfile1 tmpfile2
->tmp*
+# GLOB_ASSIGN is tested in A06assign.ztst.
 
   mkdir onlysomefiles
   touch onlysomefiles/.thisfile onlysomefiles/thatfile
-- 
2.4.3


From e271bb49214b8dd8b2794858769ff186f3076d4a Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@zsh.org>
Date: Tue, 23 Jun 2015 12:02:06 +0100
Subject: [PATCH 4/4] 35573: turn off POSIX_BUILTINS in completion.

This is now needed to get suitable OPTIND behaviour.

Upstream-commit: a68d22eb00ea5c85422d70d1be7efa42acfda739
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 Completion/compinit | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Completion/compinit b/Completion/compinit
index 79f9d42..4b9a778 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -152,6 +152,7 @@ _comp_options=(
     NO_kshtypeset
     NO_markdirs
     NO_octalzeroes
+    NO_posixbuiltins
     NO_shwordsplit
     NO_shglob
     NO_warncreateglobal
-- 
2.4.3