From owner-svn-ports-head@FreeBSD.ORG Thu Apr 3 13:00:18 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 916739B9; Thu, 3 Apr 2014 13:00:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 725AB9ED; Thu, 3 Apr 2014 13:00:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s33D0Iro080469; Thu, 3 Apr 2014 13:00:18 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s33D0IVq080468; Thu, 3 Apr 2014 13:00:18 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201404031300.s33D0IVq080468@svn.freebsd.org> From: Bryan Drewery Date: Thu, 3 Apr 2014 13:00:18 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r350006 - head/Mk/Scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Apr 2014 13:00:18 -0000 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 \)`