[pacman-dev] [PATCH] pacman-db-upgrade: fix issue with find argument list length overflow
Dave Reisner
d at falconindy.com
Tue Nov 25 15:47:02 UTC 2014
On Tue, Nov 25, 2014 at 10:00:50PM +1000, Allan McRae wrote:
> 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[@]}"))
This is overly complicated -- just use a for loop to iterate.
mapfile -t dirlist < <(
for dir in "${dirlist[@]}"; do
find "$dir" -maxdepth 0 -type l
done)
>
> if [[ ${#dirlist[@]} != 0 ]]; then
> msg "$(gettext "Pre-4.2 database format detected - upgrading...")"
> --
> 2.1.3
More information about the pacman-dev
mailing list