Skip to content

lvm2: install: fix "Argument list too long" error when copying symlinks #26554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ynezz
Copy link
Member

@ynezz ynezz commented May 21, 2025

Maintainer: @dangowrt
Compile tested: N/A
Run tested: N/A

Description:

It was reported that in some build environments the install step fails with following:

 find /home/.../buildsystem/build_dir/target-aarch64-unknown-linux-gnu_musl/lvm2-normal/LVM2.2.03.22/ipkg-install/usr/sbin/ -type l -exec cp -fpR -a {} /home/.../buildsystem/build_dir/target-aarch64-unknown-linux-gnu_musl/lvm2-normal/LVM2.2.03.22/.pkgdir/lvm2/sbin/ \;
 make[6]: /bin/sh: Argument list too long

This is likely happening once the number of symlinks exceeds the shell's maximum argument limit.

So lets fix it by switching to more reliable xargs based solution:

  • print0/xargs -0 to handle filenames with special characters
  • xargs -r to skip execution if no files are found
  • cp -t to specify the target directory once instead of for each file

Fixes: #26552

It was reported that in some build environments the install step fails
with following:

 find /home/.../buildsystem/build_dir/target-aarch64-unknown-linux-gnu_musl/lvm2-normal/LVM2.2.03.22/ipkg-install/usr/sbin/ -type l -exec cp -fpR -a {} /home/.../buildsystem/build_dir/target-aarch64-unknown-linux-gnu_musl/lvm2-normal/LVM2.2.03.22/.pkgdir/lvm2/sbin/ \;
 make[6]: /bin/sh: Argument list too long

This is likely happening once the number of symlinks exceeds the shell's
maximum argument limit.

So lets fix it by switching to more reliable xargs based solution:

 print0/xargs -0 to handle filenames with special characters
 xargs -r to skip execution if no files are found
 cp -t to specify the target directory once instead of for each file

Fixes: openwrt#26552
Signed-off-by: Petr Štetiar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lvm2: build fails due to find yielding a long command line
1 participant