diff options
author | Yann E. MORIN <yann.morin.1998@free.fr> | 2014-11-21 23:53:36 +0100 |
---|---|---|
committer | Peter Korsgaard <peter@korsgaard.com> | 2014-11-30 23:56:14 +0100 |
commit | 514d7cab61ce908d567a1144efa02b3352480196 (patch) | |
tree | 50ca00efd030e524c17fef7575616d0ecc860e88 /support/dependencies | |
parent | 75fa68f5648ed8ccd92c8717794c5499567afeda (diff) | |
download | buildroot-514d7cab61ce908d567a1144efa02b3352480196.tar.gz buildroot-514d7cab61ce908d567a1144efa02b3352480196.zip |
infra: do not append an empty LD_LIBRARY_PATH
When we set LD_LIBRARY_PATH when building our host tools, we append any
pre-existing value to our custom path:
LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)"
But then if LD_LIBRARY_PATH was previously empty, we end up with an
LD_LIBRARY_PATH that ends with a colon.
Also, when we check that an existing LD_LIBRARY_PATH does not contain
CWD, we previously did not look for a zero-length prefix.
Since 'man ld.so' says of LD_LIBRARY_PATH:
A colon-separated list of directories in which to search for ELF
libraries at execution-time. Similar to the PATH environment
variable.
And POSIX states about PATH:
A zero-length prefix is a legacy feature that indicates the current
working directory.
And bash also recognises a zero-length prefix to search in CWD:
A zero-length (null) directory name in the value of PATH indicates
the current directory.
We may thus end up on a system where a zero-length prefix in
LD_LIBRARY_PATH is interpreted as CWD.
Do not append the previous LD_LIBRARY_PATH if it was empty, and check
for a zero-length prefix when checking dependencies.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'support/dependencies')
-rwxr-xr-x | support/dependencies/dependencies.sh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh index a9c5b311ce..af5ce0e544 100755 --- a/support/dependencies/dependencies.sh +++ b/support/dependencies/dependencies.sh @@ -14,8 +14,11 @@ fi # sanity check for CWD in LD_LIBRARY_PATH # try not to rely on egrep.. if test -n "$LD_LIBRARY_PATH" ; then + echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep '::' >/dev/null 2>&1 || echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 || + echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start:' >/dev/null 2>&1 || echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 || + echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':TRiGGER_end' >/dev/null 2>&1 || echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 || echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1 if test $? = 0; then |