Subject: Re: [RFH] fedora: pedantic fails complaining that awk is missing

From: Junio C Hamano <[email-masked]>
Date: Wed, 16 Apr 2025 07:03:09 -0700

Johannes Schindelin <[email-masked]> writes:

> This reasoning is very convincing, so I allowed myself to turn that into
> the following commit (which fixed the build:
> https://github.com/git-for-windows/git/actions/runs/14485317015/job/40629741228):
>
> -- snipsnap --
> From 4890df8bf1c1311ef0c3b5a92412ccc4f833f944 Mon Sep 17 00:00:00 2001
> From: Johannes Schindelin <[email-masked]>
> Date: Wed, 16 Apr 2025 07:17:24 +0200
> Subject: [PATCH] ci(pedantic): ensure that awk is installed

Superb.  Thanks for working well together.

>
> The image pointed to by the fedora:latest tag has moved from fedora 41
> to 42. The fedora 41 container images have awk installed while the
> fedora 42 images do not.  That change is most likely just part of
> reducing the size of the base container images.
>
> In both AlmaLinux and Fedora (as well as other RHEL
> derivatives/relatives), awk is provided by the gawk package.
>
> On Fedora, `dnf install awk` would work, but for unintended reasons! It
> uses the package filelist data to determine that /usr/bin/awk is
> provided by gawk and installs gawk as a result.
>
> On AlmaLinux (8 & 9, by my quick testing), that is not the case and
> you'd need to use `dnf install gawk` or `dnf install '*bin/awk'` to get
> it installed. Having said that, awk _is_ included in the current
> AlmaLinux 8 and 9 images, so it isn't strictly needed.  But it's
> probably better to be explicit that we need it installed, as a defense
> against some future change to the AlmaLinux container removing awk.
>
> Using the package name "gawk" is the right thing to do.

> Note that even '*bin/awk' would have worked, but it is less specific.
> And who knows, maybe in the far future a BSD variant of awk is offered,
> too, and would then cause ambiguities. Best to avoid that.

The last two paragraphs may want to be rephrased.

The using scripts are saying "awk", not "gawk", so there is no
specific reason to avoid mawk or other implementations at least for
now.  As long as installing one of them makes sure that end-user
scripts that invoke "awk" ends up invoking the one that was
installed, I have no objection to pick just one of them, but I do
not think "we must be explicit to call for 'gawk' and not any other
implementation" is what we want to say.

Instead, we should say something like "Because we know that on both
of these distros, our scripts that call for 'awk' had been using
'gawk' that was installed as part of the base image, let's make sure
that we explicitly install 'gawk'.  If the image already has it, it
would be a no-op that does not cause breakage."

Specifically, we should not say we want to avoid BSD awk, unless we
know our awk scripts won't work with it and/or fixing a bug that was
caused by the incompatibilities.

> Suggested-by: Todd Zullinger <[email-masked]>
> Signed-off-by: Johannes Schindelin <[email-masked]>
> ---

Thanks for not crediting my initial report ;-)
The patch text is as expected.