mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 12:23:55 +00:00
setup-hooks/strip: resolve/uniq symlinks before stripping
Before the change the hook had a chance to run `strip` against the same file using multiple link paths. In case of `gcc` `libgcc.a` was stripped multiple times in parallel and produces corrupted archive. The change runs inputs via `realpath | uniq` to make sure we don't attempt to strip the same files multiple times.
This commit is contained in:
parent
a934dd5617
commit
7adf0a4eeb
@ -68,6 +68,11 @@ stripDirs() {
|
||||
striperr="$(mktemp 'striperr.XXXXXX')"
|
||||
# Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
|
||||
find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 |
|
||||
# Make sure we process files under symlinks only once. Otherwise
|
||||
# 'strip` can corrupt files when writes to them in parallel:
|
||||
# https://github.com/NixOS/nixpkgs/issues/246147#issuecomment-1657072039
|
||||
xargs -r -0 -n1 -- realpath -z | sort -u -z |
|
||||
|
||||
xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2>"$striperr" || exit_code=$?
|
||||
# xargs exits with status code 123 if some but not all of the
|
||||
# processes fail. We don't care if some of the files couldn't
|
||||
|
Loading…
Reference in New Issue
Block a user