Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: "VAR=foo export VAR" no longer works in zsh emulation



On Tue, 24 Jan 2017 08:42:14 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, 24 Jan 2017, Bart Schaefer wrote:
> 
> > > Do you have POSIX_BUILTINS set?
> >
> > Evidently "emulate sh" does not set that and needs to?
> 
> Sorry, I've got that backwards.  Apparently one did not need to set that
> before, and now one does?

It looks up to 5.2 you don't need the option, and this changed in the
commit below.

So it's less sh compatibility, as it still works there, and more
backward compatilibity in zsh.

pws

commit c8de0af35935602370cc79193d0e0d53971250d4
Author: Barton E. Schaefer <schaefer@xxxxxxx>
Date:   Mon Sep 19 00:25:13 2016 -0700

    39381: handle save/restore of variable values when "typeset"-related reserved words are prefixed by an assignment

diff --git a/ChangeLog b/ChangeLog
index e92c7b2..f9592dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-19  Barton E. Schaefer  <schaefer@xxxxxxx>
+
+	* 39381: Src/exec.c: handle save/restore of variable values when
+	"typeset"-related reserved words are prefixed by an assignment
+
 2016-09-19  Mikael Magnusson  <mikachu@xxxxxxxxx>
 
 	* 39351: Functions/Zle/bracketed-paste-url-magic: Handle magnet
diff --git a/Src/exec.c b/Src/exec.c
index 9a7234e..d924148 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3543,7 +3543,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		     * if it's got "command" in front.
 		     * If it's a normal command --- save.
 		     */
-		    if (is_shfunc || (hn->flags & BINF_PSPECIAL))
+		    if (is_shfunc || (hn->flags & (BINF_PSPECIAL|BINF_ASSIGN)))
 			do_save = (orig_cflags & BINF_COMMAND);
 		    else
 			do_save = 1;
@@ -3552,7 +3552,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		     * Save if it's got "command" in front or it's
 		     * not a magic-equals assignment.
 		     */
-		    if ((cflags & BINF_COMMAND) || !assign)
+		    if ((cflags & (BINF_COMMAND|BINF_ASSIGN)) || !assign)
 			do_save = 1;
 		}
 		if (do_save && varspc)



Messages sorted by: Reverse Date, Date, Thread, Author