From: Jilles Tjoelker <jilles@stack.nl>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: dash@vger.kernel.org
Subject: Re: [v2 PATCH] trap: Preserve parent traps for trap-only command substitution
Date: Fri, 19 Apr 2024 23:44:25 +0200 [thread overview]
Message-ID: <20240419214425.GB24704@stack.nl> (raw)
In-Reply-To: <Zhz+wALFljSAqnDU@gondor.apana.org.au>
On Mon, Apr 15, 2024 at 06:17:36PM +0800, Herbert Xu wrote:
> v2 restricts the preservation to command substitution only and
> only if the command's first word is "trap".
> ---8<---
> Traps are reset when a subshell is started. When a subshell is
> started for command substitution with a simple command whose first
> word is "trap", preserve the parent trap text so that they can be
> printed.
It looks like this will execute the EXIT trap in a subshell $(trap).
On the other hand, things like $(trap "echo subshell exit >&2" EXIT) and
$(trap "echo other trap >&2" USR1) seem to be handled correctly.
I think the intent of https://austingroupbugs.net/view.php?id=53 is that
things like $('trap') and $(\trap) should also work (although an
expansion that expands to trap need not work).
--
Jilles Tjoelker
next prev parent reply other threads:[~2024-04-19 21:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-14 7:52 [PATCH] trap: Preserve parent shell traps for simple commands Herbert Xu
2024-04-15 10:17 ` [v2 PATCH] trap: Preserve parent traps for trap-only command substitution Herbert Xu
2024-04-19 21:44 ` Jilles Tjoelker [this message]
2024-04-20 0:36 ` [v3 " Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240419214425.GB24704@stack.nl \
--to=jilles@stack.nl \
--cc=dash@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.