Excessive self-grepping causes bugginess. Don't!

This regex almost certainly didn't intend to match an occurrence
of "ARRAY" in PkgLint::Line, but it did match.
This commit is contained in:
schmonz 2013-03-26 15:11:20 +00:00
parent 8d80249ed9
commit 5bc6512909
2 changed files with 4 additions and 7 deletions

View file

@ -1,5 +1,5 @@
#! @PERL@
# $NetBSD: pkglint.pl,v 1.853 2013/03/26 15:10:57 schmonz Exp $
# $NetBSD: pkglint.pl,v 1.854 2013/03/26 15:11:20 schmonz Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@ -649,10 +649,7 @@ sub get_vartypes_basictypes() {
my $types = {};
assert($lines, "Couldn't load pkglint.pl from $program");
foreach my $line (@$lines) {
if ($line->text =~ m"^\s+\} elsif \(\$type eq \"(\w+)\"\) \{$") {
# still finds "ARRAY" -- probably unintentional!
$types->{$1} = 1;
} elsif ($line->text =~ m"^\s+(\w+) => sub \{$") {
if ($line->text =~ m"^\s+(\w+) => sub \{$") {
# XXX lookup in %type_dispatch instead
$types->{$1} = 1;
}

View file

@ -1,5 +1,5 @@
#! @PERL@
# $NetBSD: pkglint.t,v 1.7 2013/03/26 15:10:32 schmonz Exp $
# $NetBSD: pkglint.t,v 1.8 2013/03/26 15:11:20 schmonz Exp $
#
require 'pkglint.pl'; # so we can test its internals
@ -71,7 +71,7 @@ sub test_get_vartypes_basictypes {
my %types = %{$results[0]};
my @all_vartypes_basictypes = qw(
ARRAY AwkCommand BrokenIn
AwkCommand BrokenIn
BuildlinkDepmethod BuildlinkDepth BuildlinkPackages
CFlag Category Comment
Dependency DependencyWithPath