Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: phil@nwl.cc, Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] tests: monitor: run-tests.sh: restore cwd before unshare
Date: Thu,  7 Nov 2024 13:56:53 +0100	[thread overview]
Message-ID: <20241107125657.28339-1-fw@strlen.de> (raw)

The monitor script no longer works if not called from tests/monitor directory:

% tests/monitor/run-tests.sh
unshare: failed to execute tests/monitor/run-tests.sh: No such file or directory

... because the script will change the directory.
Stash and restore to old one so unshare $0 can work.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 tests/monitor/run-tests.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh
index 214512d269e8..7a8b1a719dc1 100755
--- a/tests/monitor/run-tests.sh
+++ b/tests/monitor/run-tests.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+pushd .
 cd $(dirname $0)
 nft=${NFT:-../../src/nft}
 debug=false
@@ -125,6 +126,7 @@ for arg in "$@"; do
 	[[ "$arg" == "--no-netns" ]] && netns=false
 done
 if $netns; then
+	popd
 	exec unshare -n $0 --no-netns "$@"
 fi
 
-- 
2.45.2


             reply	other threads:[~2024-11-07 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 12:56 Florian Westphal [this message]
2024-11-07 13:39 ` [PATCH nft] tests: monitor: run-tests.sh: restore cwd before unshare Phil Sutter

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=20241107125657.28339-1-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox