support/dependencies: check that PATH does not contain CWD
A person on IRC reported a build failure with the util-linux package, looking like this: for I in uname26 linux32 linux64 ; do \ cd /home/aep/consulting/chargery/tracker/output/target/usr/bin && ln -sf setarch $I ; \ done [...] /bin/sh: line 1: ./ln: cannot execute binary file: Exec format error /bin/sh: line 1: ./ln: cannot execute binary file: Exec format error /bin/sh: line 1: ./ln: cannot execute binary file: Exec format error The issue was an empty path in the PATH variable, which means "current working directory", causing a "ln" binary built by util-linux for the target to be used instead of the system-provided "ln". We already check a number of things in the PATH and LD_LIBRARY_PATH variables in support/dependencies/dependencies.sh, but we were not checking that PATH did not contain an empty path. This commit fixes that and takes this opportunity to simplify the test code for PATH and LD_LIBRARY_PATH. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [Thomas: improve commit log.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
b73e9e3d21
commit
72703d02b9
@ -11,27 +11,30 @@ if test $? != 0 ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# sanity check for CWD in LD_LIBRARY_PATH
|
# Sanity check for CWD in LD_LIBRARY_PATH
|
||||||
# try not to rely on egrep..
|
case ":${LD_LIBRARY_PATH:-unset}:" in
|
||||||
if test -n "$LD_LIBRARY_PATH" ; then
|
(*::*|*:.:*)
|
||||||
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep '::' >/dev/null 2>&1 ||
|
echo
|
||||||
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 ||
|
echo "You seem to have the current working directory in your"
|
||||||
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start:' >/dev/null 2>&1 ||
|
echo "LD_LIBRARY_PATH environment variable. This doesn't work."
|
||||||
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
|
exit 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 ||
|
esac
|
||||||
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
|
|
||||||
if test $? = 0; then
|
|
||||||
echo
|
|
||||||
echo "You seem to have the current working directory in your"
|
|
||||||
echo "LD_LIBRARY_PATH environment variable. This doesn't work."
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# PATH should not contain a newline, otherwise it fails in spectacular ways
|
# Sanity check for CWD in PATH. Having the current working directory
|
||||||
# as soon as PATH is referenced in a package rule
|
# in the PATH makes various packages (e.g. toolchain, coreutils...)
|
||||||
case "${PATH}" in
|
# build process break.
|
||||||
|
# PATH should not contain a newline, otherwise it fails in spectacular
|
||||||
|
# ways as soon as PATH is referenced in a package rule
|
||||||
|
# An empty PATH is technically possible, but in practice we would not
|
||||||
|
# even arrive here if that was the case.
|
||||||
|
case ":${PATH:-unset}:" in
|
||||||
|
(*::*|*:.:*)
|
||||||
|
echo
|
||||||
|
echo "You seem to have the current working directory in your"
|
||||||
|
echo "PATH environment variable. This doesn't work."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
(*"
|
(*"
|
||||||
"*) printf "\n"
|
"*) printf "\n"
|
||||||
# Break the '\n' sequence, or a \n is printed (which is not what we want).
|
# Break the '\n' sequence, or a \n is printed (which is not what we want).
|
||||||
@ -41,22 +44,6 @@ case "${PATH}" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# sanity check for CWD in PATH. Having the current working directory
|
|
||||||
# in the PATH makes the toolchain build process break.
|
|
||||||
# try not to rely on egrep..
|
|
||||||
if test -n "$PATH" ; then
|
|
||||||
echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 ||
|
|
||||||
echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
|
|
||||||
echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
|
|
||||||
echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
|
|
||||||
if test $? = 0; then
|
|
||||||
echo
|
|
||||||
echo "You seem to have the current working directory in your"
|
|
||||||
echo "PATH environment variable. This doesn't work."
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
fi;
|
|
||||||
|
|
||||||
if test -n "$PERL_MM_OPT" ; then
|
if test -n "$PERL_MM_OPT" ; then
|
||||||
echo
|
echo
|
||||||
echo "You have PERL_MM_OPT defined because Perl local::lib"
|
echo "You have PERL_MM_OPT defined because Perl local::lib"
|
||||||
|
Loading…
Reference in New Issue
Block a user