kiss: Drop 'ls -ld' file symlink resolution as it is unsafe/unneeded
This commit is contained in:
parent
922d27f6d2
commit
d375e42d8e
23
kiss
23
kiss
|
@ -7,19 +7,9 @@
|
||||||
# [1] Warnings related to word splitting and globbing are disabled.
|
# [1] Warnings related to word splitting and globbing are disabled.
|
||||||
# All word splitting in this script is *safe* and intentional.
|
# All word splitting in this script is *safe* and intentional.
|
||||||
#
|
#
|
||||||
# [2] Information is grabbed from 'ls -ld' output.
|
# [2] Information is grabbed from 'ls -ld' output. The extraction of
|
||||||
#
|
# ownership and permissions from this output is fine for use as
|
||||||
# This is fine _despite_ the usual gaggle about 'ls' and its
|
# it isn't subject to ls' usual file display shenanigans.
|
||||||
# use in scripting. The POSIX specification states that the
|
|
||||||
# link target must be the exact contents of the link.
|
|
||||||
#
|
|
||||||
# The specification:
|
|
||||||
#
|
|
||||||
# > If the file is a symbolic link and the -L option is not
|
|
||||||
# specified, this information shall be about the link
|
|
||||||
# itself and the <pathname> field shall be of the form:
|
|
||||||
#
|
|
||||||
# > "%s -> %s", <pathname of link>, <contents of link>
|
|
||||||
#
|
#
|
||||||
# Created by Dylan Araps.
|
# Created by Dylan Araps.
|
||||||
|
|
||||||
|
@ -505,13 +495,8 @@ pkg_fixdeps() {
|
||||||
# Resolve path symlinks to find the real location to the library.
|
# Resolve path symlinks to find the real location to the library.
|
||||||
cd -P "${dep%/*}" 2>/dev/null || continue
|
cd -P "${dep%/*}" 2>/dev/null || continue
|
||||||
|
|
||||||
# 'ls' is used to obtain the target of the symlink.
|
|
||||||
# See: [2] at top of script.
|
|
||||||
lso=$(ls -ld "$PWD/${dep##*/}" 2>/dev/null) &&
|
|
||||||
case $lso in *' -> '*) lso=${lso##* -> } dep=$PWD/${lso##*/}; esac
|
|
||||||
|
|
||||||
# Figure out which package owns the file.
|
# Figure out which package owns the file.
|
||||||
dep=$(grep -lFx "${dep##"$KISS_ROOT"}" "$@")
|
dep=$(grep -lFx "${PWD#"$KISS_ROOT"}/${dep##*/}" "$@")
|
||||||
dep=${dep%/*} dep=${dep##*/}
|
dep=${dep%/*} dep=${dep##*/}
|
||||||
|
|
||||||
# Skip listing these packages as dependencies.
|
# Skip listing these packages as dependencies.
|
||||||
|
|
Loading…
Reference in New Issue