Skip to content

Commit 7b741c4

Browse files
jsquyresrhc54
authored andcommitted
src/include/Makefile.am: avoid potential file corruption
It is possible that construct_dictionary.py will be invoked twice simultaneously, which *could* lead to file corruption of the generated files (it probably won't, but it could). Force "make" to serialize the generation of the targets in this makefile, which avoids the problem. See lengthy comment in Makefile.am for more details. Signed-off-by: Jeff Squyres <[email protected]>
1 parent e78b8e5 commit 7b741c4

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/include/Makefile.am

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Copyright (c) 2004-2005 The Regents of the University of California.
1212
# All rights reserved.
1313
# Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
14-
# Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved
14+
# Copyright (c) 2007-2022 Cisco Systems, Inc. All rights reserved
1515
# Copyright (c) 2017 Research Organization for Information Science
1616
# and Technology (RIST). All rights reserved.
1717
# Copyright (c) 2021-2022 Nanook Consulting All rights reserved.
@@ -23,6 +23,25 @@
2323
# $HEADER$
2424
#
2525

26+
# The Automake BUILT_SOURCES hook ultimately calls
27+
# construct_dictionary.py to generate both pmix_dictionary.h and
28+
# pmix_dictionary.c. However, in a parallel "make" invocation, this
29+
# script could be executed twice simultaneously, which *could* lead to
30+
# the generated pmix_dictionary.* files being corrupted (i.e., two
31+
# invokcations simultaneously writing to these generated files). To
32+
# prevent that from happening, force this one Makefile to be run
33+
# serially via the .NOTPARALLEL target. This has two side-effects:
34+
#
35+
# 1. construct_dictionary.py will only be invokved once, because since
36+
# both targets are created in the first invocation, make won't need
37+
# to invoke it a second time for the second target. This is both
38+
# expected and good.
39+
# 2. There is a (very) minor performance implication for the
40+
# other make steps in this Makefile.am (i.e., they won't be run in
41+
# parallel). But this simple solution to avoid a devious potential
42+
# file corruption issue is an acceptable tradeoff.
43+
.NOTPARALLEL:
44+
2645
AM_CFLAGS = \
2746
-DPMIX_PROXY_VERSION_STRING="\"@PMIX_VERSION@\"" \
2847
-DPMIX_PROXY_BUGREPORT_STRING="\"@PMIX_PROXY_BUGREPORT_STRING@\""

0 commit comments

Comments
 (0)