From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: tools@linux.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH] Fix invocation of b4.sh through a symlink
Date: Tue, 24 Mar 2020 10:00:57 +0100 [thread overview]
Message-ID: <20200324090057.25409-1-geert@linux-m68k.org> (raw)
If b4 in your $PATH is a symlink pointing to b4.sh, $SCRIPT_TOP points
to the directory containing the symlink, and b4/command.py cannot be
found.
Fix this by following any symlinks, if present.
After this it works for being invoked through either an alias, symlink,
or plain path.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Stack Overflow tells me "readlink -f" is not supported on OS X and some
BSDs. Do we care?
---
b4.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/b4.sh b/b4.sh
index cafeee186115832d..e5459192d978e41b 100755
--- a/b4.sh
+++ b/b4.sh
@@ -3,6 +3,6 @@
# Run b4 from a git checkout.
#
-SCRIPT_TOP="${SCRIPT_TOP:-$(cd "${BASH_SOURCE%/*}" && pwd)}"
+SCRIPT_TOP="${SCRIPT_TOP:-$(dirname $(readlink -f $0))}"
exec env PYTHONPATH="${SCRIPT_TOP}" python3 "${SCRIPT_TOP}/b4/command.py" "${@}"
--
2.17.1
next reply other threads:[~2020-03-24 9:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 9:00 Geert Uytterhoeven [this message]
2020-03-24 14:33 ` [PATCH] Fix invocation of b4.sh through a symlink Konstantin Ryabitsev
2020-03-24 15:12 ` Geert Uytterhoeven
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=20200324090057.25409-1-geert@linux-m68k.org \
--to=geert@linux-m68k.org \
--cc=konstantin@linuxfoundation.org \
--cc=tools@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox