From be225af8d9aeb6a839f8ff231cbee61d3be45e0f Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Sun, 24 Apr 2011 19:18:03 +0200 Subject: [PATCH] shebang check: ignore symlinks that point outside the prefix As documented in bug #282539, we can have symlinks that point outside the prefix. The targets of those files need not to be checked for their shebang, as they are obviously not under our control. Signed-off-by: Fabian Groffen --- bin/misc-functions.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 59cc9d454..3bf506054 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -800,15 +800,18 @@ install_qa_check_prefix() { IFS=${oldIFS} [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue local fp=${fn#${D}} ; fp=/${fp%/*} + # line[0] can be an absolutised path, bug #342929 + local eprefix=$(canonicalize ${EPREFIX}) local rf=${fn} # in case we deal with a symlink, make sure we don't replace it # with a real file (sed -i does that) if [[ -L ${fn} ]] ; then rf=$(readlink ${fn}) [[ ${rf} != /* ]] && rf=${fn%/*}/${rf} + # ignore symlinks pointing to outside prefix + # as seen in sys-devel/native-cctools + [[ ${rf} != ${EPREFIX}/* && $(canonicalize "${rf}") != ${eprefix}/* ]] && continue fi - # line[0] can be an absolutised path, bug #342929 - local eprefix=$(canonicalize ${EPREFIX}) # does the shebang start with ${EPREFIX}, and does it exist? if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] ; then if [[ ! -e ${ROOT%/}${line[0]} && ! -e ${D%/}${line[0]} ]] ; then -- 2.26.2