[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debian bug #929178: wrong trap displayed inside functions
From: |
Chet Ramey |
Subject: |
Re: Debian bug #929178: wrong trap displayed inside functions |
Date: |
Mon, 25 Mar 2024 17:33:41 -0400 |
User-agent: |
Mozilla Thunderbird |
On 3/25/24 3:47 PM, Gioele Barabucci wrote:
On 25/03/24 18:13, Oğuz wrote:
On Mon, Mar 25, 2024 at 7:18 PM Gioele Barabucci <gioele@svario.it
<mailto:gioele@svario.it>> wrote:
> Just for reference, neither dash nor busybox sh preserve the caller's
trap:
I don't know why you think they are relevant.
Because they are two very commonly used /bin/sh, and thus important when it
comes to understanding what the current consensus among implementers is?
There are varying implementations, and POSIX allows them all.
You can behave like bash, the NetBSD sh and yash, and preserve the trap
strings in the child until it changes them. You can behave like dash and
mksh, and kill the trap strings immediately upon starting the subshell.
Or you can behave in a hybrid fashion, like the FreeBSD sh, and check for
a subshell where the only command is trap, and preserve the trap strings
only in that case.
This is kind of like subshells keeping the jobs list around just long
enough to make j=$(jobs) work.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: Debian bug #929178: wrong trap displayed inside functions, Chet Ramey, 2024/03/25