[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64360] [PATCH] [gropdf] does not correctly handle white space afte
From: |
G. Branden Robinson |
Subject: |
[bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command |
Date: |
Wed, 28 Jun 2023 09:17:50 -0400 (EDT) |
Update of bug #64360 (project groff):
Assigned to: gbranden => deri
Summary: [gropdf] does not correctly handle white space after
'w' command => [PATCH] [gropdf] does not correctly handle white space after
'w' command
_______________________________________________________
Follow-up Comment #19:
Here's an updated version of my proposed patch for this ticket. It assumes
the one from comment #4 is already applied, and will need manual tweaking
otherwise.
diff --git a/ChangeLog b/ChangeLog
index 373fab6df..f0a12b807 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2023-06-28 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/devices/gropdf/gropdf.pl: Accept newlines after 'w'
+ commands as our libdriver-using output drivers do. ("Blanks,
+ tabs, and newlines may occur as separators in the input, and are
+ mandatory to separate constructions that would otherwise be
+ confused." --CSTR #54 (1992)) Also, when debugging, write any
+ 'w' commands encountered as comments to the output stream, as is
+ done with other commands.
+
+ Fixes <https://savannah.gnu.org/bugs/?64360>.
+
2023-06-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/devices/gropdf/gropdf.pl: Fix code style nits. Rename
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 074a725c5..e86644da5 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -369,16 +369,17 @@ while (<>)
my $cmd=substr($_,0,1);
next if $cmd eq '#'; # just a comment
my $lin=substr($_,1);
+ $lin=~s/^\s*//;
- while ($cmd eq 'w')
+ # 'w' is the only zero-argument command.
+ while ($lin and $cmd eq 'w')
{
+ $stream.="\% w\n" if $debug;
+ $w_flg=1 if $t_flg;
$cmd=substr($lin,0,1);
$lin=substr($lin,1);
- $w_flg=1 if $t_flg;
+ $lin=~s/^\s*//;
}
-
- $lin=~s/^\s+//;
-# $lin=~s/\s#.*?$//; # remove comment
$stream.="\% $_\n" if $debug;
do_x($lin),next if ($cmd eq 'x');
I'm also attaching a tar archive of test cases I used to develop and check the
logic. It's a set of 6 specimens of GNU troff output (hand-modified in 5
cases to exercise the latitude afforded by CSTR #54), and the
patched-gropdf-generated PDFs, all of which produce correct output as far as I
can tell.
Annotating with "[PATCH]". Assigning to Deri. Is this an acceptable change?
(file #54892)
_______________________________________________________
Additional Item Attachment:
File name: bug64360.tar Size:60 KB
<https://file.savannah.gnu.org/file/bug64360.tar?file_id=54892>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64360>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, (continued)
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, Deri James, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, Deri James, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, Deri James, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, Deri James, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, Dave, 2023/06/27
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/28
- [bug #64360] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/28
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command,
G. Branden Robinson <=
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command, Dave, 2023/06/28
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command, Dave, 2023/06/28
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/28
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command, Deri James, 2023/06/28
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command, Deri James, 2023/06/28
- [bug #64360] [PATCH] [gropdf] does not correctly handle white space after 'w' command, G. Branden Robinson, 2023/06/29