Re: trap bug in recent versions of dash

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

 



* Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> [2010-11-28 08:55]:
> On Wed, Aug 11, 2010 at 08:06:16AM +0000, Guido Berhoerster wrote:
> > Hello,
> > 
> > with the latest git version of dash trap actions are not
> > evaluated in the context of a function.
> > 
> > The following script demonstrates the bug:
> > ----8<----
> > read_timeout () {
> >     saved_traps="$(trap)"
> >     trap 'printf "timed out\n"; eval "${saved_traps}"; return' TERM
> >     ( sleep $1; kill -TERM $$ ) >/dev/null 2>&1 &
> >     timer_pid=$!
> >     read $2
> >     kill $timer_pid 2>/dev/null
> > }
> > 
> > read_timeout 5 value
> > printf "read \"%s\"\n" "${value:=default}"
> > 
> > ---->8----
> > The return statement in the trap inside the read_timeout function
> > does not return from the function but rather exits the script.
> > 
> > With dash 0.5.5.1 it works as expected.
> 
> Indeed this was a regression caused by the SKIPEVAL removal.
> 
> This patch should fix it.

Thanks, it does fix it.

-- 
Guido Berhoerster
--
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