[Pkg-zsh-commits] [zsh] 04/11: 32091: WARN_CREATE_GLOBAL false positive. In cases like () { foo=bar =true; }

Axel Beckert abe at deuxchevaux.org
Sun Dec 15 00:38:27 UTC 2013


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch upstream
in repository zsh.

commit b28a6365f6ea5a9fdb8b63dd1612f55eb4034990
Author: Daniel Shahaf <d.s at daniel.shahaf.name>
Date:   Fri Dec 6 09:47:28 2013 +0200

    32091: WARN_CREATE_GLOBAL false positive.
    In cases like () { foo=bar =true; }
---
 ChangeLog            |  8 +++++++-
 Src/exec.c           |  5 ++++-
 Test/E01options.ztst | 17 ++++++++++-------
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a44f54b..6f030d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-06  Peter Stephenson  <p.stephenson at samsung.com>
+
+	* Daniel Shahaf: 32091: Src/exec.c, Test/E01options.ztst:
+	WARN_CREATE_GLOBAL false positive for assignment before
+	commands.
+
 2013-12-05  Peter Stephenson  <p.w.stephenson at ntlworld.com>
 
 	* Daniel Shahaf: 32089:
@@ -39,7 +45,7 @@
 	Src/Modules/example.c, Src/module.c: Rationalise character
 	encodings: shell functions are strictly ASCII for maximum
 	portability; other files needed for building and documentation
-	are ASCII are UTF-8; test files may use ISO-8859-X (we don't
+	are ASCII or UTF-8; test files may use ISO-8859-X (we don't
 	require the Euro symbol) where needed to get single character
 	input with the top bit set.
 
diff --git a/Src/exec.c b/Src/exec.c
index df915e1..dccdc2b 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3309,7 +3309,10 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	    }
 	    if (type == WC_SIMPLE) {
 		if (varspc) {
-		    addvars(state, varspc, ADDVAR_EXPORT|ADDVAR_RESTRICT);
+		    int addflags = ADDVAR_EXPORT|ADDVAR_RESTRICT;
+		    if (forked)
+			addflags |= ADDVAR_RESTORE;
+		    addvars(state, varspc, addflags);
 		    if (errflag)
 			_exit(1);
 		}
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index e00eb0e..d9f2191 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -83,12 +83,13 @@
 %prep
   mkdir options.tmp && cd options.tmp
 
-  mkdir tmpcd
+  mkdir tmpcd homedir
 
   touch tmpfile1 tmpfile2
 
   mydir=$PWD
   mydirt=`print -P %~`
+  mydirhome=`export HOME=$mydir/homedir; print -P %~`
   catpath=$(which cat)
   lspath==ls
 
@@ -513,10 +514,10 @@
   print *(#q:s/#(#b)tmp(*e)/'scrunchy${match[1]}'/)
   unsetopt histsubstpattern
 0:HIST_SUBST_PATTERN option
->TINGcd TINGfile1 TINGfile2
+>TINGcd TINGfile1 TINGfile2 homedir
 >THUMPcd THUMPfile1 THUMPfile2
 >one.c Two.X Three.X
->scrunchyfile1 scrunchyfile2 tmpcd
+>homedir scrunchyfile1 scrunchyfile2 tmpcd
 
   setopt ignorebraces
   echo X{a,b}Y
@@ -853,6 +854,7 @@
 
 # Do you have any idea how dull this is?
 
+  (export HOME=$mydir/homedir
   pushd $mydir/tmpcd
   pushd
   dirs
@@ -863,11 +865,11 @@
   popd
   pushd
   popd
-  dirs
+  dirs)
 0q:PUSHD_TO_HOME option
->$mydirt $mydirt/tmpcd
->~ $mydirt $mydirt/tmpcd
->$mydirt
+>$mydirhome $mydirhome/tmpcd
+>~ $mydirhome $mydirhome/tmpcd
+>$mydirhome
 
   array=(one two three four)
   setopt rcexpandparam
@@ -1067,6 +1069,7 @@
     fn2() {
       foo3=bar6
     }
+    foo4=bar7 =true
   }
   fn
 0:WARN_CREATE_GLOBAL option

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/zsh.git



More information about the Pkg-zsh-commits mailing list