From owner-svn-ports-all@FreeBSD.ORG Sat Apr 12 20:48:04 2014 Return-Path: Delivered-To: svn-ports-all@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 ADFD6286; Sat, 12 Apr 2014 20:48:04 +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 80B521CE3; Sat, 12 Apr 2014 20:48:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3CKm49I034695; Sat, 12 Apr 2014 20:48:04 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3CKm4l7034694; Sat, 12 Apr 2014 20:48:04 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201404122048.s3CKm4l7034694@svn.freebsd.org> From: Antoine Brodin Date: Sat, 12 Apr 2014 20:48:04 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r351132 - 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-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2014 20:48:04 -0000 Author: antoine Date: Sat Apr 12 20:48:04 2014 New Revision: 351132 URL: http://svnweb.freebsd.org/changeset/ports/351132 QAT: https://qat.redports.org/buildarchive/r351132/ Log: Reduce the number of false positives reported by the shebang qa check by looking only at files and symlinks in bin, sbin and libexec Reviewed by: bdrewery With hat: portmgr Modified: head/Mk/Scripts/qa.sh Modified: head/Mk/Scripts/qa.sh ============================================================================== --- head/Mk/Scripts/qa.sh Sat Apr 12 20:38:39 2014 (r351131) +++ head/Mk/Scripts/qa.sh Sat Apr 12 20:48:04 2014 (r351132) @@ -18,30 +18,56 @@ err() { echo "Error: $@" >&2 } +shebangonefile() { + local f interp rc + + f="$@" + rc=0 + interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "$f") + case "$interp" in + "") ;; + /usr/bin/env) ;; + ${LOCALBASE}/*) ;; + ${PREFIX}/*) ;; + /usr/bin/awk) ;; + /usr/bin/sed) ;; + /usr/bin/nawk) ;; + /bin/csh) ;; + /bin/sh) ;; + *) + err "${interp} is an invalid shebang you need USES=shebangfix for ${f#${STAGEDIR}${PREFIX}/}" + rc=1 + ;; + esac + + return ${rc} +} + shebang() { - local IFS rc + local f l link rc rc=0 - 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 - "") ;; - /usr/bin/env) ;; - ${LOCALBASE}/*) ;; - ${PREFIX}/*) ;; - /usr/bin/awk) ;; - /usr/bin/sed) ;; - /usr/bin/nawk) ;; - /bin/csh) ;; - /bin/sh) ;; - *) - warn "${interp} is an invalid shebang you need USES=shebangfix for ${f#${STAGEDIR}${PREFIX}/}" - rc=0 - ;; + while read f; do + [ -z "${f}" ] && continue + shebangonefile "${f}" || rc=1 + # Use heredoc to avoid losing rc from find|while subshell + done << EOF +$(find ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/sbin ${STAGEDIR}${PREFIX}/libexec -type f -perm +111 2>/dev/null) +EOF + while read l link; do + [ -z "${l}" ] && continue + case "${link}" in + /*) f="${STAGEDIR}${link}" ;; + *) f="${l%/*}/${link}" ;; esac - done + if [ -f "${f}" ]; then + shebangonefile "${f}" || rc=1 + fi + # Use heredoc to avoid losing rc from find|while subshell + done << EOF +$(find ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/sbin ${STAGEDIR}${PREFIX}/libexec -type l -exec stat -f "%N %Y" {} + 2>/dev/null) +EOF return ${rc} }