Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh From David Laight



details:   https://anonhg.NetBSD.org/src/rev/b49c3b952ba2
branches:  trunk
changeset: 538628:b49c3b952ba2
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 23 19:46:34 2002 +0000

description:
>From David Laight
> The wrong process is aborting when variable assignment fails
> in the vfork path.  So the following command fails to execute
> the second echo (shown here with the correct output).
>
> $ (readonly r; r= /bin/echo a; echo b)
> r: is read only
> b
>
> fix: defer the mklocal() to the child shell.

diffstat:

 bin/sh/eval.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 831e47d1ad75 -r b49c3b952ba2 bin/sh/eval.c
--- a/bin/sh/eval.c     Wed Oct 23 19:46:06 2002 +0000
+++ b/bin/sh/eval.c     Wed Oct 23 19:46:34 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eval.c,v 1.66 2002/10/23 13:25:24 christos Exp $       */
+/*     $NetBSD: eval.c,v 1.67 2002/10/23 19:46:34 christos Exp $       */
 
 /*-
  * Copyright (c) 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c     8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.66 2002/10/23 13:25:24 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.67 2002/10/23 19:46:34 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -756,8 +756,6 @@
 
                        savelocalvars = localvars;
                        localvars = NULL;
-                       for (sp = varlist.list ; sp ; sp = sp->next)
-                               mklocal(sp->text, VEXPORT);
                        vforked = 1;
                        switch (pid = vfork()) {
                        case -1:
@@ -783,6 +781,8 @@
                                }
                                savehandler = handler;
                                handler = &jmploc;
+                               for (sp = varlist.list; sp; sp = sp->next)
+                                       mklocal(sp->text, VEXPORT);
                                forkchild(jp, cmd, mode, vforked);
                                break;
                        default:



Home | Main Index | Thread Index | Old Index