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 3, 2024 at 11:27 PM Patrick Steinhardt <ps@xxxxxx> wrote:
>
> On Fri, May 03, 2024 at 09:49:13AM -0700, Junio C Hamano wrote:
> > 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).

The various BSDs mostly stick bash in /usr/local/bin; some versions
of macOS did not have a /bin/bash either, as I recall, though my current
mac-laptop does.

In any case, #! /usr/bin/env <program> is pretty darn common; it's found
in a lot of Python scripts, for instance. It works well on old SunOS, on
the various BSDs, on macOS, and on Linux, provided of course that
the given <program> is installed at all.

The *most* portable method is generally to use only POSIX /bin/sh
constructs, of course. :-)

Chris





[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