Skip to content

Commit a3d2e71

Browse files
authored
Merge pull request #246164 from trofi/strip-no-symlinks
setup-hooks/strip: resolve/uniq symlinks before stripping
2 parents 8eb8f04 + 7adf0a4 commit a3d2e71

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkgs/build-support/setup-hooks/strip.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ stripDirs() {
6868
striperr="$(mktemp 'striperr.XXXXXX')"
6969
# Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
7070
find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 |
71+
# Make sure we process files under symlinks only once. Otherwise
72+
# 'strip` can corrupt files when writes to them in parallel:
73+
# https://github.com/NixOS/nixpkgs/issues/246147#issuecomment-1657072039
74+
xargs -r -0 -n1 -- realpath -z | sort -u -z |
75+
7176
xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2>"$striperr" || exit_code=$?
7277
# xargs exits with status code 123 if some but not all of the
7378
# processes fail. We don't care if some of the files couldn't

0 commit comments

Comments
 (0)