From: Paul Eggleton Date: Fri, 16 Oct 2015 10:34:39 +0000 (+0100) Subject: scripts/gen-lockedsig-cache: fix race with temp file creation X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~28619 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=588de5198c641ea1cfc3e01a6d129296bd2f706b;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git scripts/gen-lockedsig-cache: fix race with temp file creation As part of populating the sstate-cache with an artifact (.tgz file) we create a temp file and then atomically move it to the final name. Due to the glob used in this script such temp files were being matched, and between the time they were matched and the time the script started copying files, the temp file may have vanished. This fixes random "No such file or directory" failures building the extensible SDK on build setups where the sstate-cache directory is shared amongst multiple build machines. Signed-off-by: Paul Eggleton Signed-off-by: Ross Burton --- diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache index c93b2c0b99b..806c1e4caa2 100755 --- a/scripts/gen-lockedsig-cache +++ b/scripts/gen-lockedsig-cache @@ -34,6 +34,10 @@ for s in sigs: files |= set(glob.glob(p)) for f in files: + _, ext = os.path.splitext(f) + if not ext in ['.tgz', '.siginfo', '.sig']: + # Most likely a temp file, skip it + continue dst = f.replace(sys.argv[2], sys.argv[3]) destdir = os.path.dirname(dst) mkdir(destdir)