On Saturday 26 September 2009 17:49, Cristian Ionescu-Idbohrn wrote:
> On Thu, 24 Sep 2009, Denys Vlasenko wrote:
> 
> > I see. It's an EXIT trap firing when `trap` terminates...
> >
> > It's not easy to fix due to some peculiarities of ash.c code.
> >
> > Simplest but dirty solution would be to to unset EXIT trap
> > in `trap`, but it will not show EXIT in `trap` output too.
> > Which is bad, but "less bad" that what we have now.
> 
> I see you found a less dirty solution :)  Super, as what I'm chasing is
> exactly EXIT traps.
> 
> I also see you mimic bash exactly, WRT output from $(trap).  I can't
> really understand why bash is doing that unuseful thing as adding the SIG
> in front of the signal name.  As I previously wrote:
> 
> On Wed, 23 Sep 2009, Cristian Ionescu-Idbohrn wrote:
> >
> > http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html
> > says:
> >
> > "The condition can be EXIT, 0 (equivalent to EXIT), or a signal specified
> > using a symbolic name, without the SIG prefix"
> >
> > You've chosen to add the "SIG" in front of all the signal names.  May I
> > ask why?
> >
> > bash's choice is to do something more inconsistent, IMO:
> >
> >     trap -- 'echo Ho' EXIT
> >     trap -- 'echo Ho' SIGINT
> >     trap -- 'echo Ho' SIGTERM
> >
> > no "SIG" in front of EXIT.
> > Thing is, if the quoted piece above is to be followed when doing:
> >
> >     eval "$save_traps"
> >
> > then $(trap) should output:
> >
> >     trap -- 'echo Ho' EXIT
> >     trap -- 'echo Ho' INT
> >     trap -- 'echo Ho' TERM
> >
> > Does that seem reasonable?
> 
> Yes, it does :)  Just skip the SIG thing.  bash does that itself if you
> ask it to be POSIXLY_CORRECT.
> 
> ,----
> | If bash is invoked with the name sh, it tries to mimic the startup
> | behavior of historical versions of sh as closely as possible, while
> | conforming to the POSIX standard as well.
> `----
> 
> Try something like this in the test scripts:
> 
>       set -o | egrep -q -w posix && set -o posix

Thanks!

I removed SIG prefix in git.
-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to