From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] Documentation/Makefile: fix lint-docs mkdir dependency
Date: Tue, 26 Oct 2021 12:05:40 +0200 [thread overview]
Message-ID: <211026.86fsso14m1.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <YXeu4Hl2cmIPqobd@coredump.intra.peff.net>
On Tue, Oct 26 2021, Jeff King wrote:
> Since 8650c6298c (doc lint: make "lint-docs" non-.PHONY, 2021-10-15), we
> put the output for gitlink linter into .build/lint-docs/gitlink. There
> are order-only dependencies to create the sequence of subdirs like:
>
> .build/lint-docs: | .build
> $(QUIET)mkdir $@
> .build/lint-docs/gitlink: | .build/lint-docs
> $(QUIET)mkdir $@
>
> where each level has to depend on the prior one (since the parent
> directory must exist for us to create something inside it). But the
> "howto" and "config" subdirectories of gitlink have the wrong
> dependency; they depend on "lint-docs", not "lint-docs/gitlink".
>
> This usually works out, because the LINT_DOCS_GITLINK targets which
> depend on "gitlink/howto" also depend on just "gitlink", so the
> directory gets created anyway. But since we haven't given make an
> explicit ordering, things can racily happen out of order.
>
> If you stick a "sleep 1" in the rule to build "gitlink" like this:
>
> ## Lint: gitlink
> .build/lint-docs/gitlink: | .build/lint-docs
> - $(QUIET)mkdir $@
> + $(QUIET)sleep 1 && mkdir $@
>
> then "make clean; make lint-docs" will fail reliably. Or you can see it
> as-is just by building the directory in isolation:
>
> $ make clean
> [...]
> $ make .build/lint-docs/gitlink/howto
> GEN mergetools-list.made
> GEN cmd-list.made
> GEN doc.dep
> SUBDIR ../
> make[1]: 'GIT-VERSION-FILE' is up to date.
> SUBDIR ../
> make[1]: 'GIT-VERSION-FILE' is up to date.
> mkdir: cannot create directory ‘.build/lint-docs/gitlink/howto’: No such file or directory
> make: *** [Makefile:476: .build/lint-docs/gitlink/howto] Error 1
>
> The fix is easy: we just need to depend on the correct parent directory.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> The problem starts in ab/fix-make-lint-docs, which is in master.
>
> I wasn't able to trigger the problem locally even with running 'make
> clean; make lint-docs' in a loop, but I did see it in the wild in a CI
> documentation job:
>
> https://github.com/peff/git/runs/4005766641?check_suite_focus=true#step:4:60
>
> It would have been a lot easier to diagnose from the CI output if the
> mkdir lines weren't silent. I.e., if we had a $(QUIET_MKDIR) which
> printed "MKDIR $@" rather than nothing at all.
>
> Documentation/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 911b6bf79c..ed656db2ae 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -472,9 +472,9 @@ print-man1:
> ## Lint: gitlink
> .build/lint-docs/gitlink: | .build/lint-docs
> $(QUIET)mkdir $@
> -.build/lint-docs/gitlink/howto: | .build/lint-docs
> +.build/lint-docs/gitlink/howto: | .build/lint-docs/gitlink
> $(QUIET)mkdir $@
> -.build/lint-docs/gitlink/config: | .build/lint-docs
> +.build/lint-docs/gitlink/config: | .build/lint-docs/gitlink
> $(QUIET)mkdir $@
> LINT_DOCS_GITLINK = $(patsubst %.txt,.build/lint-docs/gitlink/%.ok,$(HOWTO_TXT) $(DOC_DEP_TXT))
> $(LINT_DOCS_GITLINK): | .build/lint-docs/gitlink
Thanks a lot for fixing that bug, and sorry for not spotting it. This
fix LGTM and is obviously correct.
I'll try to do something about the $(QUIET*) as a follow-up, I was
trying to find the right balance between over-verbosity & "tracing".
next prev parent reply other threads:[~2021-10-26 10:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 7:31 [PATCH] Documentation/Makefile: fix lint-docs mkdir dependency Jeff King
2021-10-26 10:05 ` Ævar Arnfjörð Bjarmason [this message]
2021-10-26 21:18 ` Jeff King
2021-10-28 0:03 ` Junio C Hamano
2021-10-28 7:48 ` Ævar Arnfjörð Bjarmason
2021-10-28 14:35 ` Jeff King
2021-10-28 16:45 ` Junio C Hamano
2021-10-28 17:06 ` Jeff King
2021-10-28 18:30 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=211026.86fsso14m1.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.