Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/libmakepkg/tidy/strip.sh.in
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-10-27 03:05:10 -0400
committerAllan McRae <allan@archlinux.org>2019-10-30 09:47:28 +1000
commita745d97c174ef1d85649b2a8ad7ca22e3dea9e58 (patch)
treec748bc75c49e91555503ee7bbeb764a269da1e9e /scripts/libmakepkg/tidy/strip.sh.in
parent99639dc27c4c037b3fe7ddf2b77d036a7332b5e3 (diff)
makepkg: protect against unexpected whitespace in filenames
zipman: read -r protects against those evil manpages whose filenames contain backslash escapes, (muahahaha?) IFS= read protects against filenames with: - leading whitespace (but no one is actually stupid enough to configure their MAN_DIRS=() in makepkg.conf with such silly directories, *right*?) - trailing whitespace (but likewise, no one should be stupid enough to write an uncompressed manpage for section '1 ' or something) Also fix several other cases where we read filenames without protecting against surrounding whitespace, or without using null-delimited filenames when we could trivially do so. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/tidy/strip.sh.in')
-rw-r--r--scripts/libmakepkg/tidy/strip.sh.in6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 99bfcada..1bd810f0 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -57,7 +57,7 @@ strip_file() {
# copy source files to debug directory
local f t
- while read -r t; do
+ while IFS= read -r t; do
f=${t/${dbgsrcdir}/"$srcdir"}
mkdir -p "${dbgsrc/"$dbgsrcdir"/}${t%/*}"
cp -- "$f" "${dbgsrc/"$dbgsrcdir"/}$t"
@@ -69,7 +69,7 @@ strip_file() {
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
# create any needed hardlinks
- while read -rd '' file ; do
+ while IFS= read -rd '' file ; do
if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
mkdir -p "$dbgdir/${file%/*}"
ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
@@ -110,7 +110,7 @@ tidy_strip() {
fi
local binary strip_flags
- find . -type f -perm -u+w -print0 2>/dev/null | while read -rd '' binary ; do
+ find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do
case "$(file -bi "$binary")" in
*application/x-sharedlib*) # Libraries (.so)
strip_flags="$STRIP_SHARED";;