diff options
author | rillig <rillig@pkgsrc.org> | 2006-03-02 13:23:28 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2006-03-02 13:23:28 +0000 |
commit | f148735d7cd5c83fd92e893522ec62360fe6f600 (patch) | |
tree | a6827f291ddc94ffcfacd2218960f8caa3833654 /pkgtools | |
parent | ecf6e1d01936aa74735403231a313ad4d13e0e39 (diff) | |
download | pkgsrc-f148735d7cd5c83fd92e893522ec62360fe6f600.tar.gz |
- Make sure that at the end of a patch file, the state of the parser is
PST_TEXT. Otherwise the last hunk may not be checked completely.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index b155a4fd71f..d5a26d6d209 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.541 2006/03/02 13:08:37 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.542 2006/03/02 13:23:28 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -4539,6 +4539,34 @@ sub checkfile_patch($) { } } + while ($state != PST_TEXT) { + $opt_debug and log_debug($fname, "EOF", "[${state} ${patched_files}/".($hunks||0)."/-".($dellines||0)."+".($addlines||0)."]"); + + my $found = false; + foreach my $t (@{$transitions}) { + if ($state == $t->[0] && !defined($t->[1])) { + my $newstate; + + $m = undef; + $redostate = undef; + $nextstate = $t->[2]; + $t->[3]->(); + $newstate = (defined($redostate)) ? $redostate : $nextstate; + if ($newstate == $state) { + log_fatal($fname, "EOF", "Internal error in the patch transition table."); + } + $state = $newstate; + $found = true; + last; + } + } + + if (!$found) { + log_error($fname, "EOF", "Parse error: state=${state}"); + $state = PST_TEXT; + } + } + if ($patched_files > 1) { log_warning($fname, NO_LINE_NUMBER, "Contains patches for $patched_files files, should be only one."); |