trap bug in recent versions of dash

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


with the latest git version of dash trap actions are not
evaluated in the context of a function.

The following script demonstrates the bug:
read_timeout () {
    trap 'printf "timed out\n"; eval "${saved_traps}"; return' TERM
    ( sleep $1; kill -TERM $$ ) >/dev/null 2>&1 &
    read $2
    kill $timer_pid 2>/dev/null

read_timeout 5 value
printf "read \"%s\"\n" "${value:=default}"

The return statement in the trap inside the read_timeout function
does not return from the function but rather exits the script.

With dash it works as expected.
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

[LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

Powered by Linux