[libpng16] Fixed race conditions in parallel make builds. With higher degrees

of parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm.  This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
This commit is contained in:
John Bowler 2011-12-08 09:37:24 -06:00 committed by Glenn Randers-Pehrson
parent 90a87c8853
commit eb26ee6602
4 changed files with 46 additions and 30 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.0alpha01 - December 5, 2011 Libpng 1.6.0alpha01 - December 8, 2011
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -107,7 +107,7 @@ Version 1.5.7beta05 [(PENDING RELEASE)]
Added MINGW support to CMakeLists.txt Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk. Reject invalid compression flag or method when reading the iTXt chunk.
Version 1.6.0alpha01 [December 5, 2011] Version 1.6.0alpha01 [December 8, 2011]
Removed machine-generated configure files from the GIT repository (they will Removed machine-generated configure files from the GIT repository (they will
continue to appear in the tarball distributions). continue to appear in the tarball distributions).
Restored the new 'simplified' API, which was deleted from libpng-1.5.7. Restored the new 'simplified' API, which was deleted from libpng-1.5.7.
@ -135,6 +135,12 @@ Version 1.6.0alpha01 [December 5, 2011]
as in libpng-1.5.4. as in libpng-1.5.4.
Put CRLF line endings in the owatcom project files. Put CRLF line endings in the owatcom project files.
Fixed minor memset/sizeof errors in pngvalid.c. Fixed minor memset/sizeof errors in pngvalid.c.
Fixed race conditions in parallel make builds. With higher degress of
parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm. This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -3752,7 +3752,7 @@ Version 1.5.7beta05 [(PENDING RELEASE)]
Added MINGW support to CMakeLists.txt Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk. Reject invalid compression flag or method when reading the iTXt chunk.
Version 1.6.0alpha01 [December 5, 2011] Version 1.6.0alpha01 [December 8, 2011]
Removed machine-generated configure files from the GIT repository (they will Removed machine-generated configure files from the GIT repository (they will
continue to appear in the tarball distributions). continue to appear in the tarball distributions).
Restored the new 'simplified' API, which was deleted from libpng-1.5.7. Restored the new 'simplified' API, which was deleted from libpng-1.5.7.
@ -3780,6 +3780,12 @@ Version 1.6.0alpha01 [December 5, 2011]
as in libpng-1.5.4. as in libpng-1.5.4.
Put CRLF line endings in the owatcom project files. Put CRLF line endings in the owatcom project files.
Fixed minor memset/sizeof errors in pngvalid.c. Fixed minor memset/sizeof errors in pngvalid.c.
Fixed race conditions in parallel make builds. With higher degress of
parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm. This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -88,7 +88,7 @@ EXTRA_DIST= \
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \ CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
check.new pnglibconf.* symbols.new pngtest-log.txt \ check.new pnglibconf.* symbols.new pngtest-log.txt \
$(SCRIPT_CLEANFILES) $(SCRIPT_CLEANFILES)
@ -143,47 +143,49 @@ SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
.dfn.out: .dfn.out:
rm -f $@ dfn.c dfn?.out rm -f $@ $*.c $*.tf[123]
test -d scripts || mkdir scripts test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c echo '#include "$<"' >$*.c
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out $(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\ $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
dfn1.out >dfn2.out $*.tf1 >$*.tf2
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
rm -f dfn.c dfn[12].out rm -f $*.c $*.tf[12]
mv dfn3.out $@ mv $*.tf3 $@
# The .dfn file for pnglibconf.h is machine generated # The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
rm -f $@ dfn?.out rm -f $@ $*.tf[45]
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out version=search\ $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
$(DFA_XTRA) 1>&2 $(DFA_XTRA) 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2 $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
rm dfn1.out rm $*.tf4
mv dfn2.out $@ mv $*.tf5 $@
# Symbol checks (.def and .out files should match) # Symbol checks (.def and .out files should match)
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
.out.chk: .out.chk:
rm -f $@ symbols.new rm -f $@ $*.new
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\ $(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
$< >&2 of="$*.new" $< >&2
mv symbols.new $@ mv $*.new $@
# used on demand to regenerate the standard header, CPPFLAGS should # used on demand to regenerate the standard header, CPPFLAGS should
# be empty - no non-standard defines # be empty - no non-standard defines
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
rm -f $@ dfn?.out rm -f $@ pnglibconf.tf[67]
test -z "$(CPPFLAGS)" test -z "$(CPPFLAGS)"
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\ echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out logunsupported=1 $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
version=search ${srcdir}/pngconf.h -\ logunsupported=1 version=search ${srcdir}/pngconf.h -\
${srcdir}/scripts/pnglibconf.dfa 1>&2 ${srcdir}/scripts/pnglibconf.dfa 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2 $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf7\
rm dfn1.out pnglibconf.tf6 1>&2
mv dfn2.out $@ rm pnglibconf.tf6
mv pnglibconf.tf7 $@
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \ $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h

View File

@ -5,8 +5,9 @@
# awk -f checksym.awk official-def list-to-check # awk -f checksym.awk official-def list-to-check
# #
# Output is a file in the current directory called 'symbols.new', # Output is a file in the current directory called 'symbols.new',
# stdout holds error messages. Error code indicates success or # the value of the awk variable "of" (which can be changed on the
# failure. # command line if required.) stdout holds error messages. Error
# code indicates success or failure.
# #
# NOTE: this is a pure, old fashioned, awk script. It will # NOTE: this is a pure, old fashioned, awk script. It will
# work with any awk # work with any awk
@ -21,6 +22,7 @@ BEGIN{
mastero = 0 # highest ordinal in master file mastero = 0 # highest ordinal in master file
symbolo = 0 # highest ordinal in png.h symbolo = 0 # highest ordinal in png.h
missing = "error"# log an error on missing symbols missing = "error"# log an error on missing symbols
of="symbols.new" # default to a fixed name
} }
# Read existing definitions from the master file (the first # Read existing definitions from the master file (the first
@ -151,11 +153,11 @@ END{
# Finally generate symbols.new # Finally generate symbols.new
if (symbol[o] != "") if (symbol[o] != "")
print " " symbol[o], "@" o > "symbols.new" print " " symbol[o], "@" o > of
} }
if (err != 0) { if (err != 0) {
print "*** A new list is in symbols.new ***" print "*** A new list is in", of, "***"
exit 1 exit 1
} }
} }