[pacman-dev] [PATCH] pacman-db-upgrade: fix issue with find argument list length overflow

Allan McRae allan at archlinux.org
Tue Nov 25 12:00:50 UTC 2014


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/pacman-db-upgrade.sh.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in
index 2fced9b..7e91ea6 100644
--- a/scripts/pacman-db-upgrade.sh.in
+++ b/scripts/pacman-db-upgrade.sh.in
@@ -174,7 +174,10 @@ if [[ -z "$db_version" ]]; then
 		dirlist+=("${pacroot}${dir%/}")
 	done < <(grep -h '/$' "$dbroot"/local/*/files | sort -ru)
 
-	mapfile -t dirlist < <(find "${dirlist[@]}" -maxdepth 0 -type l)
+	mapfile -t dirlist < <(
+		while IFS=$'\n' read -r dir; do
+			find $dir -maxdepth 0 -type l;
+		done < <(printf '%s\n' "${dirlist[@]}"))
 
 	if [[ ${#dirlist[@]} != 0 ]]; then
 		msg "$(gettext "Pre-4.2 database format detected - upgrading...")"
-- 
2.1.3


More information about the pacman-dev mailing list