perl libs: perl -w + use warnings is redundant
PATCH 1/1 perl libs: perl -w + use warnings is redundant
Change the Perl scripts to turn on lexical warnings, but only in Perl scripts that definitely require 5.6.0 or later. I.e. those that either did 'use warnings' in addition to -w already, or used the three-arg form of open.
-w sets warnings for all code that interpreter runs. "use warnings" is lexically scoped. The former is probably not what the authors wanted.
--- contrib/examples/git-svnimport.perl | 2 +- contrib/fast-import/import-directories.perl | 3 ++- git-add--interactive.perl | 3 ++- git-archimport.perl | 2 +- git-send-email.perl | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-)
contrib/examples/git-svnimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
contrib/fast-import/import-directories.perl +2 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # # Copyright 2008-2009 Peter Krefting <[email protected]> #
@@ -140,6 +140,7 @@ by whitespace or other characters. # Globals use strict; +use warnings; use integer; my $crlfmode = 0; my @revs;
git-add--interactive.perl +2 -1
@@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Git; binmode(STDOUT, ":raw");
git-archimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # # This tool is copyright (c) 2005, Martin Langhoff. # It is released under the Gnu Public License, version 2.
git-send-email.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # # Copyright 2002,2005 Greg Kroah-Hartman <[email protected]> # Copyright 2005 Ryan Anderson <[email protected]>
Signature · 1 line
1.7.1.98.g4a5f
PATCH 1/1 perl shebangs: Use /usr/bin/env, not /usr/bin/perl
Change the Perl Git utilities to use #!/usr/bin/env perl as a shebang instead of #!/usr/bin/perl. This makes e.g. git-send-email work if your personal perl has Net::SMTP::SSL, but your system perl doesn't.
This only affects shebangs in the uninstalled source tree. On installation shebangs will still be munged to PERL_PATH, which is currently /usr/bin/perl by default.
With this change all the code in Git that uses a shebang now uses /usr/bin/env, except those things that use /bin/sh and /bin/bash. All the Python code already used it, and some of the Perl code.
---
This should probably have been a series, not an individual patch since it depends on <[email protected]> to apply. However the two are functionally independent. I can alter this one so that it applies to the current master on request, but I'm guessing the "perl libs: perl -w + use warnings is redundant" patch is wanted anyway.
Documentation/build-docdep.perl | 2 +- Documentation/cat-texi.perl | 2 +- Documentation/cmd-list.perl | 2 +- Documentation/fix-texi.perl | 2 +- compat/vcbuild/scripts/clink.pl | 2 +- compat/vcbuild/scripts/lib.pl | 2 +- contrib/blameview/blameview.perl | 2 +- contrib/buildsystems/engine.pl | 2 +- contrib/buildsystems/generate | 2 +- contrib/buildsystems/parse.pl | 2 +- contrib/continuous/cidaemon | 2 +- contrib/continuous/post-receive-cinotify | 2 +- contrib/examples/git-remote.perl | 2 +- contrib/examples/git-rerere.perl | 2 +- contrib/examples/git-svnimport.perl | 2 +- contrib/fast-import/git-import.perl | 2 +- contrib/fast-import/import-directories.perl | 2 +- contrib/fast-import/import-tars.perl | 2 +- contrib/hooks/setgitperms.perl | 2 +- contrib/hooks/update-paranoid | 2 +- contrib/stats/mailmap.pl | 2 +- contrib/stats/packinfo.pl | 2 +- git-add--interactive.perl | 2 +- git-archimport.perl | 2 +- git-cvsexportcommit.perl | 2 +- git-cvsimport.perl | 2 +- git-cvsserver.perl | 2 +- git-send-email.perl | 2 +- gitweb/gitweb.perl | 2 +- t/gitweb-lib.sh | 2 +- t/t7006/test-terminal.perl | 2 +- t/t9138-git-svn-authors-prog.sh | 2 +- t/t9700/test.pl | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-)
Documentation/build-docdep.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl my %include = (); my %included = ();
Documentation/cat-texi.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w my @menu = (); my $output = $ARGV[0];
Documentation/cmd-list.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w use File::Compare qw(compare);
Documentation/fix-texi.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w while (<>) { if (/^\@setfilename/) {
compat/vcbuild/scripts/clink.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w ###################################################################### # Compiles or links files #
compat/vcbuild/scripts/lib.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w ###################################################################### # Libifies files on Windows #
contrib/blameview/blameview.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use Gtk2 -init; use Gtk2::SimpleList;
contrib/buildsystems/engine.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w ###################################################################### # Do not call this script directly! #
contrib/buildsystems/generate +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w ###################################################################### # Generate buildsystem files #
contrib/buildsystems/parse.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w ###################################################################### # Do not call this script directly! #
contrib/continuous/cidaemon +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # A daemon that waits for update events sent by its companion # post-receive-cinotify hook, checks out a new copy of source,
contrib/continuous/post-receive-cinotify +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # A hook that notifies its companion cidaemon through a simple # queue file that a ref has been updated via a push (actually
contrib/examples/git-remote.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w use strict; use Git;
contrib/examples/git-rerere.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # REuse REcorded REsolve. This tool records a conflicted automerge # result and its hand resolution, and helps to resolve future
contrib/examples/git-svnimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
contrib/fast-import/git-import.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Performs an initial import of a directory. This is the equivalent # of doing 'git init; git add .; git commit'. It's a little slower,
contrib/fast-import/import-directories.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright 2008-2009 Peter Krefting <[email protected]> #
contrib/fast-import/import-tars.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl ## tar archive frontend for git-fast-import ##
contrib/hooks/setgitperms.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (c) 2006 Josh England #
contrib/hooks/update-paranoid +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use File::Spec;
contrib/stats/mailmap.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w my %mailmap = (); open I, "<", ".mailmap"; while (<I>) {
contrib/stats/packinfo.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # This tool will print vaguely pretty information about a pack. It # expects the output of "git verify-pack -v" as input on stdin.
git-add--interactive.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings;
git-archimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # This tool is copyright (c) 2005, Martin Langhoff. # It is released under the Gnu Public License, version 2.
git-cvsexportcommit.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w use strict; use Getopt::Std;
git-cvsimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
git-cvsserver.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl #### #### This application is a CVS emulation layer for git.
git-send-email.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright 2002,2005 Greg Kroah-Hartman <[email protected]> # Copyright 2005 Ryan Anderson <[email protected]>
gitweb/gitweb.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # gitweb - simple web interface to track changes in git repositories #
t/gitweb-lib.sh +1 -1
@@ -6,7 +6,7 @@ gitweb_init () { safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')" cat >gitweb_config.perl <<EOF -#!/usr/bin/perl +#!/usr/bin/env perl # gitweb configuration for tests
t/t7006/test-terminal.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; use IO::Pty;
t/t9138-git-svn-authors-prog.sh +1 -1
@@ -8,7 +8,7 @@ test_description='git svn authors prog tests' . ./lib-git-svn.sh cat > svn-authors-prog <<'EOF' -#!/usr/bin/perl +#!/usr/bin/env perl $_ = shift; if (s/-sub$//) { print "$_ <$_\@sub.example.com>\n";
t/t9700/test.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use lib (split(/:/, $ENV{GITPERLLIB})); use 5.006002;
Signature · 1 line
1.7.1.98.g4a5f
Re: [PATCH] perl shebangs: Use /usr/bin/env, not /usr/bin/perl
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Ævar" == Ævar Arnfjörð Bjarmason <[email protected]> writes:
Ævar> Change the Perl Git utilities to use #!/usr/bin/env perl as a shebang Ævar> instead of #!/usr/bin/perl. This makes e.g. git-send-email work if Ævar> your personal perl has Net::SMTP::SSL, but your system perl Ævar> doesn't.
Not a good idea in general.
Ævar> With this change all the code in Git that uses a shebang now uses Ævar> /usr/bin/env, except those things that use /bin/sh and /bin/bash. All Ævar> the Python code already used it, and some of the Perl code.
Sorry I didn't catch this earlier then.
I often have an "experimental" Perl earlier in my path than the "official" Perl. This would mean that I'd get different behaviors running git from the command line than I would from automated tools, and it would be relatively confusing.
The official Perl should be in /usr/bin or /usr/local/bin, and that's the one you should use with Git. *Or*, give the installer a knob to configure.
But please don't use env. Heck, some systems might not even *have* env. And some systems have it in /bin and not /usr/bin. Don't ruin portablity at this point, please.
Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[email protected]> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
Re: [PATCH] perl shebangs: Use /usr/bin/env, not /usr/bin/perl
Quoted 3 lines · Randal L. Schwartz
The official Perl should be in
/usr/binor/usr/local/bin, and that's the one you should use with Git. *Or*, give the installer a knob to configure.
Don't we already provide a knob? The Makefile has:
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
[...]
sed -e '1{' \
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
[...]So just setting PERL_PATH should be enough (from which PERL_PATH_SQ is derived).
-Peff
RE: [PATCH] perl shebangs: Use /usr/bin/env, not /usr/bin/perl
In reply to Ævar Arnfjörð BjarmasonQuoted 81 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ævar Arnfjörð Bjarmason
Sent: den 21 maj 2010 17:01
To: [email protected]
Cc: Junio C Hamano; Ævar Arnfjörð Bjarmason
Subject: [PATCH] perl shebangs: Use/usr/bin/env, not/usr/bin/perlChange the Perl Git utilities to use #!/usr/bin/env perl as a shebang instead of #!/usr/bin/perl. This makes e.g. git-send-email work if your personal perl has
Net::SMTP::SSL, but your system perl doesn't.This only affects shebangs in the uninstalled source tree. On installation shebangs will still be munged to
PERL_PATH, which is currently/usr/bin/perlby default.With this change all the code in Git that uses a shebang now uses
/usr/bin/env, except those things that use/bin/shand/bin/bash. All the Python code already used it, and some of the Perl code.Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
This should probably have been a series, not an individual patch since it depends on <[email protected]> to apply. However the two are functionally independent. I can alter this one so that it applies to the current master on request, but I'm guessing the "perl libs: perl -w + use warnings is redundant" patch is wanted anyway.
Documentation/build-docdep.perl | 2 +- Documentation/cat-texi.perl | 2 +- Documentation/cmd-list.perl | 2 +- Documentation/fix-texi.perl | 2 +- compat/vcbuild/scripts/clink.pl | 2 +- compat/vcbuild/scripts/lib.pl | 2 +- contrib/blameview/blameview.perl | 2 +- contrib/buildsystems/engine.pl | 2 +- contrib/buildsystems/generate | 2 +- contrib/buildsystems/parse.pl | 2 +- contrib/continuous/cidaemon | 2 +- contrib/continuous/post-receive-cinotify | 2 +- contrib/examples/git-remote.perl | 2 +- contrib/examples/git-rerere.perl | 2 +- contrib/examples/git-svnimport.perl | 2 +- contrib/fast-import/git-import.perl | 2 +- contrib/fast-import/import-directories.perl | 2 +- contrib/fast-import/import-tars.perl | 2 +- contrib/hooks/setgitperms.perl | 2 +- contrib/hooks/update-paranoid | 2 +- contrib/stats/mailmap.pl | 2 +- contrib/stats/packinfo.pl | 2 +- git-add--interactive.perl | 2 +- git-archimport.perl | 2 +- git-cvsexportcommit.perl | 2 +- git-cvsimport.perl | 2 +- git-cvsserver.perl | 2 +- git-send-email.perl | 2 +- gitweb/gitweb.perl | 2 +- t/gitweb-lib.sh | 2 +- t/t7006/test-terminal.perl | 2 +- t/t9138-git-svn-authors-prog.sh | 2 +- t/t9700/test.pl | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-)Documentation/build- renamed from Documentation/build-docdep.perl +0
-0docdep.perl
index ba4205e..dc50f21 100755Documentation/build-docdep.perl +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl my %include = (); my %included = ();Documentation/cat-texi.perl +0
-0
Documentation/cat-texi.perl line 1
Quoted 2 lines
Documentation/cat-texi.perl +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -w
This does not work. You cannot give arguments to an application started via /usr/bin/env; it will interprete everything after /usr/bin/env as the application name and fail with:
/usr/bin/env: perl -w: No such file or directory
//Peter
Re: [PATCH] perl shebangs: Use /usr/bin/env, not /usr/bin/perl
Quoted 5 lines · Peter Kjellerstedt
This does not work. You cannot give arguments to an application started via
/usr/bin/env; it will interprete everything after/usr/bin/envas the application name and fail with:
/usr/bin/env: perl -w: No such file or directory
Yep. It would have to be changed to/usr/bin/env perl
and add
BEGIN {$^W = 1;}
to the script.
That been said, I've used /usr/bin/env perl for customer applications for years and years, without problems. Things wouldn't have worked otherwise, because on e.g. IRIX systems the /usr/bin/perl version would be 5.005 and the /usr/freeware version would be 5.6.1.BUt the caveat is that you'll need to change -w to the above.
-Tor
Re: [PATCH] perl shebangs: Use /usr/bin/env, not /usr/bin/perl
In reply to Peter KjellerstedtQuoted 3 lines · Peter Kjellerstedt
This does not work. You cannot give arguments to an application started via
/usr/bin/env; it will interprete everything after/usr/bin/envas the application name and fail with:
Doh'oh. You're right of course. I just tested it on the command-line and by executing the scripts (Perl interprets the shebang itself):
$ /usr/bin/env perl -w -le 'print $^W'
1However. Isn't Perl 5.6 the lowest version Git aspires to be compatible with anyway? If that's the case they can just be changed to 'use warnings' across the board.
PATCH v2 1/1 perl shebangs: Use /usr/bin/env, not /usr/bin/perl
Change the Perl Git utilities to use #!/usr/bin/env perl as a shebang instead of #!/usr/bin/perl. In cases where perl -w was part of the shebang I've replaced it with BEGIN { $^W = 0 }. use warnings would be better, but this doesn't break systems still running perl 5.005.
This only affects shebangs in the uninstalled source tree. On installation shebangs will still be munged to PERL_PATH, which is currently /usr/bin/perl by default.
With this change all the code in Git that uses a shebang now uses /usr/bin/env, except those things that use /bin/sh and /bin/bash. All the Python code already used it, and some of the Perl code.
---
Replaces /usr/bin/env perl -w with just perl + BEGIN { $^W = 1 } which has the same effect as -w. I.e. turns on warnings globally.
Documentation/build-docdep.perl | 2 +- Documentation/cat-texi.perl | 2 +- Documentation/cmd-list.perl | 4 ++-- Documentation/fix-texi.perl | 3 ++- compat/vcbuild/scripts/clink.pl | 3 ++- compat/vcbuild/scripts/lib.pl | 3 ++- contrib/blameview/blameview.perl | 2 +- contrib/buildsystems/engine.pl | 3 ++- contrib/buildsystems/generate | 3 ++- contrib/buildsystems/parse.pl | 3 ++- contrib/continuous/cidaemon | 2 +- contrib/continuous/post-receive-cinotify | 2 +- contrib/examples/git-remote.perl | 2 +- contrib/examples/git-rerere.perl | 2 +- contrib/examples/git-svnimport.perl | 2 +- contrib/fast-import/git-import.perl | 2 +- contrib/fast-import/import-directories.perl | 2 +- contrib/fast-import/import-tars.perl | 2 +- contrib/hooks/setgitperms.perl | 2 +- contrib/hooks/update-paranoid | 2 +- contrib/stats/mailmap.pl | 3 +-- contrib/stats/packinfo.pl | 2 +- git-add--interactive.perl | 2 +- git-archimport.perl | 2 +- git-cvsexportcommit.perl | 4 ++-- git-cvsimport.perl | 2 +- git-cvsserver.perl | 2 +- git-send-email.perl | 2 +- gitweb/gitweb.perl | 2 +- t/gitweb-lib.sh | 2 +- t/t7006/test-terminal.perl | 2 +- t/t9138-git-svn-authors-prog.sh | 2 +- t/t9700/test.pl | 2 +- 33 files changed, 41 insertions(+), 36 deletions(-)
Documentation/build-docdep.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl my %include = (); my %included = ();
Documentation/cat-texi.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use warnings; my @menu = ();
Documentation/cmd-list.perl +2 -2
@@ -1,5 +1,5 @@ -#!/usr/bin/perl -use warnings; +#!/usr/bin/env perl -w + use File::Compare qw(compare); sub format_one {
Documentation/fix-texi.perl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl +BEGIN { $^W = 1 } while (<>) { if (/^\@setfilename/) {
compat/vcbuild/scripts/clink.pl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl +BEGIN { $^W = 1 } ###################################################################### # Compiles or links files #
compat/vcbuild/scripts/lib.pl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl +BEGIN { $^W = 1 } ###################################################################### # Libifies files on Windows #
contrib/blameview/blameview.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use Gtk2 -init; use Gtk2::SimpleList;
contrib/buildsystems/engine.pl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl +BEGIN { $^W = 1 } ###################################################################### # Do not call this script directly! #
contrib/buildsystems/generate +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl +BEGIN { $^W = 1 } ###################################################################### # Generate buildsystem files #
contrib/buildsystems/parse.pl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl +BEGIN { $^W = 1 } ###################################################################### # Do not call this script directly! #
contrib/continuous/cidaemon +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # A daemon that waits for update events sent by its companion # post-receive-cinotify hook, checks out a new copy of source,
contrib/continuous/post-receive-cinotify +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # A hook that notifies its companion cidaemon through a simple # queue file that a ref has been updated via a push (actually
contrib/examples/git-remote.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl -w use strict; use warnings;
contrib/examples/git-rerere.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # REuse REcorded REsolve. This tool records a conflicted automerge # result and its hand resolution, and helps to resolve future
contrib/examples/git-svnimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
contrib/fast-import/git-import.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Performs an initial import of a directory. This is the equivalent # of doing 'git init; git add .; git commit'. It's a little slower,
contrib/fast-import/import-directories.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright 2008-2009 Peter Krefting <[email protected]> #
contrib/fast-import/import-tars.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl ## tar archive frontend for git-fast-import ##
contrib/hooks/setgitperms.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (c) 2006 Josh England #
contrib/hooks/update-paranoid +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use File::Spec;
contrib/stats/mailmap.pl +1 -2
@@ -1,5 +1,4 @@ -#!/usr/bin/perl -use warnings; +#!/usr/bin/env perl -w my %mailmap = (); open I, "<", ".mailmap"; while (<I>) {
contrib/stats/packinfo.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # This tool will print vaguely pretty information about a pack. It # expects the output of "git verify-pack -v" as input on stdin.
git-add--interactive.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings;
git-archimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # This tool is copyright (c) 2005, Martin Langhoff. # It is released under the Gnu Public License, version 2.
git-cvsexportcommit.perl +2 -2
@@ -1,5 +1,5 @@ -#!/usr/bin/perl -w - +#!/usr/bin/env perl +BEGIN { $^W = 1 } use strict; use Getopt::Std; use File::Temp qw(tempdir);
git-cvsimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl -w # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
git-cvsserver.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl #### #### This application is a CVS emulation layer for git.
git-send-email.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright 2002,2005 Greg Kroah-Hartman <[email protected]> # Copyright 2005 Ryan Anderson <[email protected]>
gitweb/gitweb.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # gitweb - simple web interface to track changes in git repositories #
t/gitweb-lib.sh +1 -1
@@ -6,7 +6,7 @@ gitweb_init () { safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')" cat >gitweb_config.perl <<EOF -#!/usr/bin/perl +#!/usr/bin/env perl # gitweb configuration for tests
t/t7006/test-terminal.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; use IO::Pty;
t/t9138-git-svn-authors-prog.sh +1 -1
@@ -8,7 +8,7 @@ test_description='git svn authors prog tests' . ./lib-git-svn.sh cat > svn-authors-prog <<'EOF' -#!/usr/bin/perl +#!/usr/bin/env perl $_ = shift; if (s/-sub$//) { print "$_ <$_\@sub.example.com>\n";
t/t9700/test.pl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use lib (split(/:/, $ENV{GITPERLLIB})); use 5.006002;
Signature · 1 line
1.7.1.98.g4a5f
PATCH 1/2 perl libs: perl -w + use warnings is redundant
In reply to Ævar Arnfjörð BjarmasonChange the Perl scripts to turn on lexical warnings, but only in Perl scripts that definitely require 5.6.0 or later. I.e. those that either did 'use warnings' in addition to -w already, or used the three-arg form of open.
-w sets warnings for all code that interpreter runs. "use warnings" is lexically scoped. The former is probably not what the authors wanted.
---
Turns out that I missed a case or two that could 'use warnings'. I.e. used three-arg open.
Documentation/cat-texi.perl | 3 ++- Documentation/cmd-list.perl | 4 ++-- contrib/examples/git-remote.perl | 3 ++- contrib/examples/git-svnimport.perl | 2 +- contrib/fast-import/import-directories.perl | 3 ++- contrib/stats/mailmap.pl | 3 ++- git-add--interactive.perl | 3 ++- git-archimport.perl | 2 +- git-cvsimport.perl | 2 +- git-send-email.perl | 2 +- 10 files changed, 16 insertions(+), 11 deletions(-)
Documentation/cat-texi.perl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl +use warnings; my @menu = (); my $output = $ARGV[0];
Documentation/cmd-list.perl +2 -2
@@ -1,5 +1,5 @@ -#!/usr/bin/perl -w - +#!/usr/bin/perl +use warnings; use File::Compare qw(compare); sub format_one {
contrib/examples/git-remote.perl +2 -1
@@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Git; my $git = Git->repository();
contrib/examples/git-svnimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
contrib/fast-import/import-directories.perl +2 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # # Copyright 2008-2009 Peter Krefting <[email protected]> #
@@ -140,6 +140,7 @@ by whitespace or other characters. # Globals use strict; +use warnings; use integer; my $crlfmode = 0; my @revs;
contrib/stats/mailmap.pl +2 -1
@@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl +use warnings; my %mailmap = (); open I, "<", ".mailmap"; while (<I>) {
git-add--interactive.perl +2 -1
@@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Git; binmode(STDOUT, ":raw");
git-archimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # # This tool is copyright (c) 2005, Martin Langhoff. # It is released under the Gnu Public License, version 2.
git-cvsimport.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2.
git-send-email.perl +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # # Copyright 2002,2005 Greg Kroah-Hartman <[email protected]> # Copyright 2005 Ryan Anderson <[email protected]>
Signature · 1 line
1.7.1.98.g4a5f
Quoted 2 lines · Ævar Arnfjörð Bjarmason
Turns out that I missed a case or two that could 'use warnings'. I.e. used three-arg open.
This one should have had a [PATCH v2] subject line. This is really not my day.