40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
From b74835ec7ca9e42c160702f9690cdf2ee43b55dd Mon Sep 17 00:00:00 2001
|
|
From: Raphael Isemann <teemperor@gmail.com>
|
|
Date: Tue, 11 Jul 2017 08:10:51 +0200
|
|
Subject: [PATCH] Use pid in temp. file names to mitigate race conditions.
|
|
|
|
In case CMake spawns multiple instances of a rootcling invocation
|
|
(which can happen as CMake doesn't have a good mechanism for ensuring
|
|
that we only spawn one when using the make build system), we now
|
|
choose process-unique file names for the temporaries to prevent the
|
|
build errors when multiple rootcling invocations try to work
|
|
on the same temporary file.
|
|
|
|
This isn't a real fix, but as renaming files from temporary to the
|
|
real name is usually FS atomic, this will mitigate any future race
|
|
conditions we have in this problematic part of the building process
|
|
on obscure build systems. Those systems possible don't strictly follow the
|
|
order in which they are supposed to build those targets, so this hopefully
|
|
makes the consequences of any race conditions less intrusive (e.g. Visual
|
|
Studio also seems to suffer from this problem according to the mailing
|
|
list).
|
|
---
|
|
core/dictgen/src/rootcling_impl.cxx | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/core/dictgen/src/rootcling_impl.cxx b/core/dictgen/src/rootcling_impl.cxx
|
|
index bcfaa50631..01f0ff7128 100644
|
|
--- a/core/dictgen/src/rootcling_impl.cxx
|
|
+++ b/core/dictgen/src/rootcling_impl.cxx
|
|
@@ -3218,7 +3218,7 @@ public:
|
|
tempFileNamesCatalog(): m_size(0), m_emptyString("") {};
|
|
|
|
std::string getTmpFileName(const std::string &filename) {
|
|
- return filename + "_tmp";
|
|
+ return filename + "_tmp_" + std::to_string(getpid());
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
/// Adds the name and the associated temp name to the catalog.
|
|
--
|
|
2.13.0
|
|
|