svn commit: r471992 - head/Mk/Scripts
Mathieu Arnold
mat at FreeBSD.org
Fri Jun 8 09:26:39 UTC 2018
Author: mat
Date: Fri Jun 8 09:26:34 2018
New Revision: 471992
URL: https://svnweb.freebsd.org/changeset/ports/471992
Log:
SC2162: read without -r will mangle backslashes.
By default, read will interpret backslashes before spaces and line
feeds, and otherwise strip them. This is rarely expected or desired.
Normally you just want to read data, which is what read -r does. You
should always use -r unless you have a good reason not to.
PR: 227109
Submitted by: mat
Sponsored by: Absolight
Modified:
head/Mk/Scripts/check-stagedir.sh (contents, props changed)
head/Mk/Scripts/check_leftovers.sh (contents, props changed)
head/Mk/Scripts/generate-symbols.sh (contents, props changed)
head/Mk/Scripts/qa.sh (contents, props changed)
Modified: head/Mk/Scripts/check-stagedir.sh
==============================================================================
--- head/Mk/Scripts/check-stagedir.sh Fri Jun 8 09:26:31 2018 (r471991)
+++ head/Mk/Scripts/check-stagedir.sh Fri Jun 8 09:26:34 2018 (r471992)
@@ -64,7 +64,7 @@ parse_mtree() {
# Sort a directory list by the order of the dfs-sorted file (from find -d -s)
sort_dfs() {
- while read dir; do
+ while read -r dir; do
grep "^[0-9]* ${dir}$" ${WRKDIR}/.staged-dirs-dfs-sorted
done | sort -n | cut -d ' ' -f2-
}
@@ -141,7 +141,7 @@ check_orphans_from_plist() {
echo "===> Checking for items in STAGEDIR missing from pkg-plist"
# Handle whitelisting
- while read path; do
+ while read -r path; do
case "${path}" in
*.bak) ;;
*.orig) ;;
@@ -201,14 +201,14 @@ check_missing_plist_items() {
${WRKDIR}/.missing-plist-dirs | xargs mkdir -p
find -d -s ${WRKDIR}/.missing-dirs | \
sed -e "s,^${WRKDIR}/.missing-dirs,," | \
- while read dir; do \
+ while read -r dir; do \
grep -x "${dir}" ${WRKDIR}/.missing-plist-dirs || :; done | \
sed "${sed_dirs}" \
>>${WRKDIR}/.invalid-plist-missing || :
rm -rf ${WRKDIR}/.missing-dirs
if [ -s "${WRKDIR}/.invalid-plist-missing" ]; then
ret=1
- while read line; do
+ while read -r line; do
echo "Error: Missing: ${line}" >&2
done < ${WRKDIR}/.invalid-plist-missing
fi
Modified: head/Mk/Scripts/check_leftovers.sh
==============================================================================
--- head/Mk/Scripts/check_leftovers.sh Fri Jun 8 09:26:31 2018 (r471991)
+++ head/Mk/Scripts/check_leftovers.sh Fri Jun 8 09:26:34 2018 (r471992)
@@ -49,7 +49,7 @@ homedirs=$(awk -F: -v users="$(make -C ${portdir} -V U
plistsub_sed=$(make -C ${portdir} -VPLIST_SUB_SED | /bin/sh ${PORTSDIR}/Mk/Scripts/plist_sub_sed_sort.sh)
tmpplist=$(make -C ${portdir} -VTMPPLIST)
-while read modtype path extra; do
+while read -r modtype path extra; do
# Ignore everything from these files/directories
case "${path}" in
${CCACHE_DIR}/*|\
Modified: head/Mk/Scripts/generate-symbols.sh
==============================================================================
--- head/Mk/Scripts/generate-symbols.sh Fri Jun 8 09:26:31 2018 (r471991)
+++ head/Mk/Scripts/generate-symbols.sh Fri Jun 8 09:26:34 2018 (r471992)
@@ -13,8 +13,8 @@ ELF_FILES=$(mktemp -t elf_files)
LF=$(printf '\nX')
LF=${LF%X}
find ${STAGEDIR} -type f \
- -exec /usr/bin/file -nNF "${LF}" {} + | while read f; do
- read output
+ -exec /usr/bin/file -nNF "${LF}" {} + | while read -r f; do
+ read -r output
case "${output}" in
ELF\ *\ executable,\ *FreeBSD*,\ not\ stripped*|\
ELF\ *\ shared\ object,\ *FreeBSD*,\ not\ stripped*)
@@ -28,7 +28,7 @@ lib_dir="${STAGEDIR}.debug${PREFIX}/lib/debug"
sed -e "s,^${STAGEDIR}${PREFIX}/,${lib_dir}/," -e 's,/[^/]*$,,' \
${ELF_FILES} | sort -u | xargs mkdir -p
-while read staged_elf_file; do
+while read -r staged_elf_file; do
elf_file_name="${staged_elf_file##*/}"
lib_dir_dest="${lib_dir}/${staged_elf_file#${STAGEDIR}${PREFIX}/}"
# Strip off filename
Modified: head/Mk/Scripts/qa.sh
==============================================================================
--- head/Mk/Scripts/qa.sh Fri Jun 8 09:26:31 2018 (r471991)
+++ head/Mk/Scripts/qa.sh Fri Jun 8 09:26:34 2018 (r471992)
@@ -95,7 +95,7 @@ shebang() {
rc=0
- while read f; do
+ while read -r f; do
# No results presents a blank line from heredoc.
[ -z "${f}" ] && continue
shebangonefile "${f}" || rc=1
@@ -113,7 +113,7 @@ baselibs() {
local found_openssl
local file
[ "${PKGBASE}" = "pkg" -o "${PKGBASE}" = "pkg-devel" ] && return
- while read f; do
+ while read -r f; do
case ${f} in
File:\ .*)
file=${f#File: .}
@@ -148,10 +148,10 @@ symlinks() {
# Split stat(1) result into 2 lines and read each line separately to
# retain spaces in filenames.
- while read l; do
+ while read -r l; do
# No results presents a blank line from heredoc.
[ -z "${l}" ] && continue
- read link
+ read -r link
case "${link}" in
${STAGEDIR}*)
err "Bad symlink '${l#${STAGEDIR}${PREFIX}/}' pointing inside the stage directory"
@@ -181,7 +181,7 @@ paths() {
rc=0
- while read f; do
+ while read -r f; do
# No results presents a blank line from heredoc.
[ -z "${f}" ] && continue
# Ignore false-positive/harmless files
@@ -211,7 +211,7 @@ stripped() {
-exec readelf -S {} + 2>/dev/null | awk '\
/File:/ {sub(/File: /, "", $0); file=$0} \
/[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' |
- while read f; do
+ while read -r f; do
warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
done
}
@@ -260,7 +260,7 @@ suidfiles() {
libtool() {
if [ -z "${USESLIBTOOL}" ]; then
- find ${STAGEDIR} -name '*.la' | while read f; do
+ find ${STAGEDIR} -name '*.la' | while read -r f; do
if grep -q 'libtool library' "${f}"; then
err ".la libraries found, port needs USES=libtool"
return 1
@@ -275,7 +275,7 @@ libperl() {
if [ -n "${SITE_ARCH_REL}" -a -d "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" ]; then
has_some_libperl_so=0
files=0
- while read f; do
+ while read -r f; do
# No results presents a blank line from heredoc.
[ -z "${f}" ] && continue
files=$((files+1))
@@ -648,10 +648,10 @@ proxydeps() {
# Check all dynamicaly linked ELF files
# Some .so are not executable, but we want to check them too.
- while read file; do
+ while read -r file; do
# No results presents a blank line from heredoc.
[ -z "${file}" ] && continue
- while read dep_file; do
+ while read -r dep_file; do
# No results presents a blank line from heredoc.
[ -z "${dep_file}" ] && continue
# Skip files we already checked.
@@ -708,7 +708,7 @@ proxydeps() {
sonames() {
[ ! -d ${STAGEDIR}${PREFIX}/lib -o -n "${BUNDLE_LIBS}" ] && return 0
- while read f; do
+ while read -r f; do
# No results presents a blank line from heredoc.
[ -z "${f}" ] && continue
# Ignore symlinks
@@ -756,7 +756,7 @@ perlcore() {
module=$(perlcore_port_module_mapping "${portname}")
version=$(expr "${dep}" : ".*>=*\([^:<]*\)")
- while read l; do
+ while read -r l; do
case "${l}" in
*was\ not\ in\ CORE*)
# This never was with Perl
@@ -793,7 +793,7 @@ perlcore() {
no_arch() {
[ -z "$NO_ARCH" ] && return
rc=0
- while read f; do
+ while read -r f; do
[ -z "$f" ] && continue
if [ -n "$NO_ARCH_IGNORE" ]; then
skip=
More information about the svn-ports-all
mailing list