Date: Sun, 16 May 2010 10:23:33 +0000 (UTC) From: Stefan Farfeleder <stefanf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r208136 - stable/7/bin/sh Message-ID: <201005161023.o4GANXd3070782@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: stefanf Date: Sun May 16 10:23:33 2010 New Revision: 208136 URL: http://svn.freebsd.org/changeset/base/208136 Log: Merge r193169: Fix the eval command in combination with set -e. Modified: stable/7/bin/sh/eval.c stable/7/bin/sh/eval.h stable/7/bin/sh/histedit.c stable/7/bin/sh/main.c stable/7/bin/sh/trap.c Directory Properties: stable/7/bin/sh/ (props changed) Modified: stable/7/bin/sh/eval.c ============================================================================== --- stable/7/bin/sh/eval.c Sun May 16 10:20:54 2010 (r208135) +++ stable/7/bin/sh/eval.c Sun May 16 10:23:33 2010 (r208136) @@ -83,6 +83,7 @@ MKINIT int evalskip; /* set if we are s STATIC int skipcount; /* number of levels to skip */ MKINIT int loopnest; /* current loop nesting level */ int funcnest; /* depth of function calls */ +STATIC int builtin_flags; /* evalcommand flags for builtins */ char *commandname; @@ -147,7 +148,7 @@ evalcmd(int argc, char **argv) STPUTC('\0', concat); p = grabstackstr(concat); } - evalstring(p); + evalstring(p, builtin_flags & EV_TESTED); } return exitstatus; } @@ -158,7 +159,7 @@ evalcmd(int argc, char **argv) */ void -evalstring(char *s) +evalstring(char *s, int flags) { union node *n; struct stackmark smark; @@ -167,7 +168,7 @@ evalstring(char *s) setinputstring(s, 1); while ((n = parsecmd(0)) != NEOF) { if (n != NULL) - evaltree(n, 0); + evaltree(n, flags); popstackmark(&smark); } popfile(); @@ -841,6 +842,7 @@ evalcommand(union node *cmd, int flags, commandname = argv[0]; argptr = argv + 1; optptr = NULL; /* initialize nextopt */ + builtin_flags = flags; exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv); flushall(); cmddone: Modified: stable/7/bin/sh/eval.h ============================================================================== --- stable/7/bin/sh/eval.h Sun May 16 10:20:54 2010 (r208135) +++ stable/7/bin/sh/eval.h Sun May 16 10:23:33 2010 (r208136) @@ -46,7 +46,7 @@ struct backcmd { /* result of evalbackc }; int evalcmd(int, char **); -void evalstring(char *); +void evalstring(char *, int); union node; /* BLETCH for ansi C */ void evaltree(union node *, int); void evalbackcmd(union node *, struct backcmd *); Modified: stable/7/bin/sh/histedit.c ============================================================================== --- stable/7/bin/sh/histedit.c Sun May 16 10:20:54 2010 (r208135) +++ stable/7/bin/sh/histedit.c Sun May 16 10:23:33 2010 (r208136) @@ -350,7 +350,7 @@ histcmd(int argc, char **argv) if (displayhist) { out2str(s); } - evalstring(s); + evalstring(s, 0); if (displayhist && hist) { /* * XXX what about recursive and @@ -382,7 +382,7 @@ histcmd(int argc, char **argv) fclose(efp); editcmd = stalloc(strlen(editor) + strlen(editfile) + 2); sprintf(editcmd, "%s %s", editor, editfile); - evalstring(editcmd); /* XXX - should use no JC command */ + evalstring(editcmd, 0); /* XXX - should use no JC command */ INTON; readcmdfile(editfile); /* XXX - should read back - quick tst */ unlink(editfile); Modified: stable/7/bin/sh/main.c ============================================================================== --- stable/7/bin/sh/main.c Sun May 16 10:20:54 2010 (r208135) +++ stable/7/bin/sh/main.c Sun May 16 10:23:33 2010 (r208136) @@ -178,7 +178,7 @@ state2: state3: state = 4; if (minusc) { - evalstring(minusc); + evalstring(minusc, 0); } if (sflag || minusc == NULL) { state4: /* XXX ??? - why isn't this before the "if" statement */ Modified: stable/7/bin/sh/trap.c ============================================================================== --- stable/7/bin/sh/trap.c Sun May 16 10:20:54 2010 (r208135) +++ stable/7/bin/sh/trap.c Sun May 16 10:23:33 2010 (r208136) @@ -416,7 +416,7 @@ dotrap(void) if (i == SIGCHLD) ignore_sigchld++; savestatus = exitstatus; - evalstring(trap[i]); + evalstring(trap[i], 0); exitstatus = savestatus; if (i == SIGCHLD) ignore_sigchld--; @@ -471,7 +471,7 @@ exitshell(int status) handler = &loc1; if ((p = trap[0]) != NULL && *p != '\0') { trap[0] = NULL; - evalstring(p); + evalstring(p, 0); } l1: handler = &loc2; /* probably unnecessary */ flushall();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005161023.o4GANXd3070782>