Skip to content

lvm2: build fails due to find yielding a long command line #26552

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
liovbt opened this issue May 21, 2025 · 5 comments · May be fixed by #26554
Open

lvm2: build fails due to find yielding a long command line #26552

liovbt opened this issue May 21, 2025 · 5 comments · May be fixed by #26554

Comments

@liovbt
Copy link

liovbt commented May 21, 2025

In utils/lvm2/Makefile, the following install command creates very long command lines, which can overflow the default limit of 4096 characters.

$(FIND) $(PKG_INSTALL_DIR)/usr/sbin/ -type l -exec $(CP) -a {} $(1)/sbin/ \;

I experienced build failures in my environment because the PKG_INSTALL_DIR is quite long.

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

It would be more robust to execute individual cp commands per file.

@BKPepe
Copy link
Member

BKPepe commented May 21, 2025

Which OpenWrt version are you using?

@liovbt
Copy link
Author

liovbt commented May 21, 2025

I am working on a prplOS build based on OpenWRT 23.05.

@BKPepe
Copy link
Member

BKPepe commented May 21, 2025

Is prplOS supported by us, @ynezz?

@brada4
Copy link
Contributor

brada4 commented May 21, 2025

Thats pre-23.05 package, ask prplos to help with their custom package tree. Or use OpenWrt to complain about this package set

ynezz added a commit to ynezz/openwrt-packages that referenced this issue May 21, 2025
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]>
@ynezz
Copy link
Member

ynezz commented May 21, 2025

@liovbt thanks for the report, can you try proposed fix #26554 and report back?

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 a pull request may close this issue.

4 participants