From: Fabian Groffen Date: Sat, 20 Mar 2010 18:57:51 +0000 (-0000) Subject: make shebang check a bit more strict by not blindly believing all shebangs that start... X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b073a52671c41e61eea91d40b614af4c5415fc8c;p=portage.git make shebang check a bit more strict by not blindly believing all shebangs that start with EPREFIX svn path=/main/branches/prefix/; revision=15838 --- diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index d4ee2bb4a..2997ddbcc 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -628,10 +628,14 @@ install_qa_check_prefix() { line=( ${line#"#!"} ) IFS=${oldIFS} [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue - # does the shebang start with ${EPREFIX}? - [[ ${line[0]} == ${EPREFIX}* ]] && continue - # can we just fix it(tm)? - if [[ -e ${EPREFIX}${line[0]} || -e ${ED}${line[0]} ]] ; then + if [[ ${line[0]} == ${EPREFIX}/* ]] ; then + # does the shebang start with ${EPREFIX}, and does it exist? + if [[ -e ${ROOT}${line[0]} || -e ${D}${line[0]} ]] ; then + continue + fi + elif [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then + # is it unprefixed, but we can just fix it because a + # prefixed variant exists eqawarn "prefixing shebang of ${fn#${D}}" sed -i -e '1s:^#! \?:#!'"${EPREFIX}"':' "${fn}" continue @@ -649,8 +653,8 @@ install_qa_check_prefix() { if [[ -e "${T}"/non-prefix-shebangs-errs ]] ; then eqawarn "QA Notice: the following files use invalid (possible non-prefixed) shebangs:" eqawarn "$(<"${T}"/non-prefix-shebangs-errs)" - die "Aborting due to QA concerns: invalid shebangs found" rm -f "${T}"/non-prefix-shebangs-errs + die "Aborting due to QA concerns: invalid shebangs found" fi }