From owner-svn-ports-head@FreeBSD.ORG Fri May 9 22:29:31 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 3EA90D87; Fri, 9 May 2014 22:29:31 +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 2C1EBCE1; Fri, 9 May 2014 22:29:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s49MTVuA012777; Fri, 9 May 2014 22:29:31 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s49MTVaL012776; Fri, 9 May 2014 22:29:31 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201405092229.s49MTVaL012776@svn.freebsd.org> From: Bryan Drewery Date: Fri, 9 May 2014 22:29:31 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r353532 - 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.18 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: Fri, 09 May 2014 22:29:31 -0000 Author: bdrewery Date: Fri May 9 22:29:30 2014 New Revision: 353532 URL: http://svnweb.freebsd.org/changeset/ports/353532 QAT: https://qat.redports.org/buildarchive/r353532/ Log: - Fix regression handling files with spaces from r350006. Separate file(1) and stat(1) output by a newline and read each line individually to avoid losing spaces. - Use <<-EOF with heredocs to avoid bad indent - Add some more comments - Quote filenames in output so it is less unclear Spotted by: mandree Reviewed by: antoine With hat: portmgr Modified: head/Mk/Scripts/qa.sh Modified: head/Mk/Scripts/qa.sh ============================================================================== --- head/Mk/Scripts/qa.sh Fri May 9 22:28:58 2014 (r353531) +++ head/Mk/Scripts/qa.sh Fri May 9 22:29:30 2014 (r353532) @@ -35,7 +35,7 @@ shebangonefile() { /bin/csh) ;; /bin/sh) ;; *) - err "${interp} is an invalid shebang you need USES=shebangfix for ${f#${STAGEDIR}${PREFIX}/}" + err "'${interp}' is an invalid shebang you need USES=shebangfix for '${f#${STAGEDIR}${PREFIX}/}'" rc=1 ;; esac @@ -49,14 +49,22 @@ shebang() { rc=0 while read f; do + # No results presents a blank line from heredoc. [ -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 + done <<-EOF + $(find ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/sbin \ + ${STAGEDIR}${PREFIX}/libexec -type f -perm +111 2>/dev/null) + EOF + + # Split stat(1) result into 2 lines and read each line separately to + # retain spaces in filenames. + while read l; do + # No results presents a blank line [ -z "${l}" ] && continue + read link + case "${link}" in /*) f="${STAGEDIR}${link}" ;; *) f="${l%/*}/${link}" ;; @@ -65,9 +73,11 @@ EOF 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 + done <<-EOF + $(find ${STAGEDIR}${PREFIX}/bin ${STAGEDIR}${PREFIX}/sbin \ + ${STAGEDIR}${PREFIX}/libexec -type l \ + -exec stat -f "%N${LF}%Y" {} + 2>/dev/null) + EOF return ${rc} } @@ -77,18 +87,22 @@ symlinks() { rc=0 - while read l link; do + # Split stat(1) result into 2 lines and read each line separately to + # retain spaces in filenames. + while read l; do + # No results presents a blank line from heredoc. [ -z "${l}" ] && continue + read link case "${link}" in ${STAGEDIR}*) - err "Bad symlinks ${l#${STAGEDIR}${PREFIX}/} pointing inside the stage directory" + err "Bad symlink '${l#${STAGEDIR}${PREFIX}/}' pointing inside the stage directory" rc=1 ;; esac - # Use heredoc to avoid losing rc from find|while subshell - done << EOF -$(find ${STAGEDIR} -type l -exec stat -f "%N %Y" {} +) -EOF + # Use heredoc to avoid losing rc from find|while subshell. + done <<-EOF + $(find ${STAGEDIR} -type l -exec stat -f "%N${LF}%Y" {} +) + EOF return ${rc} } @@ -99,6 +113,7 @@ paths() { rc=0 while read f; do + # No results presents a blank line from heredoc. [ -z "${f}" ] && continue # Ignore false-positive/harmless files case "${f}" in @@ -106,12 +121,12 @@ paths() { */lib/ruby/gems/*/Makefile.html) continue ;; */lib/ruby/gems/*/mkmf.log) continue ;; esac - err "${f#${STAGEDIR}${PREFIX}/} is referring to ${STAGEDIR}" + err "'${f#${STAGEDIR}${PREFIX}/}' 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 + done <<-EOF + $(find ${STAGEDIR} -type f -exec grep -l "${STAGEDIR}" {} +) + EOF return ${rc} } @@ -120,11 +135,15 @@ EOF stripped() { [ -x /usr/bin/file ] || return # this is fatal [ -n "${STRIP}" ] || return 0 - find ${STAGEDIR} -type f -exec /usr/bin/file -nNF '' {} + | while - read f output; do + # Split file and result into 2 lines and read separately to ensure + # files with spaces are kept intact. + find ${STAGEDIR} -type f \ + -exec /usr/bin/file -nNF "${LF}" {} + | + while read f; do + read output case "${output}" in ELF\ *\ executable,\ *FreeBSD*,\ not\ stripped*|ELF\ *\ shared\ object,\ *FreeBSD*,\ not\ stripped*) - warn "${f#${STAGEDIR}${PREFIX}/} is not stripped consider using \${STRIP_CMD}" + warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider using \${STRIP_CMD}" ;; esac done