bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #64360] [gropdf] does not correctly handle white space after 'w' co


From: G. Branden Robinson
Subject: [bug #64360] [gropdf] does not correctly handle white space after 'w' command
Date: Tue, 27 Jun 2023 11:26:04 -0400 (EDT)

Update of bug #64360 (project groff):

                  Status:                    None => Need Info              
             Assigned to:                    None => deri                   

    _______________________________________________________

Follow-up Comment #1:

I propose the following patch.


diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index c65a1051f..6ed7e4e57 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -370,14 +370,17 @@ while (<>)
        next if $cmd eq '#';    # just a comment
        my $lin=substr($_,1);
 
-       while ($cmd eq 'w')
+       if ($lin)
        {
-           $cmd=substr($lin,0,1);
-           $lin=substr($lin,1);
-           $w_flg=1 if $gotT;
-       }
+           while ($cmd eq 'w')
+           {
+               $cmd=substr($lin,0,1);
+               $lin=substr($lin,1);
+               $w_flg=1 if $gotT;
+           }
 
        $lin=~s/^\s+//;
+       }
 #              $lin=~s/\s#.*?$//;      # remove comment
        $stream.="\% $_\n" if $debug;


On my private branch, with the change to 'w' output, 4 automated tests fail
and _gropdf_ (Perl, really) screams thousands of lines of error output while
constructing groff-man-pages.pdf.

With this patch, all 180 tests pass (or XFAIL) and no extra error output is
produced.

But it may not be the most elegant fix, as I have only a worm's-eye view of
_gropdf_'s parser.

Assigning to Deri and putting into "Need info" status for feedback.

Is this patch okay or does it have problems?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64360>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]