Re: [PATCH] global: resolve Perl executable via PATH
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 5, 2023, 14:48 UTC
- Message-ID
- <ZC2KICsJN5pmsqWX@ncase>
- In-Reply-To
- <CAMP44s0eLNOWFr7fc6M5Fompw1Y13vAxk8=fAWVZ8-22Y-xihg@mail.gmail.com>
On Wed, Apr 05, 2023 at 08:35:50AM -0500, Felipe Contreras wrote:
Show 19 quoted lines
> On Wed, Apr 5, 2023 at 5:53 AM Patrick Steinhardt <ps@pks.im> wrote: > > > > The majority of Perl scripts we carry in Git have a `#!/usr/bin/perl` > > shebang. This is not a portable location for the Perl interpreter and > > may thus break on some systems that have the interpreter installed in a > > different location. One such example is NixOS, where the only executable > > installed in `/usr/bin` is env(1). > > > > Convert the shebangs to resolve the location of the Perl interpreter via > > env(1) to make these scripts more portable. While the location of env(1) > > is not guaranteed by any standard either, in practice all distributions > > including NixOS have it available at `/usr/bin/env`. We're also already > > using this idiom in a small set of other scripts, and until now nobody > > complained about them. > > This is standard practice in Ruby, and it does seem to work everywhere. > > However, I wonder if /bin/env does also work. I can't imagine a system > system providing /usr/bin/env but not /bin/env.
NixOS does indeed only have /usr/bin/env and does not have /bin/env, so it wouldn't.
Patrick