realpath(3) can be quite heavy, especially if using NFS-mounted root.
Details
Details
/usr/local/bin # ls -al hm lrwxr-xr-x 1 root wheel 7 Nov 14 10:15 hm@ -> clang70 /usr/local/bin # ./hm /usr/local/bin/clang70 clang-7: error: no input files /usr/local/bin # hm /usr/local/bin/clang70 clang-7: error: no input files /usr/local/bin # clang++70 /usr/local/bin/clang++70 clang-7: error: no input files
Diff Detail
Diff Detail
- Repository
- rP FreeBSD ports repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
~/git/poudriere3 # cat /usr/local/bin/clang70
#!/bin/sh
# $FreeBSD: head/devel/llvm70/files/llvm-wrapper.sh.in 466018 2018-03-31 03:28:42Z tobik $
LLVM_PREFIX="/usr/local/llvm70"
LLVM_SUFFIX="70"
tool=$0
[ -L "$tool" ] && tool=$(/bin/realpath $tool)
echo $tool
tool=${tool##*/}
tool="${LLVM_PREFIX}/bin/${tool%${LLVM_SUFFIX}}"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${LLVM_PREFIX}/lib" \
"${tool}" "${@}"
~/git/poudriere3 # ls -al hm
lrwxr-xr-x 1 root wheel 22 Nov 14 14:04 hm@ -> /usr/local/bin/clang70
~/git/poudriere3 # ./hm
/usr/local/bin/clang70
clang-7: error: no input files
~/git/poudriere3 # ls -al /usr/local/bin/hm
lrwxr-xr-x 1 root wheel 7 Nov 14 14:04 /usr/local/bin/hm@ -> clang70
~/git/poudriere3 # /usr/local/bin/hm
/usr/local/bin/clang70
clang-7: error: no input files
~/git/poudriere3 # which hm
/usr/local/bin/hm
~/git/poudriere3 # hm
/usr/local/bin/clang70
clang-7: error: no input filesIf I remove the -L line then it breaks as expected:
~/git/poudriere3 # hm /usr/local/bin/hm /usr/local/bin/hm: /usr/local/llvm70/bin/hm: not found
Comment Actions
Oh right, of course that works. Things called from $PATH are run with a full path in $0.