bug-gnulib
[Top][All Lists]
Advanced

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

Re: Explicit interpreter paths considered harmful


From: Jim Meyering
Subject: Re: Explicit interpreter paths considered harmful
Date: Fri, 30 Oct 2009 15:04:18 +0100

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 make a difference,
>> so figured it'd be best to leave it as is.
>
> Did you try: tcsh ./script?  I'm wondering if that second eval is catering
> to users who run SHELL=tcsh, since the script no longer has a shebang, and
> tcsh has different rules on how to attempt scripts that lack a shebang.

Thanks.  Testing with tcsh demonstrated that the latter absolute path
also should be simply "perl".

Here's what I hope to push as soon as Ludovic confirms:

>From f8a4d66d651f505d0cd349a7c0be025f1b2e12d0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
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/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.
* build-aux/gitlog-to-changelog: Replace #!... as above.
Add a "Local Variables" perl mode setting.
Prompted by a patch from Ludovic Courtès.
Improved by Eric Blake.
---
 ChangeLog                     |   11 +++++++++++
 build-aux/gitlog-to-changelog |    7 +++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4e5e0bb..5b061aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-30  Jim Meyering  <address@hidden>
+
+       gitlog-to-changelog: remove #!/usr/bin/perl in favor of more portable...
+       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.
+       * build-aux/gitlog-to-changelog: Replace #!... as above.
+       Add a "Local Variables" perl mode setting.
+       Prompted by a patch from Ludovic Courtès.
+       Improved by Eric Blake.
+
 2009-10-29  Eric Blake  <address@hidden>

        filenamecat-lgpl: adjust clients
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index a0f8a08..32f76e8 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -1,7 +1,9 @@
-#!/usr/bin/perl
+eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
+  & eval 'exec perl -wS "$0" $argv:q'
+    if 0;
 # Convert git log output to ChangeLog format.

-my $VERSION = '2009-08-12 16:49'; # UTC
+my $VERSION = '2009-10-30 13:46'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -179,6 +181,7 @@ sub quoted_cmd(@)
 }

 # Local Variables:
+# mode: perl
 # indent-tabs-mode: nil
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "my $VERSION = '"
--
1.6.5.2.375.g164f1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]