Message ID | 20171002152552.27999-3-armbru@redhat.com |
---|---|
State | New |
Headers | show |
Series | Command line QAPIfication | expand |
On 10/02/2017 10:25 AM, Markus Armbruster wrote: > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > scripts/texi2pod.pl | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) My perl is a bit rusty, but I think I can handle this one. > > diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl > index 39ce584a32..2171f8b819 100755 > --- a/scripts/texi2pod.pl > +++ b/scripts/texi2pod.pl > @@ -85,6 +85,13 @@ if (defined $out) { > > while(defined $inf) { > while(<$inf>) { > + # Verbatim environment > + if (defined $endw and $endw eq "verbatim" > + and not (/^\@end\s+([a-z]+)/ and $1 eq $endw)) { You anchored to the beginning, but not the end, of the line; that means you accept '@end verbatim garbage' as an end marker. Worth adding $? If that's the only change, I'm okay with adding: Reviewed-by: Eric Blake <eblake@redhat.com>
Eric Blake <eblake@redhat.com> writes: > On 10/02/2017 10:25 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> scripts/texi2pod.pl | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) > > My perl is a bit rusty, but I think I can handle this one. > >> >> diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl >> index 39ce584a32..2171f8b819 100755 >> --- a/scripts/texi2pod.pl >> +++ b/scripts/texi2pod.pl >> @@ -85,6 +85,13 @@ if (defined $out) { >> >> while(defined $inf) { >> while(<$inf>) { >> + # Verbatim environment >> + if (defined $endw and $endw eq "verbatim" >> + and not (/^\@end\s+([a-z]+)/ and $1 eq $endw)) { > > You anchored to the beginning, but not the end, of the line; that means > you accept '@end verbatim garbage' as an end marker. Worth adding $? Cribbed from # End-block handler goes up here because it needs to operate even # if we are skipping. /^\@end\s+([a-z]+)/ and do { # Ignore @end foo, where foo is not an operation which may # cause us to skip, if we are presently skipping. my $ended = $1; next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|copying)$/; die "\@end $ended without \@$ended at line $.\n" unless defined $endw; die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; $endw = pop @endwstack; I'd prefer to stick to this regexp. texi2pod.pl parses quite sloppily in general. > If that's the only change, I'm okay with adding: > > Reviewed-by: Eric Blake <eblake@redhat.com> Does this apply to the unchanged patch, too?
On 10/06/2017 12:24 AM, Markus Armbruster wrote: > Eric Blake <eblake@redhat.com> writes: > >> On 10/02/2017 10:25 AM, Markus Armbruster wrote: >>> Signed-off-by: Markus Armbruster <armbru@redhat.com> >>> --- >>> scripts/texi2pod.pl | 11 +++++++++-- >>> 1 file changed, 9 insertions(+), 2 deletions(-) >> >>> + and not (/^\@end\s+([a-z]+)/ and $1 eq $endw)) { >> >> You anchored to the beginning, but not the end, of the line; that means >> you accept '@end verbatim garbage' as an end marker. Worth adding $? > > Cribbed from > > # End-block handler goes up here because it needs to operate even > # if we are skipping. > /^\@end\s+([a-z]+)/ and do { > # Ignore @end foo, where foo is not an operation which may > # cause us to skip, if we are presently skipping. > my $ended = $1; > next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|copying)$/; > > die "\@end $ended without \@$ended at line $.\n" unless defined $endw; > die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; > > $endw = pop @endwstack; > > I'd prefer to stick to this regexp. Consistency makes sense. > > texi2pod.pl parses quite sloppily in general. > >> If that's the only change, I'm okay with adding: >> >> Reviewed-by: Eric Blake <eblake@redhat.com> > > Does this apply to the unchanged patch, too? Yes.
diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl index 39ce584a32..2171f8b819 100755 --- a/scripts/texi2pod.pl +++ b/scripts/texi2pod.pl @@ -85,6 +85,13 @@ if (defined $out) { while(defined $inf) { while(<$inf>) { + # Verbatim environment + if (defined $endw and $endw eq "verbatim" + and not (/^\@end\s+([a-z]+)/ and $1 eq $endw)) { + $section .= "\t".$_; + next; + } + # Certain commands are discarded without further processing. /^\@(?: [a-z]+index # @*index: useful only in complete manual @@ -165,7 +172,7 @@ while(<$inf>) { if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { $skipping = pop @skstack; next; - } elsif ($ended =~ /^(?:example|smallexample|display + } elsif ($ended =~ /^(?:example|smallexample|display|verbatim |quotation|deftp|deftypefn)$/x) { $shift = ""; $_ = ""; # need a paragraph break @@ -311,7 +318,7 @@ while(<$inf>) { $_ = "\n=over 4\n"; }; - /^\@((?:small)?example|display)/ and do { + /^\@((?:small)?example|display|verbatim)/ and do { push @endwstack, $endw; $endw = $1; $shift = "\t";
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- scripts/texi2pod.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)