bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parallel distcheck is broken with DIST_DEPENDS_ON_UPDATE_PO=no


From: Lasse Collin
Subject: Parallel distcheck is broken with DIST_DEPENDS_ON_UPDATE_PO=no
Date: Fri, 31 May 2024 22:40:44 +0300

If using DIST_DEPENDS_ON_UPDATE_PO=no, "make -j4 distcheck" may fail
randomly. "distcheck" depends on "dist" which becomes unsafe for
parallel builds with DIST_DEPENDS_ON_UPDATE_PO=no.

Error messages vary depending on where the race condition makes it
fail. These are from three independent runs with XZ Utils after
checking out Git tag v5.6.2 and running autogen.sh, configure, and
"make -j4 dist":

    /bin/msgfmt: error while opening "eo.1po" for reading: No such file or 
directory

    hu.1po:113:48: incomplete multibyte sequence at end of file
    hu.1po:113: end-of-file within string

    mv: cannot stat 't-pt.gmo': No such file or directory

A workaround is to run "make -j1 -C po" after running configure. Then
"stamp-po" will exist and the race condition won't occur.

From Makefile.in.in:

----
dist distdir:
        test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
        @$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: $(srcdir)/stamp-po $(DISTFILES)
        @dists="$(DISTFILES)"; \
----

When DIST_DEPENDS_ON_UPDATE_PO=no, DISTFILESDEPS is empty, so distdir
just runs dist2.

$(DISTFILES) contains many filenames, including the contents of
$(GMOFILES). So dist2 has $(GMOFILES) as prerequisites. This
doesn't work well together with the first prerequisite,
$(srcdir)/stamp-po, because it also builds $(GMOFILES):

----
$(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot
        @$(CHECK_MACRO_VERSION)
        test ! -f $(srcdir)/$(DOMAIN).pot || \
          test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
----

When stamp-po doesn't exist, a parallel build of dist2 won't wait until
$(srcdir)/stamp-po is finished and thus some .gmo files in $(DISTFILES)
won't exist yet when "make" considers the prerequisites. Thus the same
files may be built twice in parallel which sometimes breaks.

This isn't a problem when DIST_DEPENDS_ON_UPDATE_PO=yes because then
the update-po rule will run the rules serially enough.

Something like the following makes it work but I don't know how good
solution it is:

diff --git a/gettext-runtime/po/Makefile.in.in 
b/gettext-runtime/po/Makefile.in.in
index 2b36b1112..e6c58cdd5 100644
--- a/gettext-runtime/po/Makefile.in.in
+++ b/gettext-runtime/po/Makefile.in.in
@@ -414,9 +414,11 @@ maintainer-clean: distclean
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 dist distdir:
        test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
+       $(MAKE) $(srcdir)/stamp-po
        @$(MAKE) dist2
-# This is a separate target because 'update-po' must be executed before.
-dist2: $(srcdir)/stamp-po $(DISTFILES)
+# This is a separate target because 'update-po' and '$(srcdir)/stamp-po'
+# must be executed before.
+dist2: $(DISTFILES)
        @dists="$(DISTFILES)"; \
        if test "$(PACKAGE)" = "gettext-tools"; then \
          dists="$$dists Makevars.template"; \

Thanks to Sam James for spotting the issue and for the help with
debugging.

-- 
Lasse Collin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]