bug-gettext
[Top][All Lists]
Advanced

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

Re: [PATCH] po: fix a race in dist2 targets


From: Bruno Haible
Subject: Re: [PATCH] po: fix a race in dist2 targets
Date: Tue, 19 Nov 2024 20:13:44 +0100

Hi,

Lubomir Rintel wrote in:
<https://lists.gnu.org/archive/html/bug-gettext/2022-06/msg00022.html>:
> With parallel make, it is possible that $(GMOFILES) are remade by two
> jobs concurrently:
> 
>   DISTFILES = ... $(GMOFILES) ...
> 
>   dist2: $(srcdir)/stamp-po $(DISTFILES)
>           ...
> 
> The dist2 target above will cause stamp-po and $(DISTFILES) to be remade
> concurrently. $(DISTFILES) contain $(GMOFILES)
> 
>   $(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot
>           ...
>           test ! -f $(srcdir)/$(DOMAIN).pot || \
>             test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
> 
> Here $(GMOFILES) are again remade, while the first invocation might be
> running.
> 
> Note that this race is only hit with DIST_DEPENDS_ON_UPDATE_PO=no,
> because the update-po target can remake GMO files prior to start of
> dist2 target.
> 
> * gettext-runtime/po/Makefile.in.in (dist2): make $(DISTFILES) from
> within the dist2 target instead of depending on them.
> ---
>  gettext-runtime/po/Makefile.in.in | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gettext-runtime/po/Makefile.in.in 
> b/gettext-runtime/po/Makefile.in.in
> index 6b25f0d91..d4d20093c 100644
> --- a/gettext-runtime/po/Makefile.in.in
> +++ b/gettext-runtime/po/Makefile.in.in
> @@ -414,7 +414,8 @@ 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)
> +dist2: $(srcdir)/stamp-po
> +     $(MAKE) $(DISTFILES)
>       @dists="$(DISTFILES)"; \
>       if test "$(PACKAGE)" = "gettext-tools"; then \
>         dists="$$dists Makevars.template"; \
> 

Thanks for the report and patch.

But I want something simpler than that. This Makefile is fragile and already
complicated enough, and I don't have time to
  - think through whether it doesn't open up new problems,
  - test it with "make -n".

Instead, I committed
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=62adf9f077b257a527a6585a3460cbc36fc85d31

Bruno






reply via email to

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