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 17:10:44 +0100

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 this:
[Paolo, re the somewhat redundant "use warnings;" statements,
 I could go either way.  In any case, we should make things consistent,
 and enforce policy, adding a check to ensure that every perl script in
 gnulib now starts with these two lines, modulo variants like -T and -0777,
 and consistently has-or-lacks the redundant "use warnings;" statement.]

>From b3602e85d8c625e8ffc08855b67c0ae11169a5f3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 30 Oct 2009 15:02:02 +0100
Subject: [PATCH] perl scripts: 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.
* build-aux/useless-if-before-free: Likewise.
* build-aux/announce-gen: Likewise.
* build-aux/update-copyright: Likewise.
---
 ChangeLog                        |   14 ++++++++++++++
 build-aux/announce-gen           |   16 +++++++---------
 build-aux/gitlog-to-changelog    |    7 +++++--
 build-aux/update-copyright       |    7 +++++--
 build-aux/useless-if-before-free |    5 ++++-
 5 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4e5e0bb..561e6d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-30  Jim Meyering  <address@hidden>
+
+       perl scripts: 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.
+       * build-aux/useless-if-before-free: Likewise.
+       * build-aux/announce-gen: Likewise.
+       * build-aux/update-copyright: Likewise.
+
 2009-10-29  Eric Blake  <address@hidden>

        filenamecat-lgpl: adjust clients
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index 972b881..e6be9f8 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -1,7 +1,9 @@
-#!/usr/bin/perl -w
+eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
+  & eval 'exec perl -wS "$0" $argv:q'
+    if 0;
 # Generate a release announcement message.

-my $VERSION = '2009-09-11 09:50'; # UTC
+my $VERSION = '2009-10-30 15:59'; # 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
@@ -476,19 +478,15 @@ EOF

 ### Setup "GNU" style for perl-mode and cperl-mode.
 ## Local Variables:
+## mode: perl
 ## perl-indent-level: 2
 ## perl-continued-statement-offset: 2
 ## perl-continued-brace-offset: 0
 ## perl-brace-offset: 0
 ## perl-brace-imaginary-offset: 0
 ## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
+## perl-extra-newline-before-brace: t
+## perl-merge-trailing-else: nil
 ## eval: (add-hook 'write-file-hooks 'time-stamp)
 ## time-stamp-start: "my $VERSION = '"
 ## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
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 = '"
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 2480142..f541761 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,9 @@
-#!/usr/bin/perl -0777 -pi
+eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
+  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
+    if 0;
 # Update an FSF copyright year list to include the current year.

-my $VERSION = '2009-09-09.22:00'; # UTC
+my $VERSION = '2009-10-30.15:57'; # UTC

 # Copyright (C) 2009 Free Software Foundation, Inc.
 #
@@ -249,6 +251,7 @@ else
   }

 # Local variables:
+# mode: perl
 # indent-tabs-mode: nil
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "my $VERSION = '"
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index abcdef2..793c975 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,4 +1,6 @@
-#!/usr/bin/perl -T
+eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
+  & eval 'exec perl -wST "$0" $argv:q'
+    if 0;
 # Detect instances of "if (p) free (p);".
 # Likewise for "if (p != NULL) free (p);".  And with braces.
 # Also detect "if (NULL != p) free (p);".
@@ -197,6 +199,7 @@ When modifying files, refuse to process anything other than 
a regular file.
 EOF

 ## 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]