bug-bash
[Top][All Lists]
Advanced

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

RETURN trap will inherit last RETURN trap cmd though set +T


From: Shen Herbert
Subject: RETURN trap will inherit last RETURN trap cmd though set +T
Date: Wed, 23 Jan 2019 15:59:12 +0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe 
-fstack-protector-strong -fno-plt 
-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 
-Wno-parentheses -Wno-format-security
uname output: Linux arch.ishbguy.org 4.20.3-arch1-1-ARCH #1 SMP PREEMPT Wed Jan 
16 22:38:58 UTC 2019 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 0
Release Status: release

Description:

RETURN trap will inherit last RETURN trap cmd though set +T under bash 5.0 or 
bash 4.4, however, this will not happen under bash 4.3. For example:
```
set +T
one { trap 'echo in one' RETURN; }
all {
    trap 'echo in all' RETURN
    one
}
all
```
in bash 5.0 and 4.4 will print:
```
in one
in one
```
in bash 4.3 will print:
```
in one
in all
```

Repeat-By:
Run this script:
```
set +T
one { trap 'echo in one' RETURN; }
all {
    trap 'echo in all' RETURN
    one
}
all
```

-- 
------------------------------------------
Herbert Shen
Mail: address@hidden
GitHub: https://github.com/ishbguy
------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]