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 <gio...@svario.it <mailto:gio...@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 c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature