bugGNU roff - Bugs: bug #65097, gropdf: one 'ps:' tag is now not...

 
 

bug #65097: gropdf: one 'ps:' tag is now not processed

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Sat 30 Dec 2023 07:20:51 PM UTC
   
 
Category:  Driver gropdf Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Invalid
Privacy:  Public Assigned to:  deri
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 11 Jan 2024 06:06:12 PM UTC, comment #5: 

  I have added this to my version of "gropdf":

            elsif ($par=~m/exec decornone/)
            {
#               skip processing
            }
            elsif ($par=~m/exec 0 setlinejoin/)
            {
#               skip processing, already processed earlier
            }
            elsif ($par=~m/def grops begin/)
            {
#               skip processing
            }

Bjarni Ingi Gislason <bjarniig>
Thu 11 Jan 2024 03:25:36 PM UTC, comment #4: 

Yes. Bjarni's else clause does not catch valid errors, not all ps: tags can be processed into valid pdf. I support the ones emitted by our pre-processors and macros (apart from the postscript underline function from mom).

Deri James <deri>
Group Member
Thu 11 Jan 2024 10:57:36 AM UTC, comment #3: 

Deri, is this ticket invalid?

G. Branden Robinson <gbranden>
Group administrator
Sat 30 Dec 2023 11:15:37 PM UTC, comment #2: 

comment #1:

> If I look at the output produced by:-
>
> pdfmom ../doc/automake.mom -P-d | less
>
> I can see:-


> % x X ps: exec 0 setlinejoin
> %% V12000
> 0 j
> % V12000
> % H72000
> % x X ps: exec 0 setlinecap
> %% wh2500
> 0 J


Deri has stated a few times that he does his testing only on the
deri-gropdf-ng branch, so I thought I'd add that I see exactly the same
output above on the master branch.

Regards,
Branden

G. Branden Robinson <gbranden>
Group administrator
Sat 30 Dec 2023 10:40:38 PM UTC, comment #1: 

If I look at the output produced by:-

pdfmom ../doc/automake.mom -P-d | less

I can see:-

% x X ps: exec 0 setlinejoin
%% V12000
0 j
% V12000
% H72000
% x X ps: exec 0 setlinecap
%% wh2500
0 J

So the "0 j" has been emitted in response to the 0 setlinejoin, and "0 J" for the 0 setlinecap. So the code is working as expected. Before the last change to accomodate both on the same command the code was essentially one switch statement dealing with all the \X'ps: ...' commands which gropdf is designed to handle, documented in gropdf.1. Since the change, it is now two switch statements, an else clause at the end of the second switch will fire even if the command was handled as part of the first switch.

Even without the split into two switches, an else clause to trap unhandled \X'ps: ...' commands is futile because the grops man page documenting the device control commands would allow complete postscript programs to be passed to the printer, which a pdf file would not understand.

An example is this (which mom passes as a \Y'ps: ...' command):-

% x X ps: def
%% +grops begin
%% +/decornone { grops begin /X { } def /Y { } def /y2 -1 def end } def
%% +/decorline { grops begin u neg /uld exch def u /ulw exch def
%% +             /X { currentpoint /y0 exch def /x0 exch def } def
%% +             /Y { currentpoint /y1 exch def /x1 exch def
%% +                  drawline /x2 x1 def /y2 y1 def } def end } def
%% +/drawline { gsave ulw setlinewidth 0 setlinecap x1 y1 uld sub moveto
%% +            y2 y0 eq { x2 y2 } { x0 y0 } ifelse uld sub lineto stroke
%% +            grestore } def
%% +decornone
%% +/uld 0 def
%% +/ulw 0 def
%% +/A { X show Y } def
%% +/B { 0 SC 3 -1 roll X widthshow Y } def
%% +/C { 0 exch X ashow Y } def
%% +/D { 0 exch 0 SC 5 2 roll X awidthshow Y } def
%% +/E { 0 rmoveto X show Y } def
%% +/F { 0 rmoveto 0 SC 3 -1 roll X widthshow Y } def
%% +/G { 0 rmoveto 0 exch X ashow Y } def
%% +/H { 0 rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
%% +/I { 0 exch rmoveto X show Y } def
%% +/J { 0 exch rmoveto 0 SC 3 -1 roll X widthshow Y } def
%% +/K { 0 exch rmoveto 0 exch X ashow Y } def
%% +/L { 0 exch rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
%% +/M { rmoveto X show Y } def
%% +/N { rmoveto 0 SC 3 -1 roll X widthshow Y } def
%% +/O { rmoveto 0 exch X ashow Y } def
%% +/P { rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
%% +/Q { moveto X show Y } def
%% +/R { moveto 0 SC 3 -1 roll X widthshow Y } def
%% +/S { moveto 0 exch X ashow Y } def
%% +/T { moveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
%% +end
%% +

This is pure postscript code which is not part of the pdf standard, so all gropdf can do is consume it, on the assumption it will mean something if the same document is run through grops.

Deri James <deri>
Group Member
Sat 30 Dec 2023 07:20:51 PM UTC, original submission:  

Subject: gropdf: one 'ps:' tag is now not processed

Examples of an unprocessed ps-tag (shown by an additional "else"
clause in "gropdf.pl at the end of "ifelse" clauses.

  GROFF    doc/automake.pdf
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 15.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 91.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 185.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 1032.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 2209.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 3356.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 4420.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 5237.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 6690.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 7847.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 8831.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 9517.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 9940.
\X'ps: exec 0 setlinejoin' was not processed at
/home/bg/git/groff/build/gropdf line 1121, <> line 9953.

  This does not fit in with the recently changed test

-           elsif ($par=~m/exec (\d) setlinejoin/)
+           elsif ($par=~m/exec.*? (\d) setlinejoin/)
 

Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by deri (Posted a comment)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-11 deri StatusNeed Info Invalid
        Open/ClosedOpen Closed
    2024-01-11 gbranden StatusNone Need Info
    2023-12-31 gbranden Assigned toNone deri

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code