mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-23 23:42:35 +00:00
abuild: fix race when stripping
scanelf may pick up tempfiles created by strip or setfattr since it runs in spearate process and pipes the out to a subshell. This causes a race and may lead to the while loop attempt to strip seomthing that no longer exists. We fix that by test if file exists before try manipulate it. We could have written he file list to a temp file first, but this way we benefit from multiple cores working in parallel.
This commit is contained in:
parent
75b8cacaf0
commit
c0a862930c
@ -2247,6 +2247,10 @@ stripbin() {
|
||||
msg "Stripping binaries"
|
||||
scanelf --recursive --nobanner --osabi --etype "ET_DYN,ET_EXEC" . \
|
||||
| while read type osabi filename; do
|
||||
|
||||
# scanelf may have picked up a temp file so verify that file still exists
|
||||
[ -e "$filename" ] || continue
|
||||
|
||||
[ "$osabi" != "STANDALONE" ] || continue
|
||||
local XATTR=$(getfattr --match="" --dump "${filename}")
|
||||
"${stripcmd}" "${filename}"
|
||||
|
Loading…
Reference in New Issue
Block a user