[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Debian bug #929178: wrong trap displayed inside functions
From: |
Gioele Barabucci |
Subject: |
Debian bug #929178: wrong trap displayed inside functions |
Date: |
Mon, 25 Mar 2024 16:45:41 +0100 |
User-agent: |
Mozilla Thunderbird |
Hi, I'm forwarding a minor issue originally reported in
<https://bugs.debian.org/929178>.
If a function does not set a trap, `trap` will output the command set by
the caller. This is just a cosmetic issue, the right trap will be run at
runtime.
To reproduce this issue:
#!/bin/bash
f1() { echo "trap in f1: $(trap)" >&2 ; }
f2() {
echo "trap in f2 (initial): $(trap)" >&2
trap "/bin/echo f2" EXIT
echo "trap in f2 (final): $(trap)" >&2
}
trap "/bin/echo main" EXIT
echo "f1 output: <$(f1)>"
echo "f2 output: <$(f2)>"
Output:
trap in f1: trap -- '/bin/echo main' EXIT
f1 output: <>
trap in f2 (initial): trap -- '/bin/echo main' EXIT
trap in f2 (final): trap -- '/bin/echo f2' EXIT
f2 output: <f2>
main
Regards,
--
Gioele Barabucci
- Debian bug #929178: wrong trap displayed inside functions,
Gioele Barabucci <=
- Debian bug #929178: wrong trap displayed inside functions, Oğuz, 2024/03/25
- Re: Debian bug #929178: wrong trap displayed inside functions, Gioele Barabucci, 2024/03/25
- Debian bug #929178: wrong trap displayed inside functions, Oğuz, 2024/03/25
- Re: Debian bug #929178: wrong trap displayed inside functions, G. Branden Robinson, 2024/03/25
- Re: Debian bug #929178: wrong trap displayed inside functions, Oğuz, 2024/03/25
- Re: Debian bug #929178: wrong trap displayed inside functions, G. Branden Robinson, 2024/03/25
- Re: Debian bug #929178: wrong trap displayed inside functions, Martin D Kealey, 2024/03/26
- Debian bug #929178: wrong trap displayed inside functions, Oğuz, 2024/03/26
- Re: Debian bug #929178: wrong trap displayed inside functions, Gioele Barabucci, 2024/03/25
- Re: Debian bug #929178: wrong trap displayed inside functions, Chet Ramey, 2024/03/25