Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2018 16:20:55 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r471274 - head/Mk/Scripts
Message-ID:  <201806011620.w51GKtfc004664@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Fri Jun  1 16:20:54 2018
New Revision: 471274
URL: https://svnweb.freebsd.org/changeset/ports/471274

Log:
  SC2006: Use $(..) instead of legacy `..`.
  
  Backtick command substitution `STATEMENT` is legacy syntax with several
  issues.
  
   - It has a series of undefined behaviors related to quoting in POSIX.
   - It imposes a custom escaping mode with surprising results.
   - It's exceptionally hard to nest.
  
  $(STATEMENT) command substitution has none of these problems, and is
  therefore strongly encouraged.
  
  PR:		227109
  Submitted by:	mat
  Sponsored by:	Absolight

Modified:
  head/Mk/Scripts/actual-package-depends.sh   (contents, props changed)
  head/Mk/Scripts/create-manifest.sh   (contents, props changed)
  head/Mk/Scripts/find-lib.sh   (contents, props changed)
  head/Mk/Scripts/qa.sh   (contents, props changed)

Modified: head/Mk/Scripts/actual-package-depends.sh
==============================================================================
--- head/Mk/Scripts/actual-package-depends.sh	Fri Jun  1 16:20:51 2018	(r471273)
+++ head/Mk/Scripts/actual-package-depends.sh	Fri Jun  1 16:20:54 2018	(r471274)
@@ -17,7 +17,7 @@ resolv_symlink() {
 		return
 	fi
 
-	tgt=`readlink ${file}`
+	tgt=$(readlink ${file})
 	case $tgt in
 	/*)
 		echo $tgt

Modified: head/Mk/Scripts/create-manifest.sh
==============================================================================
--- head/Mk/Scripts/create-manifest.sh	Fri Jun  1 16:20:51 2018	(r471273)
+++ head/Mk/Scripts/create-manifest.sh	Fri Jun  1 16:20:54 2018	(r471274)
@@ -57,8 +57,8 @@ EOT
 [ -z "${dp_LICENSE}" ] || echo "licenses: [ ${dp_LICENSE} ]"
 [ -z "${dp_USERS}" ] || echo "users: [ ${dp_USERS} ]"
 [ -z "${dp_GROUPS}" ] || echo "groups: [ ${dp_GROUPS} ]"
-[ -n "${dp_NO_ARCH}" ] && echo "arch : `${dp_PKG_BIN} config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2`:*"
-[ -n "${dp_NO_ARCH}" ] && echo "abi : `${dp_PKG_BIN} config abi | cut -d: -f1,2`:*"
+[ -n "${dp_NO_ARCH}" ] && echo "arch : $(${dp_PKG_BIN} config abi | tr '[:upper:]' '[:lower:]' | cut -d: -f1,2):*"
+[ -n "${dp_NO_ARCH}" ] && echo "abi : $(${dp_PKG_BIN} config abi | cut -d: -f1,2):*"
 
 # Then the key/values sections
 echo "deps: { "

Modified: head/Mk/Scripts/find-lib.sh
==============================================================================
--- head/Mk/Scripts/find-lib.sh	Fri Jun  1 16:20:51 2018	(r471273)
+++ head/Mk/Scripts/find-lib.sh	Fri Jun  1 16:20:54 2018	(r471274)
@@ -22,12 +22,12 @@ if [ $# -ne 1 ]; then
 fi
 
 lib=$1
-dirs="${LIB_DIRS} `cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :`"
+dirs="${LIB_DIRS} $(cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :)"
 
 for libdir in ${dirs} ; do
 	test -f ${libdir}/${lib} || continue
 	libfile=${libdir}/${lib}
-	[ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue
+	[ $(file -b -L --mime-type ${libfile}) = "application/x-sharedlib" ] || continue
 	echo $libfile
 	break
 done

Modified: head/Mk/Scripts/qa.sh
==============================================================================
--- head/Mk/Scripts/qa.sh	Fri Jun  1 16:20:51 2018	(r471273)
+++ head/Mk/Scripts/qa.sh	Fri Jun  1 16:20:54 2018	(r471274)
@@ -248,9 +248,9 @@ sharedmimeinfo() {
 suidfiles() {
 	local filelist
 
-	filelist=`find ${STAGEDIR} -type f \
+	filelist=$(find ${STAGEDIR} -type f \
 		\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
-		\( -perm -u+s -or -perm -g+s \)`
+		\( -perm -u+s -or -perm -g+s \))
 	if [ -n "${filelist}" ]; then
 		warn "setuid files in the stage directory (are these necessary?):"
 		ls -liTd ${filelist}
@@ -278,12 +278,12 @@ libperl() {
 			# No results presents a blank line from heredoc.
 			[ -z "${f}" ] && continue
 			files=$((files+1))
-			found=`readelf -d ${f} | awk "BEGIN {libperl=1; rpath=10; runpath=100}
+			found=$(readelf -d ${f} | awk "BEGIN {libperl=1; rpath=10; runpath=100}
 				/NEEDED.*${LIBPERL}/  { libperl = 0 }
 				/RPATH.*perl.*CORE/   { rpath   = 0 }
 				/RUNPATH.*perl.*CORE/ { runpath = 0 }
 				END {print libperl+rpath+runpath}
-				"`
+				")
 			case "${found}" in
 				*1)
 					warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806011620.w51GKtfc004664>