mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>,
	linux-kernel@vger.kernel.org, Dave Hansen <dave@sr71.net>
Subject: [PATCH] checkpatch: enforce sane perl version
Date: Mon, 29 Jul 2013 13:06:06 -0700	[thread overview]
Message-ID: <20130729200606.2651EE1E@viggo.jf.intel.com> (raw)


From: Dave Hansen <dave.hansen@linux.intel.com>

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.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

 linux.git-davehans/scripts/checkpatch.pl |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff -puN scripts/checkpatch.pl~checkpatch-enforce-perl-version scripts/checkpatch.pl
--- linux.git/scripts/checkpatch.pl~checkpatch-enforce-perl-version	2013-07-29 10:54:11.525133577 -0700
+++ linux.git-davehans/scripts/checkpatch.pl	2013-07-29 12:52:41.461121333 -0700
@@ -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);
_

             reply	other threads:[~2013-07-29 20:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 20:06 Dave Hansen [this message]
2013-07-29 20:10 ` Joe Perches
2013-07-29 22:52   ` Andrew Morton
2013-07-29 23:01     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130729200606.2651EE1E@viggo.jf.intel.com \
    --to=dave@sr71.net \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®