From c0a862930c1bd033be30f2c48e91a6f7e76a5a58 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 31 May 2018 16:37:31 +0200 Subject: 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. --- abuild.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/abuild.in b/abuild.in index a669f65..d52c0bf 100644 --- a/abuild.in +++ b/abuild.in @@ -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}" -- cgit v1.2.3