Date: Thu, 3 Apr 2014 13:00:18 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r350006 - head/Mk/Scripts Message-ID: <201404031300.s33D0IVq080468@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Thu Apr 3 13:00:17 2014 New Revision: 350006 URL: http://svnweb.freebsd.org/changeset/ports/350006 QAT: https://qat.redports.org/buildarchive/r350006/ Log: - Fix fatal checks not exiting with non-zero [1] This means that files referrencing stagedir or linked to stagedir will now be fatal errors as intended. - Stop polluting global namespace with IFS changes - Speedup find(1) -exec usage by execing far less - Ignore known false-positive/harmless stagedir files in paths() [2] Reported by: eadler [1] Discussed with: antoine [2] With hat: portmgr Modified: head/Mk/Scripts/qa.sh Modified: head/Mk/Scripts/qa.sh ============================================================================== --- head/Mk/Scripts/qa.sh Thu Apr 3 12:23:43 2014 (r350005) +++ head/Mk/Scripts/qa.sh Thu Apr 3 13:00:17 2014 (r350006) @@ -19,8 +19,12 @@ err() { } shebang() { + local IFS rc + rc=0 - IFS="$LF" ; for f in `find ${STAGEDIR} -type f -perm +111`; do + IFS="$LF" + + for f in `find ${STAGEDIR} -type f -perm +111`; do interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p;2q' $f) case "$interp" in "") ;; @@ -38,38 +42,62 @@ shebang() { ;; esac done + + return ${rc} } symlinks() { + local rc + rc=0 - IFS="$LF" ; for l in `find ${STAGEDIR} -type l`; do - link=$(readlink ${l}) + + while read l link; do + [ -z "${l}" ] && continue case "${link}" in - ${STAGEDIR}*) err "Bad symlinks ${l} pointing inside the stage directory" - rc=1 - ;; + ${STAGEDIR}*) + err "Bad symlinks ${l} pointing inside the stage directory" + rc=1 + ;; esac - done + # Use heredoc to avoid losing rc from find|while subshell + done << EOF +$(find ${STAGEDIR} -type l -exec stat -f "%N %R" {} +) +EOF + + return ${rc} } paths() { + local rc + rc=0 - IFS="$LF" ; for f in `find ${STAGEDIR} -type f`;do - if grep -q ${STAGEDIR} ${f} ; then - err "${f} is referring to ${STAGEDIR}" - rc=1 - fi - done + + while read f; do + [ -z "${f}" ] && continue + # Ignore false-positive/harmless files + case "${f}" in + */lib/ruby/gems/*/Makefile) continue ;; + */lib/ruby/gems/*/Makefile.html) continue ;; + */lib/ruby/gems/*/mkmf.log) continue ;; + esac + err "${f} is referring to ${STAGEDIR}" + rc=1 + # Use heredoc to avoid losing rc from find|while subshell + done << EOF +$(find ${STAGEDIR} -type f -exec grep -l "${STAGEDIR}" {} +) +EOF + + return ${rc} } # For now do not raise an error, just warnings stripped() { [ -x /usr/bin/file ] || return # this is fatal [ -n "${STRIP}" ] || return 0 - IFS="$LF" ; for f in `find ${STAGEDIR} -type f`; do - output=`/usr/bin/file ${f}` + find ${STAGEDIR} -type f -exec /usr/bin/file -nNF '' {} + | while + read f output; do case "${output}" in - *:*\ ELF\ *,\ not\ stripped*) warn "${f} is not stripped consider using \${STRIP_CMD}";; + ELF\ *,\ not\ stripped*) warn "${f} is not stripped consider using \${STRIP_CMD}" ;; esac done } @@ -97,6 +125,8 @@ sharedmimeinfo() { } suidfiles() { + local filelist + filelist=`find ${STAGEDIR} -type f \ \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ \( -perm -u+s -or -perm -g+s \)`
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404031300.s33D0IVq080468>