Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

export_report: do collectcfiles work in perl itself

Avoid spawning a shell pipeline doing cat, grep, sed, and do it all
inside perl. The <*.c> globbing construct works at least as far back
as 5.8.9

Note that this is not just an optimization; the sed command
in the pipeline was unterminated, due to lack of escape on the
end-of-line (\$) in the regex, resulting in this:

$ perl ../linux-2.6/scripts/export_report.pl > /dev/null
sed: -e expression #1, char 5: unterminated `s' command
sh: .mod.c/: not found

Comments on an earlier patch sought an all-perl implementation.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
cc: Michal Marek <mmarek@suse.cz>,
cc: linux-kbuild@vger.kernel.org
cc: Arnaud Lacombe lacombar@gmail.com
cc: Stephen Hemminger shemminger@vyatta.com
Signed-off-by: Michal Marek <mmarek@suse.cz>

authored by

Jim Cromie and committed by
Michal Marek
de7b0b41 2ee2d292

+8 -2
+8 -2
scripts/export_report.pl
··· 49 49 } 50 50 51 51 sub collectcfiles { 52 - my @file 53 - = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; 52 + my @file; 53 + while (<.tmp_versions/*.mod>) { 54 + open my $fh, '<', $_ or die "cannot open $_: $!\n"; 55 + push (@file, 56 + grep s/\.ko/.mod.c/, # change the suffix 57 + grep m/.+\.ko/, # find the .ko path 58 + <$fh>); # lines in opened file 59 + } 54 60 chomp @file; 55 61 return @file; 56 62 }