Re: [PATCH] [EVAL] with set -e exit the shell if a subshell exits non-zero

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

 



On Mon, Jun 14, 2010 at 09:56:03AM +0000, Gerrit Pape wrote:
> Example:
> 
> $ dash -c 'set -e; (false); echo here'
> here
> 
> With this commit, dash exits 1 before echo.
> 
> The bug was reported by Stefan Fritsch through
>  http://bugs.debian.org/514863
> 
> Signed-off-by: Gerrit Pape <pape@xxxxxxxxxxx>

Applied with slight change:

commit a92255d6fa8b8efb0f9fb093b77ac601fe3e9ede
Author: Gerrit Pape <pape@xxxxxxxxxxx>
Date:   Tue Jul 6 17:50:37 2010 +0800

    [EVAL] Check exit for eval NSUBSHELL
    
    Example:
    
    $ dash -c 'set -e; (false); echo here'
    here
    
    With this commit, dash exits 1 before echo.
    
    The bug was reported by Stefan Fritsch through
     http://bugs.debian.org/514863
    
    Signed-off-by: Gerrit Pape <pape@xxxxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/ChangeLog b/ChangeLog
index 3f5e24c..0e367a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-06  Gerrit Pape <pape@xxxxxxxxxxx>
+
+	* Check exit for eval NSUBSHELL.
+
 2010-07-06  Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
 
 	* Fix loss of variables when hash collides.
diff --git a/src/eval.c b/src/eval.c
index 58739f5..5b8d36b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -251,7 +251,7 @@ checkexit:
 	case NSUBSHELL:
 	case NBACKGND:
 		evalfn = evalsubshell;
-		goto calleval;
+		goto checkexit;
 	case NPIPE:
 		evalfn = evalpipe;
 		goto checkexit;
 
Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux