Re: [PATCH v2 3/5] ci: separate whitespace check script

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

 



On Fri, May 03, 2024 at 09:49:13AM -0700, Junio C Hamano wrote:
> Justin Tobler <jltobler@xxxxxxxxx> writes:
> 
> > On 24/05/03 08:56AM, Patrick Steinhardt wrote:
> >> On Thu, May 02, 2024 at 02:38:37PM -0500, Justin Tobler wrote:
> >> > The `check-whitespace` CI job is only available as a GitHub action. To
> >> > help enable this job with other CI providers, first separate the logic
> >> > performing the whitespace check into its own script. In subsequent
> >> > commits, this script is further generalized allowing its reuse.
> >> > 
> >> > Helped-by: Patrick Steinhardt <ps@xxxxxx>
> >> > Signed-off-by: Justin Tobler <jltobler@xxxxxxxxx>
> >> > ---
> >> [snip]
> >> > diff --git a/ci/check-whitespace.sh b/ci/check-whitespace.sh
> >> > new file mode 100755
> >> > index 0000000000..f57d1ff5f0
> >> > --- /dev/null
> >> > +++ b/ci/check-whitespace.sh
> >> > @@ -0,0 +1,74 @@
> >> > +#!/bin/bash
> >> 
> >> This needs to be either "/bin/sh" or "/usr/bin/env bash".
> >
> > Since the script is using some shell specific features, I'll update this
> > to "/usr/bin/env bash" in the next version.
> 
> This is a question to Patrick, but what makes it bad to assume
> "bash" is in "/bin" when it is OK to assume that "env" is always in
> "/usr/bin"?

My own bias. I know of systems without "/bin/bash" (NixOS), but I don't
know of any without "/usr/bin/env". But you're right, "/usr/bin/env" is
not part of POSIX and thus not really portable, either.

Ultimately I don't think there is any way to write the shebang so that
it is fully POSIX compliant. So I'd rather go with the option which is
supported on more systems, which is to the best of my knowlede env(1).

Patrick

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux