From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] tests: remove temporary file
Date: Wed, 5 Mar 2025 22:14:02 +0100 [thread overview]
Message-ID: <Z8i-mktqESZPSs6m@calendula> (raw)
In-Reply-To: <20250304151202.2570205-1-fw@strlen.de>
On Tue, Mar 04, 2025 at 04:11:57PM +0100, Florian Westphal wrote:
> 0002-relative leaves a temporary file in the current working
> directory, at the time the "trap" argument is expanded, tmpfile2
> isn't set.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> tests/shell/testcases/include/0002relative_0 | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tests/shell/testcases/include/0002relative_0 b/tests/shell/testcases/include/0002relative_0
> index dbf11e7db171..ac8355475320 100755
> --- a/tests/shell/testcases/include/0002relative_0
> +++ b/tests/shell/testcases/include/0002relative_0
> @@ -7,9 +7,14 @@ if [ ! -w "$tmpfile1" ] ; then
> exit 77
> fi
>
> -trap "rm -rf $tmpfile1 $tmpfile2" EXIT # cleanup if aborted
> -set -e
> +cleanup()
> +{
> + rm -f "$tmpfile1" "$tmpfile2"
> +}
> +
> +trap cleanup EXIT
>
> +set -e
> tmpfile2=$(mktemp -p .)
>
> RULESET1="add table x"
> --
> 2.48.1
>
>
prev parent reply other threads:[~2025-03-05 21:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 15:11 [PATCH nft] tests: remove temporary file Florian Westphal
2025-03-05 21:14 ` Pablo Neira Ayuso [this message]
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=Z8i-mktqESZPSs6m@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/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.