2008-10-17 04:01:17

by Jeremy Huntwork

[permalink] [raw]
Subject: headers_install broken on early versions of perl

Hello,

This may not be a very large concern, but the new headers_install.pl
and headers_check.pl scripts do not work with versions of Perl <
5.6.0. This is largely to do with syntax changes in that version.
Previously, open() only allowed two arguments. The following patch
(against 2.6.27.1) alters the syntax to be backwards compatible with
earlier versions. It has been tested on 5.005_03, and 5.8.8.

Please CC me on any comments as I am not subscribed to this list.

Thanks,

Jeremy Huntwork


diff -Naur linux-2.6.27.1.orig/scripts/headers_check.pl linux-2.6.27.1/
scripts/headers_check.pl
--- linux-2.6.27.1.orig/scripts/headers_check.pl Wed Oct 15
19:02:53 2008
+++ linux-2.6.27.1/scripts/headers_check.pl Thu Oct 16 19:10:37 2008
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
#
# headers_check.pl execute a number of trivial consistency checks
#
@@ -17,7 +17,6 @@
# 2) TODO: check for leaked CONFIG_ symbols

use strict;
-use warnings;

my ($dir, $arch, @files) = @ARGV;

@@ -27,14 +26,15 @@
my $filename;

foreach my $file (@files) {
+ local *FH;
$filename = $file;
- open(my $fh, '<', "$filename") or die "$filename: $!\n";
+ open(FH, "<$filename") or die "$filename: $!\n";
$lineno = 0;
- while ($line = <$fh>) {
+ while ($line = <FH>) {
$lineno++;
check_include();
}
- close $fh;
+ close FH;
}
exit $ret;

diff -Naur linux-2.6.27.1.orig/scripts/headers_install.pl
linux-2.6.27.1/scripts/headers_install.pl
--- linux-2.6.27.1.orig/scripts/headers_install.pl Wed Oct 15
19:02:53 2008
+++ linux-2.6.27.1/scripts/headers_install.pl Thu Oct 16 19:10:48 2008
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
#
# headers_install prepare the listed header files for use in
# user space and copy the files to their destination.
@@ -17,28 +17,29 @@
# 3) Drop all sections defined out by __KERNEL__ (using unifdef)

use strict;
-use warnings;

my ($readdir, $installdir, $arch, @files) = @ARGV;

my $unifdef = "scripts/unifdef -U__KERNEL__";

foreach my $file (@files) {
+ local *INFILE;
+ local *OUTFILE;
my $tmpfile = "$installdir/$file.tmp";
- open(my $infile, '<', "$readdir/$file")
+ open(INFILE, "<$readdir/$file")
or die "$readdir/$file: $!\n";
- open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
- while (my $line = <$infile>) {
+ open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
+ while (my $line = <INFILE>) {
$line =~ s/([\s(])__user\s/$1/g;
$line =~ s/([\s(])__force\s/$1/g;
$line =~ s/([\s(])__iomem\s/$1/g;
$line =~ s/\s__attribute_const__\s/ /g;
$line =~ s/\s__attribute_const__$//g;
$line =~ s/^#include <linux\/compiler.h>//;
- printf $outfile "%s", $line;
+ printf OUTFILE "%s", $line;
}
- close $outfile;
- close $infile;
+ close OUTFILE;
+ close INFILE;
system $unifdef . " $tmpfile > $installdir/$file";
unlink $tmpfile;
}


2008-10-17 04:15:00

by Alexander E. Patrakov

[permalink] [raw]
Subject: Re: headers_install broken on early versions of perl

Jeremy Huntwork wrote:
> Hello,
>
> This may not be a very large concern, but the new headers_install.pl and
> headers_check.pl scripts do not work with versions of Perl < 5.6.0. This
> is largely to do with syntax changes in that version. Previously, open()
> only allowed two arguments. The following patch (against 2.6.27.1)
> alters the syntax to be backwards compatible with earlier versions. It
> has been tested on 5.005_03, and 5.8.8.
>
> Please CC me on any comments as I am not subscribed to this list.
>
> Thanks,
>
> Jeremy Huntwork
>
>
> diff -Naur linux-2.6.27.1.orig/scripts/headers_check.pl
> linux-2.6.27.1/scripts/headers_check.pl
> --- linux-2.6.27.1.orig/scripts/headers_check.pl Wed Oct 15
> 19:02:53 2008
> +++ linux-2.6.27.1/scripts/headers_check.pl Thu Oct 16 19:10:37 2008

There is no Signed-off-by: header in your mail, this is a formal reason
for rejection. Please read Documentation/SubmittingPatches and retry.

--
Alexander E. Patrakov