bug-bash
[Top][All Lists]
Advanced

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

RE: set -e, bad substitutions, and trap EXIT


From: Ewan Mellor
Subject: RE: set -e, bad substitutions, and trap EXIT
Date: Mon, 13 Feb 2012 09:43:10 +0000

> -----Original Message-----
> From: Chet Ramey [mailto:chet.ramey@case.edu]
> Sent: 08 February 2012 10:45
> To: Ewan Mellor
> Cc: bug-bash@gnu.org; Renuka Apte; chet.ramey@case.edu
> Subject: Re: set -e, bad substitutions, and trap EXIT
> 
> On 2/6/12 8:18 PM, Ewan Mellor wrote:
> > Hi,
> >
> > Is this a bug?  In the script below, I'm using a variable to control
> whether the script uses set -e or not, because the behavior is
> dependent on whether set -e is set.  When the script hits the bad
> substitution, it runs the exit handler and then exits as expected.
> However, with set -e, the exit status for the script as a whole is
> wrong - it exits with 0 even though the script is aborting.  That's
> completely the opposite of what I'd expect.  Without set -e in force,
> it all works as expected.
> 
> Yes, it's a bug.  When -e is in effect, the exit status is not set
> before the shell exits.  When it isn't, the code path taken results in
> the correct exit status.
> 
> Here's a patch that solves this particular problem.

Thanks Chet.  What happens next?  I'm not a bash developer normally, so I don't 
know what the procedure is.  Is that something that you can submit for me, or 
do you need me to file a bug somewhere?

Thanks,

Ewan.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]