[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Regression: EXIT traps always run in global context
From: |
Ivan Shapovalov |
Subject: |
Regression: EXIT traps always run in global context |
Date: |
Thu, 28 Nov 2024 08:23:48 +0400 |
User-agent: |
Evolution 3.54.2 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt
-fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer -g
-ffile-prefix-map=/build/bash/src=/usr/src/debug/bash -flto=auto
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
uname output: Linux able 6.11.10-arch0pf5-1 #1 SMP PREEMPT_DYNAMIC Thu, 01 Jan
1970 00:00:00 +0000 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.2
Patch Level: 37
Release Status: release
Description:
Regression: When an EXIT trap runs, it runs in global context, i.e.
does not see the locals defined in the function that was executing
at the time of the exit.
Repeat-By:
See the attached script.
$ INNER_FAIL_EXIT=1 ./test.sh # or interrupt with ^C during "inner
sleep 2")
(observe 5 `inner-*`, `outer-*` and `main-*` messages printed upon exit)
$ INNER_FAIL_2=1 ./test.sh
(observe just one `main-*` message printed upon exit)
Expected behavior in both cases is the same. It was the same until a
recent bash release.
Thanks,
--
Ivan Shapovalov / intelfx /
test.sh
Description: application/shellscript
signature.asc
Description: This is a digitally signed message part
- Regression: EXIT traps always run in global context,
Ivan Shapovalov <=