This website requires JavaScript.
Explore
Help
Register
Sign In
emo
/
busybox
Watch
1
Star
0
Fork
0
You've already forked busybox
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
337a7b0269
busybox
/
shell
/
ash_test
/
ash-misc
/
exitcode_trap7.tests
8 lines
92 B
Plaintext
Raw
Normal View
History
Unescape
Escape
ash: eval: Do not cache value of eflag in evaltree Upsteam commit: Date: Mon, 17 May 2021 15:19:23 +0800 eval: Do not cache value of eflag in evaltree Patrick Brünn <P.Bruenn@beckhoff.com> wrote: > Since we are migrating to Debian bullseye, we discovered a new behavior > with our scripts, which look like this: >>cleanup() { >> set +e >> rmdir "" >>} >>set -eu >>trap 'cleanup' EXIT INT TERM >>echo 'Hello world!' > > With old dash v0.5.10.2 this script would return 0 as we expected it. > But since commit 62cf6955f8abe875752d7163f6f3adbc7e49ebae it returns > the last exit code of our cleanup function. ... Thanks for the report. This is actually a fairly old bug with set -e that's just been exposed by the exit status change. What's really happening is that cleanup itself is triggering a set -e exit incorrectly because evaltree cached the value of eflag prior to the function call. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-07 05:24:23 +05:30
$THIS_SH -c '
cleanup() { set +e; false; }
hush: fix set -n to act immediately, not just after run_list() Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-07 05:53:51 +05:30
set -e
ash: eval: Do not cache value of eflag in evaltree Upsteam commit: Date: Mon, 17 May 2021 15:19:23 +0800 eval: Do not cache value of eflag in evaltree Patrick Brünn <P.Bruenn@beckhoff.com> wrote: > Since we are migrating to Debian bullseye, we discovered a new behavior > with our scripts, which look like this: >>cleanup() { >> set +e >> rmdir "" >>} >>set -eu >>trap 'cleanup' EXIT INT TERM >>echo 'Hello world!' > > With old dash v0.5.10.2 this script would return 0 as we expected it. > But since commit 62cf6955f8abe875752d7163f6f3adbc7e49ebae it returns > the last exit code of our cleanup function. ... Thanks for the report. This is actually a fairly old bug with set -e that's just been exposed by the exit status change. What's really happening is that cleanup itself is triggering a set -e exit incorrectly because evaltree cached the value of eflag prior to the function call. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-07 05:24:23 +05:30
trap cleanup EXIT
echo Start
'
echo Ok:$?
Reference in New Issue
Copy Permalink