From: Fabian Groffen Date: Thu, 24 Sep 2009 18:23:22 +0000 (-0000) Subject: Make shebang check only fatal on scripts that are located in PATH, warn for those... X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=fe2f3299a134a4ad2a09f155b72cc63ecfbbbd06;p=portage.git Make shebang check only fatal on scripts that are located in PATH, warn for those outside, as suggested by mduft and darkside. Turn the latter warn in a die too when FEATURES=stricter as suggeste by darkside and ulm. svn path=/main/branches/prefix/; revision=14410 --- diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 6e5ffc213..ff6070fed 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -487,9 +487,9 @@ install_qa_check() { | xargs -0 grep -H -n -m1 "^#!" \ | while read f ; do - fn=${f%%:*} - pos=${f#*:} ; pos=${pos%:*} - line=${f##*:} + local fn=${f%%:*} + local pos=${f#*:} ; pos=${pos%:*} + local line=${f##*:} # shebang always appears on the first line ;) [[ ${pos} != 1 ]] && continue line=( ${line#"#!"} ) @@ -502,8 +502,11 @@ install_qa_check() { sed -i -e '1s:^#1 \?:#!'"${EPREFIX}"':' "${fn}" continue fi - # all else is an error - echo "${fn#${D}}:${line[0]}" >> "${T}"/non-prefix-shebangs-errs + # all else is an error if the found script is in $PATH + local fp=${fn#${D}} ; fp=${fp%/*} + [[ ":${PATH}:" == *":${fp}:"* || hasq stricter ${FEATURES} ]] \ + && echo "${fn#${D}}:${line[0]}" >> "${T}"/non-prefix-shebangs-errs \ + || eqawarn "invalid shebang in ${fn#${D}}: ${line[0]}" done if [[ -e "${T}"/non-prefix-shebangs-errs ]] ; then eqawarn "QA Notice: the following files use invalid (possible non-prefixed) shebangs:"