Skip to contentSkip to conversation

scripts: Switch to more portable Perl shebang

PATCH In review Kamil Rytarowski 3 participants 9 messages May 7, 2017 – May 14, 2017

Subsystems (5)
lore
Share & tools
lore
maintainer
#3 lore raw
In reply to Kamil Rytarowski
Quoted 35 lines · Kamil Rytarowski
Quoted 10 lines · Joe Perches
Quoted 9 lines · Kamil Rytarowski

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

Quoted 5 lines
Quoted 3 lines

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.

Yes.

Quoted 1 line

Better? <shrug>

Correct.

In pkgsrc we have automatic scripts to adjust shebangs for scripting languages (Perl, Python, Bash etc). But in this case I build the Linux kernel out of the pkgsrc context on my NetBSD workstation.

Exactly the same change has been accepted in qemu, currently it's waiting to be merged with master. from the "-trival" branch.

In my case I won't be enforced to keep fixing it manually every time I sync with HEAD. Another point is that the Linux version of this script is model and projects fork it, and we need to keep adjusting it downstream.

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

5.6 was released in 2003.

I know a person using 5.8 (cough: Andrew Morton), but 5.6 really is quite old.

Quoted 2 lines

Out of context of this patch, scripts/namespace.pl ships with "require 5" (year 1994?) - removal of this line could be evaluated.

I'm for removal.

#8 lore raw

PATCH v2 1/1 scripts: Switch to more portable Perl shebang

In reply to Kamil Rytarowski

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

While there, drop "require 5" from scripts/namespace.pl (Perl from 1994?).

---
 scripts/bootgraph.pl                 | 2 +-
 scripts/checkincludes.pl             | 2 +-
 scripts/checkpatch.pl                | 3 ++-
 scripts/checkstack.pl                | 2 +-
 scripts/checkversion.pl              | 2 +-
 scripts/cleanfile                    | 3 ++-
 scripts/cleanpatch                   | 3 ++-
 scripts/dtc/dt_to_config             | 2 +-
 scripts/export_report.pl             | 3 ++-
 scripts/extract-module-sig.pl        | 3 ++-
 scripts/extract-sys-certs.pl         | 3 ++-
 scripts/extract_xc3028.pl            | 2 +-
 scripts/get_dvb_firmware             | 2 +-
 scripts/get_maintainer.pl            | 3 ++-
 scripts/headerdep.pl                 | 2 +-
 scripts/headers_check.pl             | 3 ++-
 scripts/kconfig/streamline_config.pl | 3 ++-
 scripts/kernel-doc                   | 3 ++-
 scripts/kernel-doc-xml-ref           | 3 ++-
 scripts/markup_oops.pl               | 2 +-
 scripts/namespace.pl                 | 4 ++--
 scripts/profile2linkerlist.pl        | 2 +-
 scripts/recordmcount.pl              | 3 ++-
 scripts/stackdelta                   | 2 +-
 24 files changed, 37 insertions(+), 25 deletions(-)
scripts/bootgraph.pl +1 -1
index 9ca667bcaee9..594c55541b16 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright 2008, Intel Corporation
 #
scripts/checkincludes.pl +1 -1
index 381c018a4612..ce9edefd6e0b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 # checkincludes: find/remove files included more than once
 #
scripts/checkpatch.pl +2 -1
index baa3c7be04ad..26cc462dd08e 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # (c) 2001, Dave Jones. (the file handling bit)
 # (c) 2005, Joel Schopp <[email protected]> (the ugly bit)
 # (c) 2007,2008, Andy Whitcroft <[email protected]> (new conditions, test suite)
@@ -6,6 +6,7 @@
 # Licensed under the terms of the GNU GPL License version 2
 
 use strict;
+use warnings;
 use POSIX;
 use File::Basename;
 use Cwd 'abs_path';
scripts/checkstack.pl +1 -1
index 9d37aa4faf5c..7f4c41717e26 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #	Check the stack usage of functions
 #
scripts/checkversion.pl +1 -1
index 5e490a8ceca5..8b4f205234b5 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#! /usr/bin/env perl
 #
 # checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION
 # without including <linux/version.h>, or cases of
scripts/cleanfile +2 -1
index cefd29e52298..72e3755327ae 100755
@@ -1,9 +1,10 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Clean a text file -- or directory of text files -- of stealth whitespace.
 # WARNING: this can be a highly destructive operation.  Use with caution.
 #
 
+use warnings;
 use bytes;
 use File::Basename;
 
scripts/cleanpatch +2 -1
index 9680d03ad2b8..3e5a2303dc0e 100755
@@ -1,9 +1,10 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Clean a patch file -- or directory of patch files -- of stealth whitespace.
 # WARNING: this can be a highly destructive operation.  Use with caution.
 #
 
+use warnings;
 use bytes;
 use File::Basename;
 
scripts/dtc/dt_to_config +1 -1
index 9a248b505c58..5dfd1bff351f 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright 2016 by Frank Rowand
 # Copyright 2016 by Gaurav Minocha
scripts/export_report.pl +2 -1
index 8f79b701de87..68ff426b347c 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # (C) Copyright IBM Corporation 2006.
 #	Released under GPL v2.
@@ -7,6 +7,7 @@
 # Usage: export_report.pl -k Module.symvers [-o report_file ] -f *.mod.c
 #
 
+use warnings;
 use Getopt::Std;
 use strict;
 
scripts/extract-module-sig.pl +2 -1
index faac6f2e377f..0f161ea41261 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # extract-mod-sig <part> <module-file>
 #
@@ -12,6 +12,7 @@
 #  -k: Just the key ID
 #  -s: Just the crypto signature or PKCS#7 message
 #
+use warnings;
 use strict;
 
 die "Format: $0 -[0adnks] module-file >out\n"
scripts/extract-sys-certs.pl +2 -1
index 8227ca10a494..2aa873b944e0 100755
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
+use warnings;
 use strict;
 use Math::BigInt;
 use Fcntl "SEEK_SET";
scripts/extract_xc3028.pl +1 -1
index 47877deae6d7..61d9b256c658 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright (c) Mauro Carvalho Chehab <[email protected]>
 # Released under GPLv2
scripts/get_dvb_firmware +1 -1
index 1a0a04125f71..f3f230225aba 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #     DVB firmware extractor
 #
 #     (c) 2004 Andrew de Quincey
scripts/get_maintainer.pl +2 -1
index 633f2dd3de27..3bd5f4f30235 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # (c) 2007, Joe Perches <[email protected]>
 #           created from checkpatch.pl
 #
@@ -10,6 +10,7 @@
 #
 # Licensed under the terms of the GNU GPL License version 2
 
+use warnings;
 use strict;
 
 my $P = $0;
scripts/headerdep.pl +1 -1
index 8dd019bc5a73..86ebb9ee7570 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#! /usr/bin/env perl
 #
 # Detect cycles in the header file dependency graph
 # Vegard Nossum <[email protected]>
scripts/headers_check.pl +2 -1
index 8b2da054cdc3..3091e4ee6ee1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # headers_check.pl execute a number of trivial consistency checks
 #
@@ -18,6 +18,7 @@
 #
 # 3) Check for leaked CONFIG_ symbols
 
+use warnings;
 use strict;
 use File::Basename;
 
scripts/kconfig/streamline_config.pl +2 -1
index b8c7b29affc5..a2e83ab17de3 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Copyright 2005-2009 - Steven Rostedt
 # Licensed under the terms of the GNU GPL License version 2
@@ -42,6 +42,7 @@
 #    mv config_strip .config
 #    make oldconfig
 #
+use warnings;
 use strict;
 use Getopt::Long;
 
scripts/kernel-doc +2 -1
index a26a5f2dce39..7b0a8f01fed5 100755
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 
+use warnings;
 use strict;
 
 ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved        ##
scripts/kernel-doc-xml-ref +2 -1
index 104a5a5ba2c8..e3b24bfc804c 100755
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 
+use warnings;
 use strict;
 
 ## Copyright (C) 2015  Intel Corporation                         ##
scripts/markup_oops.pl +1 -1
index c21d16328d3f..70dcfb6b3de1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use File::Basename;
 use Math::BigInt;
scripts/namespace.pl +2 -2
index 9f3c9d47a4a5..729c547fc9e1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 #	namespace.pl.  Mon Aug 30 2004
 #
@@ -62,7 +62,7 @@
 #	  result.
 #
 
-require 5;	# at least perl 5
+use warnings;
 use strict;
 use File::Find;
 
scripts/profile2linkerlist.pl +1 -1
index 6943fa7cc95b..f23d7be94394 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 # Takes a (sorted) output of readprofile and turns it into a list suitable for
scripts/recordmcount.pl +2 -1
index 1633c3e6c0b9..2033af758173 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # (c) 2008, Steven Rostedt <[email protected]>
 # Licensed under the terms of the GNU GPL License version 2
 #
@@ -106,6 +106,7 @@
 # 9) Move the result back to the original object.
 #
 
+use warnings;
 use strict;
 
 my $P = $0;
scripts/stackdelta +1 -1
index 48eabf2f48f8..20a79f19a111 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Read two files produced by the stackusage script, and show the
 # delta between them.
Signature · 1 line
2.12.2
#4 lore raw
In reply to Joe Perches
Quoted 41 lines · Joe Perches
Quoted 40 lines · Kamil Rytarowski
Quoted 10 lines · Joe Perches
Quoted 9 lines · Kamil Rytarowski

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

Quoted 5 lines
Quoted 3 lines

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.

Yes.

Quoted 1 line

Better? <shrug>

Correct.

In pkgsrc we have automatic scripts to adjust shebangs for scripting languages (Perl, Python, Bash etc). But in this case I build the Linux kernel out of the pkgsrc context on my NetBSD workstation.

Exactly the same change has been accepted in qemu, currently it's waiting to be merged with master. from the "-trival" branch.

In my case I won't be enforced to keep fixing it manually every time I sync with HEAD. Another point is that the Linux version of this script is model and projects fork it, and we need to keep adjusting it downstream.

Quoted 5 lines

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

Quoted 5 lines
Quoted 1 line

5.6 was released in 2003.

I know a person using 5.8 (cough: Andrew Morton), but 5.6 really is quite old.

It was just decided to depend on GNU Make 3.81 (released 2010). Minimal required GCC bump has been discussed a while ago.. I don't expect to have people with 2003 setups and functional enough to build the kernel from HEAD.

Quoted 5 lines
Quoted 2 lines

Out of context of this patch, scripts/namespace.pl ships with "require 5" (year 1994?) - removal of this line could be evaluated.

I'm for removal.

I will include it in v2.

maintainer
#1 lore raw
In reply to Kamil Rytarowski
Quoted 5 lines · Kamil Rytarowski

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

Quoted 7 lines

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.
Better? <shrug>

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

#2 lore raw
Quoted 10 lines · Joe Perches
Quoted 9 lines · Kamil Rytarowski

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

Quoted 5 lines
Quoted 3 lines

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.

Yes.

Quoted 1 line

Better? <shrug>

Correct.

In pkgsrc we have automatic scripts to adjust shebangs for scripting languages (Perl, Python, Bash etc). But in this case I build the Linux kernel out of the pkgsrc context on my NetBSD workstation.

Exactly the same change has been accepted in qemu, currently it's waiting to be merged with master. from the "-trival" branch.

In my case I won't be enforced to keep fixing it manually every time I sync with HEAD. Another point is that the Linux version of this script is model and projects fork it, and we need to keep adjusting it downstream.

Quoted 5 lines

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

5.6 was released in 2003.

Out of context of this patch, scripts/namespace.pl ships with "require 5" (year 1994?) - removal of this line could be evaluated.

#5 lore raw
In reply to Kamil Rytarowski

2017-05-08 5:37 GMT+09:00 Kamil Rytarowski <[email protected]>:

Quoted 42 lines · Joe Perches
Quoted 41 lines · Kamil Rytarowski
Quoted 40 lines · Joe Perches
Quoted 10 lines · Kamil Rytarowski
Quoted 9 lines

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

Quoted 5 lines
Quoted 3 lines

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.

Yes.

Quoted 1 line

Better? <shrug>

Correct.

In pkgsrc we have automatic scripts to adjust shebangs for scripting languages (Perl, Python, Bash etc). But in this case I build the Linux kernel out of the pkgsrc context on my NetBSD workstation.

Exactly the same change has been accepted in qemu, currently it's waiting to be merged with master. from the "-trival" branch.

In my case I won't be enforced to keep fixing it manually every time I sync with HEAD. Another point is that the Linux version of this script is model and projects fork it, and we need to keep adjusting it downstream.

Quoted 5 lines

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

5.6 was released in 2003.

I know a person using 5.8 (cough: Andrew Morton), but 5.6 really is quite old.

It was just decided to depend on GNU Make 3.81 (released 2010).

I think 3.81 was released in 2006
and 3.82 in 2010.

Signature · 2 lines
Best Regards
Masahiro Yamada
#0 lore raw

PATCH 1/1 scripts: Switch to more portable Perl shebang

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

---
 scripts/bootgraph.pl                 | 2 +-
 scripts/checkincludes.pl             | 2 +-
 scripts/checkpatch.pl                | 3 ++-
 scripts/checkstack.pl                | 2 +-
 scripts/checkversion.pl              | 2 +-
 scripts/cleanfile                    | 3 ++-
 scripts/cleanpatch                   | 3 ++-
 scripts/dtc/dt_to_config             | 2 +-
 scripts/export_report.pl             | 3 ++-
 scripts/extract-module-sig.pl        | 3 ++-
 scripts/extract-sys-certs.pl         | 3 ++-
 scripts/extract_xc3028.pl            | 2 +-
 scripts/get_dvb_firmware             | 2 +-
 scripts/get_maintainer.pl            | 3 ++-
 scripts/headerdep.pl                 | 2 +-
 scripts/headers_check.pl             | 3 ++-
 scripts/kconfig/streamline_config.pl | 3 ++-
 scripts/kernel-doc                   | 3 ++-
 scripts/kernel-doc-xml-ref           | 3 ++-
 scripts/markup_oops.pl               | 2 +-
 scripts/namespace.pl                 | 3 ++-
 scripts/profile2linkerlist.pl        | 2 +-
 scripts/recordmcount.pl              | 3 ++-
 scripts/stackdelta                   | 2 +-
 24 files changed, 37 insertions(+), 24 deletions(-)
scripts/bootgraph.pl +1 -1
index 9ca667bcaee9..594c55541b16 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright 2008, Intel Corporation
 #
scripts/checkincludes.pl +1 -1
index 381c018a4612..ce9edefd6e0b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 # checkincludes: find/remove files included more than once
 #
scripts/checkpatch.pl +2 -1
index baa3c7be04ad..26cc462dd08e 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # (c) 2001, Dave Jones. (the file handling bit)
 # (c) 2005, Joel Schopp <[email protected]> (the ugly bit)
 # (c) 2007,2008, Andy Whitcroft <[email protected]> (new conditions, test suite)
@@ -6,6 +6,7 @@
 # Licensed under the terms of the GNU GPL License version 2
 
 use strict;
+use warnings;
 use POSIX;
 use File::Basename;
 use Cwd 'abs_path';
scripts/checkstack.pl +1 -1
index 9d37aa4faf5c..7f4c41717e26 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #	Check the stack usage of functions
 #
scripts/checkversion.pl +1 -1
index 5e490a8ceca5..8b4f205234b5 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#! /usr/bin/env perl
 #
 # checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION
 # without including <linux/version.h>, or cases of
scripts/cleanfile +2 -1
index cefd29e52298..72e3755327ae 100755
@@ -1,9 +1,10 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Clean a text file -- or directory of text files -- of stealth whitespace.
 # WARNING: this can be a highly destructive operation.  Use with caution.
 #
 
+use warnings;
 use bytes;
 use File::Basename;
 
scripts/cleanpatch +2 -1
index 9680d03ad2b8..3e5a2303dc0e 100755
@@ -1,9 +1,10 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Clean a patch file -- or directory of patch files -- of stealth whitespace.
 # WARNING: this can be a highly destructive operation.  Use with caution.
 #
 
+use warnings;
 use bytes;
 use File::Basename;
 
scripts/dtc/dt_to_config +1 -1
index 9a248b505c58..5dfd1bff351f 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright 2016 by Frank Rowand
 # Copyright 2016 by Gaurav Minocha
scripts/export_report.pl +2 -1
index 8f79b701de87..68ff426b347c 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # (C) Copyright IBM Corporation 2006.
 #	Released under GPL v2.
@@ -7,6 +7,7 @@
 # Usage: export_report.pl -k Module.symvers [-o report_file ] -f *.mod.c
 #
 
+use warnings;
 use Getopt::Std;
 use strict;
 
scripts/extract-module-sig.pl +2 -1
index faac6f2e377f..0f161ea41261 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # extract-mod-sig <part> <module-file>
 #
@@ -12,6 +12,7 @@
 #  -k: Just the key ID
 #  -s: Just the crypto signature or PKCS#7 message
 #
+use warnings;
 use strict;
 
 die "Format: $0 -[0adnks] module-file >out\n"
scripts/extract-sys-certs.pl +2 -1
index 8227ca10a494..2aa873b944e0 100755
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
+use warnings;
 use strict;
 use Math::BigInt;
 use Fcntl "SEEK_SET";
scripts/extract_xc3028.pl +1 -1
index 47877deae6d7..61d9b256c658 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright (c) Mauro Carvalho Chehab <[email protected]>
 # Released under GPLv2
scripts/get_dvb_firmware +1 -1
index 1a0a04125f71..f3f230225aba 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #     DVB firmware extractor
 #
 #     (c) 2004 Andrew de Quincey
scripts/get_maintainer.pl +2 -1
index 633f2dd3de27..3bd5f4f30235 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # (c) 2007, Joe Perches <[email protected]>
 #           created from checkpatch.pl
 #
@@ -10,6 +10,7 @@
 #
 # Licensed under the terms of the GNU GPL License version 2
 
+use warnings;
 use strict;
 
 my $P = $0;
scripts/headerdep.pl +1 -1
index 8dd019bc5a73..86ebb9ee7570 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#! /usr/bin/env perl
 #
 # Detect cycles in the header file dependency graph
 # Vegard Nossum <[email protected]>
scripts/headers_check.pl +2 -1
index 8b2da054cdc3..3091e4ee6ee1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # headers_check.pl execute a number of trivial consistency checks
 #
@@ -18,6 +18,7 @@
 #
 # 3) Check for leaked CONFIG_ symbols
 
+use warnings;
 use strict;
 use File::Basename;
 
scripts/kconfig/streamline_config.pl +2 -1
index b8c7b29affc5..a2e83ab17de3 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Copyright 2005-2009 - Steven Rostedt
 # Licensed under the terms of the GNU GPL License version 2
@@ -42,6 +42,7 @@
 #    mv config_strip .config
 #    make oldconfig
 #
+use warnings;
 use strict;
 use Getopt::Long;
 
scripts/kernel-doc +2 -1
index a26a5f2dce39..7b0a8f01fed5 100755
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 
+use warnings;
 use strict;
 
 ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved        ##
scripts/kernel-doc-xml-ref +2 -1
index 104a5a5ba2c8..e3b24bfc804c 100755
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 
+use warnings;
 use strict;
 
 ## Copyright (C) 2015  Intel Corporation                         ##
scripts/markup_oops.pl +1 -1
index c21d16328d3f..70dcfb6b3de1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use File::Basename;
 use Math::BigInt;
scripts/namespace.pl +2 -1
index 9f3c9d47a4a5..e5d5a4a34c93 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 #	namespace.pl.  Mon Aug 30 2004
 #
@@ -63,6 +63,7 @@
 #
 
 require 5;	# at least perl 5
+use warnings;
 use strict;
 use File::Find;
 
scripts/profile2linkerlist.pl +1 -1
index 6943fa7cc95b..f23d7be94394 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 # Takes a (sorted) output of readprofile and turns it into a list suitable for
scripts/recordmcount.pl +2 -1
index 1633c3e6c0b9..2033af758173 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 # (c) 2008, Steven Rostedt <[email protected]>
 # Licensed under the terms of the GNU GPL License version 2
 #
@@ -106,6 +106,7 @@
 # 9) Move the result back to the original object.
 #
 
+use warnings;
 use strict;
 
 my $P = $0;
scripts/stackdelta +1 -1
index 48eabf2f48f8..20a79f19a111 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Read two files produced by the stackusage script, and show the
 # delta between them.
Signature · 1 line
2.12.2
#6 lore raw
In reply to Masahiro Yamada
Quoted 45 lines · Masahiro Yamada

2017-05-08 5:37 GMT+09:00 Kamil Rytarowski <[email protected]>:

Quoted 44 lines · Joe Perches
Quoted 43 lines · Kamil Rytarowski
Quoted 41 lines · Joe Perches
Quoted 10 lines · Kamil Rytarowski
Quoted 9 lines

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

Quoted 5 lines
Quoted 3 lines

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.

Yes.

Quoted 1 line

Better? <shrug>

Correct.

In pkgsrc we have automatic scripts to adjust shebangs for scripting languages (Perl, Python, Bash etc). But in this case I build the Linux kernel out of the pkgsrc context on my NetBSD workstation.

Exactly the same change has been accepted in qemu, currently it's waiting to be merged with master. from the "-trival" branch.

In my case I won't be enforced to keep fixing it manually every time I sync with HEAD. Another point is that the Linux version of this script is model and projects fork it, and we need to keep adjusting it downstream.

Quoted 5 lines

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

5.6 was released in 2003.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

I know a person using 5.8 (cough: Andrew Morton), but 5.6 really is quite old.

It was just decided to depend on GNU Make 3.81 (released 2010).

I think 3.81 was released in 2006
and 3.82 in 2010.

You are right about the dates, I feel corrected.

The original sentence still stands.

I noted that "use warnings;" was already present, just in case someone would be worried about portability of it:

scripts/headerdep.pl:use warnings;

#7 lore raw

2017-05-08 10:56 GMT+09:00 Kamil Rytarowski <[email protected]>:

Quoted 52 lines · Masahiro Yamada
Quoted 51 lines

2017-05-08 5:37 GMT+09:00 Kamil Rytarowski <[email protected]>:

Quoted 49 lines · Joe Perches
Quoted 41 lines · Kamil Rytarowski
Quoted 40 lines · Joe Perches
Quoted 10 lines · Kamil Rytarowski
Quoted 9 lines

The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically.

Quoted 5 lines
Quoted 3 lines

This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior.

Functionality would then depend on user $PATH.

Yes.

Quoted 1 line

Better? <shrug>

Correct.

In pkgsrc we have automatic scripts to adjust shebangs for scripting languages (Perl, Python, Bash etc). But in this case I build the Linux kernel out of the pkgsrc context on my NetBSD workstation.

Exactly the same change has been accepted in qemu, currently it's waiting to be merged with master. from the "-trival" branch.

In my case I won't be enforced to keep fixing it manually every time I sync with HEAD. Another point is that the Linux version of this script is model and projects fork it, and we need to keep adjusting it downstream.

Quoted 5 lines

For the perl "-w", adding "use warnings;" instead of "-w" seems sensible enough. Is any build environment using a perl version below 5.6?

Quoted 5 lines
Quoted 1 line

5.6 was released in 2003.

I know a person using 5.8 (cough: Andrew Morton), but 5.6 really is quite old.

It was just decided to depend on GNU Make 3.81 (released 2010).

Quoted 8 lines
Quoted 3 lines

I think 3.81 was released in 2006
and 3.82 in 2010.

You are right about the dates, I feel corrected.

The original sentence still stands.

I just added a minor comment.

V2 applied to linux-kbuild/misc. Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada