Subject: Re: [PATCH v2 2/2] meson: prefer POSIX-specified shell path

From: "brian m. carlson" <[email-masked]>
Date: Fri, 25 Apr 2025 10:49:10 +0000

On 2025-04-25 at 05:47:45, Patrick Steinhardt wrote:
> Meson detects the path of the target shell via `find_program("sh")`,
> which essentially does a lookup via `PATH`. This may easily lead to a
> subtly-broken Git distribution when the build host has its shell in a
> non-standard location that the target host doesn't know about.
> 
> Fix the issue by appending "/bin" to the custom program path, which
> causes us to prefer "/bin/sh" over a `PATH` lookup. As this location is
> specified by POSIX this should make us pick a better default shell path
> on all POSIX-compliant systems.

Can you provide a citation for that?  I don't see that in the POSIX
1003.1-2024 directory structure document[0].  More specifically, I think
there are some proprietary Unix systems where `/bin/sh` is the original
Bourne shell and is not POSIX compliant and some other path is the
POSIX-compliant `sh`.

I'll also point out that we require more than POSIX compliance in that
we require `local`, so even if `/bin/sh` is POSIX compliant, that
doesn't mean that it's suitable for Git.  `/bin/sh` meets our needs on
all the Linux distros I'm aware of, plus the BSDs, but if it were AT&T
ksh, that would not meet our needs since it doesn't support `local`,
even though it's POSIX compliant.

[0] https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap10.html
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA