From: Michael Haubenwallner Date: Sun, 24 Apr 2011 17:18:03 +0000 (+0200) Subject: shebang check: ignore symlinks that point outside the prefix X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be225af8d9aeb6a839f8ff231cbee61d3be45e0f;p=portage.git 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 --- 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