Skip to contentSkip to conversation

checkpatch: enforce sane perl version

PATCH In review Dave Hansen 3 participants 4 messages Jul 29, 2013 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: enforce sane perl version

From: Dave Hansen <[email protected]>

I got a bug report from a couple of users who said checkpatch.pl was broken for them. It was erroring out on fairly random lines most commonly with messages like:

	Nested quantifiers in regex; marked by <--HERE in m/(\((?:[^\(\)]++ <-- HERE |(?-1))*\))/ at ./checkpatch.pl line 340.

The bug reporter was running a version of perl 5.8 which was end-of-lifed in 2008: http://www.cpan.org/src/. Versions of perl this old are at _best_ quite untested. At worst, they are crusty and known to be completely broken.

If folks have a system _that_ old, then we should have mercy on them and give them a half-decent error message rather than fail with nutty error messages.

This patch enforces that checkpatch.pl is run with perl 5.10, which was end-of-lifed in 2009. The new --ignore-perl-version command-line switch will let folks override this if they want.

---

 linux.git-davehans/scripts/checkpatch.pl |   12 ++++++++++++
 1 file changed, 12 insertions(+)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-enforce-perl-version +12 -0
diff -puN scripts/checkpatch.pl~checkpatch-enforce-perl-version scripts/checkpatch.pl
@@ -37,6 +37,8 @@ my @ignore = ();
 my $help = 0;
 my $configuration_file = ".checkpatch.conf";
 my $max_line_length = 80;
+my $ignore_perl_version = 0;
+my $minimum_perl_version = 5.10.0;
 
 sub help {
 	my ($exitcode) = @_;
@@ -71,6 +73,8 @@ Options:
                              "<inputfile>.EXPERIMENTAL-checkpatch-fixes"
                              with potential errors corrected to the preferred
                              checkpatch style
+  --ignore-perl-version      override checking of perl version.  expect
+                             runtime errors.
   -h, --help, --version      display this help and exit
 
 When FILE is - read standard input.
@@ -123,6 +127,7 @@ GetOptions(
 	'mailback!'	=> \$mailback,
 	'summary-file!'	=> \$summary_file,
 	'fix!'		=> \$fix,
+	'ignore-perl-version!' => \$ignore_perl_version,
 	'debug=s'	=> \%debug,
 	'test-only=s'	=> \$tst_only,
 	'h|help'	=> \$help,
@@ -133,6 +138,13 @@ help(0) if ($help);
 
 my $exit = 0;
 
+if ($^V && $^V lt $minimum_perl_version) {
+	printf "$P: requires at least perl version %vd\n", $minimum_perl_version;
+	if (!$ignore_perl_version) {
+		exit(1);
+	}
+}
+
 if ($#ARGV < 0) {
 	print "$P: no input files\n";
 	exit(1);

_

maintainer
#1 lore raw
Quoted 17 lines · Dave Hansen

From: Dave Hansen <[email protected]>

I got a bug report from a couple of users who said checkpatch.pl was broken for them. It was erroring out on fairly random lines most commonly with messages like:

	Nested quantifiers in regex; marked by <--HERE in m/(\((?:[^\(\)]++ <-- HERE |(?-1))*\))/ at ./checkpatch.pl line 340.

The bug reporter was running a version of perl 5.8 which was end-of-lifed in 2008: http://www.cpan.org/src/. Versions of perl this old are at _best_ quite untested. At worst, they are crusty and known to be completely broken.

If folks have a system _that_ old, then we should have mercy on them and give them a half-decent error message rather than fail with nutty error messages.

Quoted 5 lines

This patch enforces that checkpatch.pl is run with perl 5.10, which was end-of-lifed in 2009. The new --ignore-perl-version command-line switch will let folks override this if they want.

Other than Andrew Morton's (continuing?) use of perl 5.8 I'm fine with this.

Andrew? Time to update your perl version?

#2 lore raw
Quoted 22 lines · On Mon, 29 Jul 2013 13:10:13 -0700 Joe Perches <[email protected]> wrote:
Quoted 21 lines · Dave Hansen

From: Dave Hansen <[email protected]>

I got a bug report from a couple of users who said checkpatch.pl was broken for them. It was erroring out on fairly random lines most commonly with messages like:

	Nested quantifiers in regex; marked by <--HERE in m/(\((?:[^\(\)]++ <-- HERE |(?-1))*\))/ at ./checkpatch.pl line 340.

The bug reporter was running a version of perl 5.8 which was end-of-lifed in 2008: http://www.cpan.org/src/. Versions of perl this old are at _best_ quite untested. At worst, they are crusty and known to be completely broken.

If folks have a system _that_ old, then we should have mercy on them and give them a half-decent error message rather than fail with nutty error messages.

This patch enforces that checkpatch.pl is run with perl 5.10, which was end-of-lifed in 2009. The new --ignore-perl-version command-line switch will let folks override this if they want.

Quoted 6 lines
Quoted 1 line

Other than Andrew Morton's (continuing?) use of perl 5.8 I'm fine with this.

Andrew? Time to update your perl version?

I run an FC6 test box just to irritate you guys.

maintainer
#3 lore raw
Quoted 11 lines · Andrew Morton
Quoted 10 lines · On Mon, 29 Jul 2013 13:10:13 -0700 Joe Perches <[email protected]> wrote:
Quoted 9 lines · Dave Hansen

From: Dave Hansen <[email protected]>
I got a bug report from a couple of users who said checkpatch.pl was broken for them. It was erroring out on fairly random lines most commonly with messages like:

	Nested quantifiers in regex; marked by <--HERE in m/(\((?:[^\(\)]++ <-- HERE |(?-1))*\))/ at ./checkpatch.pl line 340.

The bug reporter was running a version of perl 5.8 which was end-of-lifed in 2008

[]

Quoted 6 lines
Quoted 4 lines

Other than Andrew Morton's (continuing?) use of perl 5.8 I'm fine with this.

Andrew? Time to update your perl version?

I run an FC6 test box just to irritate you guys.

;)

yabut do you (have to) use checkpatch on that
creakingly old test box?

Maybe I can find a box with slackware 2.0 for you. It had perl 5.0.0.