[pacman-dev] [PATCH 1/2] makepkg: use null-delimited file lists when tracking inodes

Ronan Pigott rpigott314 at gmail.com
Sun Oct 27 03:11:33 UTC 2019


From: Ronan Pigott <rpigott at berkeley.edu>

---
 configure.ac                         | 6 +++---
 meson.build                          | 6 +++---
 scripts/libmakepkg/tidy/zipman.sh.in | 9 +++++----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index d68b3591..fbb3b83b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -370,18 +370,18 @@ GCC_VISIBILITY_CC
 
 # Host-dependant definitions
 DEFAULT_SEDINPLACEFLAGS=" --follow-symlinks -i"
-INODECMD="stat -c '%i %n'"
+INODECMD="stat -c '%i'"
 STRIP_BINARIES="--strip-all"
 STRIP_SHARED="--strip-unneeded"
 STRIP_STATIC="--strip-debug"
 case "${host_os}" in
 	*bsd*)
-		INODECMD="stat -f '%i %N'"
+		INODECMD="stat -f '%i'"
 		DEFAULT_SEDINPLACEFLAGS=" -i \"\""
 		;;
 	darwin*)
 		host_os_darwin=yes
-		INODECMD="/usr/bin/stat -f '%i %N'"
+		INODECMD="/usr/bin/stat -f '%i'"
 		DEFAULT_SEDINPLACEFLAGS=" -i ''"
 		STRIP_BINARIES=""
 		STRIP_SHARED="-S"
diff --git a/meson.build b/meson.build
index c5704efe..648dc80e 100644
--- a/meson.build
+++ b/meson.build
@@ -222,7 +222,7 @@ add_project_arguments('-include', 'config.h', language : 'c')
 
 filecmd = 'file'
 default_sedinplaceflags = ' --follow-symlinks -i'
-inodecmd = 'stat -c \'%i %n\''
+inodecmd = 'stat -c \'%i\''
 strip_binaries = '--strip-all'
 strip_shared = '--strip-unneeded'
 strip_static = '--strip-debug'
@@ -236,13 +236,13 @@ endif
 
 os = host_machine.system()
 if os.startswith('darwin')
-  inodecmd = '/usr/bin/stat -f \'%i %n\''
+  inodecmd = '/usr/bin/stat -f \'%i\''
   default_sedinplaceflags = ' -i \'\''
   strip_binaries = ''
   strip_shared = '-s'
   strip_static = '-s'
 elif os.contains('bsd') or os == 'dragonfly'
-  inodecmd = 'stat -f \'%i %n\''
+  inodecmd = 'stat -f \'%i\''
   default_sedinplaceflags = ' -i \'\''
 endif
 
diff --git a/scripts/libmakepkg/tidy/zipman.sh.in b/scripts/libmakepkg/tidy/zipman.sh.in
index 3c2e261e..dd36ebef 100644
--- a/scripts/libmakepkg/tidy/zipman.sh.in
+++ b/scripts/libmakepkg/tidy/zipman.sh.in
@@ -33,9 +33,10 @@ tidy_modify+=('tidy_zipman')
 tidy_zipman() {
 	if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then
 		msg2 "$(gettext "Compressing man and info pages...")"
-		local file files inode link
-		while read -rd ' ' inode; do
-			read file
+		local file inode link
+		declare -A files
+		while read -rd $'\0' file; do
+			inode=$( @INODECMD@ "$file" )
 			find ${MAN_DIRS[@]} -type l 2>/dev/null |
 			while read -r link ; do
 				if [[ "${file}" -ef "${link}" ]] ; then
@@ -56,6 +57,6 @@ tidy_zipman() {
 				chmod 644 "${file}.gz"
 			fi
 		done < <(find ${MAN_DIRS[@]} -type f \! -name "*.gz" \! -name "*.bz2" \
-			-exec @INODECMD@ '{}' + 2>/dev/null)
+			-print0)
 	fi
 }
-- 
2.23.0


More information about the pacman-dev mailing list