From a1f6f9e389615bd967a13fbffc1b414707212e45 Mon Sep 17 00:00:00 2001 From: rillig Date: Thu, 2 Mar 2006 13:23:28 +0000 Subject: - 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. --- pkgtools/pkglint/files/pkglint.pl | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'pkgtools') 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."); -- cgit v1.2.3