Re: Explicit interpreter paths considered harmful

2009-11-03 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> Rather than putting #!/usr/bin/perl on the first line, >> start with a variant of what's recommended by "man perlrun" that >> invokes the first "perl" program from your shell's search path. > > We should change the test to match. I also

Re: Explicit interpreter paths considered harmful

2009-11-02 Thread Eric Blake
Jim Meyering meyering.net> writes: > Rather than putting #!/usr/bin/perl on the first line, > start with a variant of what's recommended by "man perlrun" that > invokes the first "perl" program from your shell's search path. We should change the test to match. I also ran into a failure on cygwi

Re: Explicit interpreter paths considered harmful

2009-11-02 Thread Simon Josefsson
l...@gnu.org (Ludovic Courtès) writes: > diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html > index 27bb8f3..4fe4c64 100755 > --- a/build-aux/pmccabe2html > +++ b/build-aux/pmccabe2html > @@ -1,4 +1,5 @@ > -#!/usr/bin/awk -f > +#!/bin/sh > +exec awk -f "$0" "$@" > # pmccabe2html - pmcca

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Ludovic Courtès
Excellent, thank you all! Ludo’.

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Jim Meyering wrote: > Ludovic Courtès wrote: >> Works like a charm on NixOS, both with ./gitlog-to-changelog and “perl >> gitlog-to-changelog”, thanks! > > Good! > ... >> While you’re at it, can you update the other scripts under ‘build-aux’ >> that use /usr/bin/perl? > > Of course. Pushed like th

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Ludovic Courtès
Hi Simon, Simon Josefsson writes: > l...@gnu.org (Ludovic Courtès) writes: > >> Here's a patch. >> >> Likewise, ‘pmccabe2html’ assumes /usr/bin/awk, but I’m not sure what to >> do here: > > See the documentation in pmccabe2html -- the recommended way to use the > script is already using $(AWK).

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Ludovic Courtès wrote: > Works like a charm on NixOS, both with ./gitlog-to-changelog and “perl > gitlog-to-changelog”, thanks! Good! ... > While you’re at it, can you update the other scripts under ‘build-aux’ > that use /usr/bin/perl? Of course.

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Ludovic Courtès
Hi, Jim Meyering writes: > From f8a4d66d651f505d0cd349a7c0be025f1b2e12d0 Mon Sep 17 00:00:00 2001 > From: Jim Meyering > Date: Fri, 30 Oct 2009 15:02:02 +0100 > Subject: [PATCH] gitlog-to-changelog: remove #!/usr/bin/perl in favor of more > portable... > MIME-Version: 1.0 > Content-Type: text/

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Paolo Bonzini
On 10/30/2009 04:32 PM, Jim Meyering wrote: I definitely want to keep the -w. If you're writing Perl without warnings enabled, you'd better have a very good reason, and can certainly manage the extra effort of applying s/wS/S/ to those two lines -- along with a comment justifying it, I'd expect.

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Paolo Bonzini wrote: > On 10/30/2009 01:38 PM, Eric Blake wrote: >> According to Jim Meyering on 10/30/2009 6:29 AM: >>> +eval '(exit $?0)'&& eval 'exec perl -wS "$0" ${1+"$@"}' >>> +& eval 'exec /usr/bin/perl -wS "$0" $argv:q' shouldn't that be perl, rather than /usr/bin/perl? ...

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Paolo Bonzini
On 10/30/2009 01:38 PM, Eric Blake wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 10/30/2009 6:29 AM: +eval '(exit $?0)'&& eval 'exec perl -wS "$0" ${1+"$@"}' +& eval 'exec /usr/bin/perl -wS "$0" $argv:q' shouldn't that be perl, rather than /usr/bin/perl?

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Eric Blake wrote: > According to Jim Meyering on 10/30/2009 6:29 AM: >> +eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' >> + & eval 'exec /usr/bin/perl -wS "$0" $argv:q' >>> shouldn't that be perl, rather than /usr/bin/perl? >> >> I could not arrange for that 2nd eval line to mak

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 10/30/2009 6:29 AM: > +eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' > + & eval 'exec /usr/bin/perl -wS "$0" $argv:q' >> shouldn't that be perl, rather than /usr/bin/perl? > > I could not arrange for th

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Eric Blake wrote: > According to Jim Meyering on 10/30/2009 6:00 AM: @@ -1,7 +1,9 @@ -#!/usr/bin/perl +eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' + & eval 'exec /usr/bin/perl -wS "$0" $argv:q' > > shouldn't that be perl, rather than /usr/bin/perl? I could not arr

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 10/30/2009 6:00 AM: >>> @@ -1,7 +1,9 @@ >>> -#!/usr/bin/perl >>> +eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' >>> + & eval 'exec /usr/bin/perl -wS "$0" $argv:q' shouldn't that be perl, rather than /usr/bin/pe

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Eric Blake wrote: > According to Jim Meyering on 10/30/2009 2:52 AM: >> FYI, this appears to work, both when invoked directly, and when invoked >> as "perl gitlog-to-changelog ...", but I'm still on the fence... >> Is it worth the ugliness, when invoking with $(PERL) is so easy, and >> when the rec

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 10/30/2009 2:52 AM: > FYI, this appears to work, both when invoked directly, and when invoked > as "perl gitlog-to-changelog ...", but I'm still on the fence... > Is it worth the ugliness, when invoking with $(PERL) is so e

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Ludovic Courtès wrote: > k...@freefriends.org (Karl Berry) writes: > >> -#!/usr/bin/perl >> +#!/bin/sh >> >> Just to mention that an alternative would be #!/usr/bin/env perl. > > It won’t work on NixOS, which doesn’t have /usr/bin. (On NixOS, the > only “standard” path that can be relied o

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Jim Meyering
Ludovic Courtès wrote: ... > because perl eventually execs /bin/sh: > > 4473 execve("./build-aux/gitlog-to-changelog", > ["./build-aux/gitlog-to-changelog"], [/* 60 vars */]) = 0 > 4473 execve("/var/run/current-system/sw/bin/perl", ["perl", "-S", > "./build-aux/gitlog-to-changelog"], [/* 59 var

Re: Explicit interpreter paths considered harmful

2009-10-30 Thread Simon Josefsson
l...@gnu.org (Ludovic Courtès) writes: > Here's a patch. > > Likewise, ‘pmccabe2html’ assumes /usr/bin/awk, but I’m not sure what to > do here: See the documentation in pmccabe2html -- the recommended way to use the script is already using $(AWK). So I don't think there is any problem, is there?

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Paolo Bonzini
On 10/29/2009 10:46 PM, Ludovic Courtès wrote: > > #! /bin/sh > eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' > if 0; > > suggested in perlrun(1)? > > Actually that doesn’t work: Looks like a typo, further down in perlrun(1) there is #!/usr/bin/perl eval 'e

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Ludovic Courtès
Here's a patch. Likewise, ‘pmccabe2html’ assumes /usr/bin/awk, but I’m not sure what to do here: - ‘gl_PMCCABE2HTML’ does ‘AC_PROG_AWK’, so we could substitute @AWK@ in there. - OTOH, ‘pmccabe2html’ is typically a maintainer script, so I’d rather remove ‘AC_PROG_AWK’ and do something

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Ludovic Courtès
Paolo Bonzini writes: > Yeah. But why not the standard > > #! /bin/sh > eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' > if 0; > > suggested in perlrun(1)? Actually that doesn’t work: --8<---cut here---start->8--- $ ./build-aux/gitlog-to-changelog /bin/sh:

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Ludovic Courtès
Hi Karl, k...@freefriends.org (Karl Berry) writes: > -#!/usr/bin/perl > +#!/bin/sh > > Just to mention that an alternative would be #!/usr/bin/env perl. It won’t work on NixOS, which doesn’t have /usr/bin. (On NixOS, the only “standard” path that can be relied on is /bin/sh.) Thanks, L

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Karl Berry
-#!/usr/bin/perl +#!/bin/sh Just to mention that an alternative would be #!/usr/bin/env perl. I don't know about obscure systems that gnulib may be targeting, but we've used /usr/bin/env for years in TeX Live and elsewhere, so it at least works on a reasonably wide range of systems (GNU,

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Jim Meyering
Ludovic Courtès wrote: > Hello, > > Jim Meyering writes: > >> However, is this really necessary? >> You're not running gitlog-to-changelog manually, are you? >> If it's scripted, you can easily invoke it via "perl gitlog-to-changelog ..." > > True, but then among the scripts under ‘build-aux’, so

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Ludovic Courtès
Hello, Jim Meyering writes: > However, is this really necessary? > You're not running gitlog-to-changelog manually, are you? > If it's scripted, you can easily invoke it via "perl gitlog-to-changelog ..." True, but then among the scripts under ‘build-aux’, some are invoked directly by ‘maint.mk

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Jim Meyering
Ludovic Courtès wrote: > Paolo Bonzini writes: > >>> --- a/build-aux/gitlog-to-changelog >>> +++ b/build-aux/gitlog-to-changelog >>> @@ -1,4 +1,7 @@ >>> -#!/usr/bin/perl >>> +#!/bin/sh >>> +# Accommodate systems where /usr/bin/perl is not the right path. >>> +exec perl -x "$0" "$@" >>> +#!perl >>>

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Paolo Bonzini
#! /bin/sh eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; suggested in perlrun(1)? You mean without ‘/usr/bin/’, right? If so, then yes. Yes, of course. Thanks. Paolo

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Ludovic Courtès
Hi, Paolo Bonzini writes: >> --- a/build-aux/gitlog-to-changelog >> +++ b/build-aux/gitlog-to-changelog >> @@ -1,4 +1,7 @@ >> -#!/usr/bin/perl >> +#!/bin/sh >> +# Accommodate systems where /usr/bin/perl is not the right path. >> +exec perl -x "$0" "$@" >> +#!perl >> >> The only assumption it mak

Re: Explicit interpreter paths considered harmful

2009-10-29 Thread Paolo Bonzini
--- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -1,4 +1,7 @@ -#!/usr/bin/perl +#!/bin/sh +# Accommodate systems where /usr/bin/perl is not the right path. +exec perl -x "$0" "$@" +#!perl The only assumption it makes is about /bin/sh, but that one seems to be hard (imp

Explicit interpreter paths considered harmful

2009-10-29 Thread Ludovic Courtès
Hello, A number of maintainer scripts explicitly use ‘#!/usr/bin/perl’ or similar, but not all systems have Perl at this location (distros such as NixOS and GoboLinux don’t have it there, and users in general are free to install it elsewhere anyway.) Of course it’d be unreasonable to have ‘AC_PAT