aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2018-06-08 17:26:34 +0800
committermat <mat@FreeBSD.org>2018-06-08 17:26:34 +0800
commit9c6c28e803ff62c87f42bd4a1d8ce814220ab3e1 (patch)
tree0ccd94762f32c62ff43be5bcb318d359bdca0758 /Mk
parenteb0051c9bd8fc2413e25e2a50c4408a0107d2443 (diff)
downloadfreebsd-ports-gnome-9c6c28e803ff62c87f42bd4a1d8ce814220ab3e1.tar.gz
freebsd-ports-gnome-9c6c28e803ff62c87f42bd4a1d8ce814220ab3e1.tar.zst
freebsd-ports-gnome-9c6c28e803ff62c87f42bd4a1d8ce814220ab3e1.zip
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
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/check-stagedir.sh8
-rw-r--r--Mk/Scripts/check_leftovers.sh2
-rw-r--r--Mk/Scripts/generate-symbols.sh6
-rw-r--r--Mk/Scripts/qa.sh26
4 files changed, 21 insertions, 21 deletions
diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh
index 2577a964fa09..5c85f2c1cbf2 100644
--- a/Mk/Scripts/check-stagedir.sh
+++ b/Mk/Scripts/check-stagedir.sh
@@ -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
diff --git a/Mk/Scripts/check_leftovers.sh b/Mk/Scripts/check_leftovers.sh
index 78ae38beda74..3db2290403a5 100644
--- a/Mk/Scripts/check_leftovers.sh
+++ b/Mk/Scripts/check_leftovers.sh
@@ -49,7 +49,7 @@ homedirs=$(awk -F: -v users="$(make -C ${portdir} -V USERS|sed -e 's, ,|,g;/^$/d
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}/*|\
diff --git a/Mk/Scripts/generate-symbols.sh b/Mk/Scripts/generate-symbols.sh
index 6d490e86c999..c6074d4203ed 100644
--- a/Mk/Scripts/generate-symbols.sh
+++ b/Mk/Scripts/generate-symbols.sh
@@ -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
diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh
index 9067ec7c3af3..5741d0d7e8c4 100644
--- a/Mk/Scripts/qa.sh
+++ b/Mk/Scripts/qa.sh
@@ -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=