summaryrefslogtreecommitdiff
path: root/find-libdeps.in
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-02-13 01:32:03 -0500
committerLevente Polyak <anthraxx@archlinux.org>2019-08-09 19:41:51 +0200
commit8f5a02b23ddb2491c13553cb71276bdd088f63ac (patch)
tree08188546eade249b9ff8d0ff2c1dcb99240afe45 /find-libdeps.in
parente76d56047719c88351492ace896c5899a6786e14 (diff)
downloaddevtools32-8f5a02b23ddb2491c13553cb71276bdd088f63ac.tar.xz
Don't rely on $0 to determine script names.
Programs can freely define the value of argv0 and thus it means nothing. Instead, use the bash-specific variable explicitly designed to safely and accurately reference the name of the currently sourced file. This also fixes the case where simple debugging mechanisms like using "bash -x foo" tried to treat "foo" as the unqualified $0 and therefore broke horribly due to lack of pathnames. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'find-libdeps.in')
-rw-r--r--find-libdeps.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/find-libdeps.in b/find-libdeps.in
index 7a3e6f5..35094d5 100644
--- a/find-libdeps.in
+++ b/find-libdeps.in
@@ -13,7 +13,7 @@ if [[ $1 = "--ignore-internal" ]]; then
shift
fi
-script_mode=${0##*/find-lib}
+script_mode=${BASH_SOURCE[0]##*/find-lib}
case $script_mode in
deps|provides) true;;