]> wolfpit.net Git - tool/Arch-pacman/.git/commitdiff
makepkg: always use read's -r flag with filenames
authorDave Reisner <dreisner@archlinux.org>
Tue, 3 Sep 2013 22:12:53 +0000 (18:12 -0400)
committerAllan McRae <allan@archlinux.org>
Wed, 18 Sep 2013 04:28:03 +0000 (14:28 +1000)
These are all cases where we're reading filenames -- any backslashes
are intentional and should not be interpreted.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
scripts/makepkg.sh.in

index 0825600f821427cfb997d7a234fc2403260911ef..44d5335be4e46a487ce58b36d5132433ab2cef2d 100644 (file)
@@ -1533,7 +1533,7 @@ strip_file() {
                objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
 
                # create any needed hardlinks
-               while read -d '' file ; do
+               while read -rd '' file ; do
                        if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
                                mkdir -p "$dbgdir/${file%/*}"
                                ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
@@ -1615,7 +1615,7 @@ tidy_install() {
                while read -rd ' ' inode; do
                        read file
                        find ${MAN_DIRS[@]} -type l 2>/dev/null |
-                       while read link ; do
+                       while read -r link ; do
                                if [[ "${file}" -ef "${link}" ]] ; then
                                        rm -f "$link" "${link}.gz"
                                        if [[ ${file%/*} = ${link%/*} ]]; then
@@ -1649,7 +1649,7 @@ tidy_install() {
                fi
 
                local binary strip_flags
-               find . -type f -perm -u+w -print0 2>/dev/null | while read -d '' binary ; do
+               find . -type f -perm -u+w -print0 2>/dev/null | while read -rd '' binary ; do
                        case "$(file -bi "$binary")" in
                                *application/x-sharedlib*)  # Libraries (.so)
                                        strip_flags="$STRIP_SHARED";;
@@ -1667,7 +1667,7 @@ tidy_install() {
        if check_option "upx" "y"; then
                msg2 "$(gettext "Compressing binaries with %s...")" "UPX"
                local binary
-               find . -type f -perm -u+w 2>/dev/null | while read binary ; do
+               find . -type f -perm -u+w 2>/dev/null | while read -r binary ; do
                        if [[ $(file -bi "$binary") = *'application/x-executable'* ]]; then
                                upx $UPXFLAGS "$binary" &>/dev/null ||
                                                warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}"
@@ -1695,7 +1695,7 @@ find_libdepends() {
        local libdeps filename soarch sofile soname soversion;
        declare -A libdeps;
 
-       while read filename; do
+       while read -r filename; do
                # get architecture of the file; if soarch is empty it's not an ELF binary
                soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
                [[ -n "$soarch" ]] || continue