dash  

[PATCH] [EVAL] don't clear eflag when forking subshell

Gerrit Pape
Mon, 14 Jun 2010 02:56:43 -0700

According to
 
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_12
"A subshell environment shall be created as a duplicate of the shell
environment, except that signal traps set by that shell environment
shall be set to the default values."

Currently the eflag is cleared when forking a subshell, e.g.

$ dash -c 'set -e ; z=$(false;echo foo) ; echo $z'
foo

With this commit the eflag is preserved for subshells, and dash exits 1
before echo.

The problem was reported by Vincent Lefevre through
 http://bugs.debian.org/514863

Signed-off-by: Gerrit Pape <p...@smarden.org>
---
 src/eval.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/eval.c b/src/eval.c
index a0d0f3b..bd4b485 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -627,7 +627,6 @@ evalbackcmd(union node *n, struct backcmd *result)
                                dup2(pip[1], 1);
                                close(pip[1]);
                        }
-                       eflag = 0;
                        evaltreenr(n, EV_EXIT);
                        /* NOTREACHED */
                }
-- 
1.6.0.3

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html