bug#18301: texi-vers.am: Problem with parallel builds due to vti.tmp

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#18301: texi-vers.am: Problem with parallel builds due to vti.tmp

Friedrich Beckmann
Package: automake
Version: 1.11.6-1

I encounter a problem with automake during parallel builds for the debian pspp package. When I run the build
process non-parallel then it works. The problem only occurs sometimes when I do a parallel build. The build
is a debian package build. Here are the relevant sections from the build.log and Makefile.in:

======== snippet from pspp_0.8.3-3_amd64.build ============
make[4]: Entering directory `/home/fritz/pspp/new/pspp-0.8.3'
make[4]: »doc/.dirstamp« ist bereits aktualisiert.
make[4]: Leaving directory `/home/fritz/pspp/new/pspp-0.8.3'
Updating ./doc/version.texi
Updating ./doc/version.texi
cp: Aufruf von stat für „vti.tmp“ nicht möglich: Datei oder Verzeichnis nicht gefunden
make[3]: *** [doc/stamp-vti] Fehler 1
make[3]: Leaving directory `/home/fritz/pspp/new/pspp-0.8.3'
make[2]: *** [pdf-recursive] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse…
================================================================

The build log shows „Updating ./doc/version.texi“ two times. This message is generated when
the stamp-vti target is build. So obviously the parallel build results in two parallel processes to build
stamp-vti.

================ Relevant section from Makefile.in ======================
$(srcdir)/doc/version.texi:  $(srcdir)/doc/stamp-vti
$(srcdir)/doc/stamp-vti: doc/pspp.texinfo $(top_srcdir)/configure
        test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp)
        @(dir=.; test -f ./doc/pspp.texinfo || dir=$(srcdir); \
        set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/doc/pspp.texinfo`; \
        echo "@set UPDATED $$1 $$2 $$3"; \
        echo "@set UPDATED-MONTH $$2 $$3"; \
        echo "@set EDITION $(VERSION)"; \
        echo "@set VERSION $(VERSION)") > vti.tmp
        @cmp -s vti.tmp $(srcdir)/doc/version.texi \
          || (echo "Updating $(srcdir)/doc/version.texi"; \
              cp vti.tmp $(srcdir)/doc/version.texi)
        -@rm -f vti.tmp
================================================================

I think the problem is due to the file „vti.tmp“ which is generated and removed during the build. When
one process has already deleted the file and the other process wants to delete it, then the error message
in the build log: "cp: Aufruf von stat für „vti.tmp“ nicht möglich: Datei oder Verzeichnis nicht gefunden“
will show up. This means that the file vti.tmp is not found for the copy action.

A possible solution could be based on unique temporary files, instead of vti.tmp.  The relevant automake file
is http://git.savannah.gnu.org/cgit/automake.git/tree/lib/am/texi-vers.am. I think the relevant part of the file
did not change since version 1.11.6. Attached is the full build.log.
The bug report in the pspp project is here: https://savannah.gnu.org/bugs/?43029

Friedrich









pspp_0.8.3-3_amd64.build (70K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#18301: Acknowledgement (texi-vers.am: Problem with parallel builds due to vti.tmp)

Friedrich Beckmann
Tags: patch
Severity: normal

Please find attached a patch to make texi-vers.am compatible with parallel builds.
I tried this patch with my build for pspp here and it works. During execution the existance
of vti.tmp is checked. Only when vti.tmp disappears, the processing continues. When there is
a stale vti.tmp file the processing will wait forever. When the make process is the interrupted, e.g.
with ctrl-c, the vti.tmp file is removed. Then the next make attempt should work.

Friedrich


texi-vers.patch (1012 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#18301: Updated the patch.

Friedrich Beckmann
In reply to this post by Friedrich Beckmann
I updated the patch to have a more secure semaphore behavior along the line described


texi-vers-v2.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#18301: texi-vers.am: Problem with parallel builds due to vti.tmp

Paul Eggert
In reply to this post by Friedrich Beckmann
Thanks, I installed the attached patch, which has the more-usual
approach of a uniquely-named temporary.

0001-build-fix-race-in-parallel-builds.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#18301: closed (Re: texi-vers.am: Problem with parallel builds due to vti.tmp)

Friedrich Beckmann
In reply to this post by Friedrich Beckmann
Dear Paul,

thank for looking at the problem, looking at the patch and introducing a nice solution!
I tried your patch here in my build environment and I do not see any problems.

Thank you!

Friedrich





Reply | Threaded
Open this post in threaded view
|

bug#18301: closed (Re: texi-vers.am: Problem with parallel builds due to vti.tmp)

Friedrich Beckmann
In reply to this post by Friedrich Beckmann