bugGNU roff - Bugs: bug #65138, [troff] `device` request silently...

 
 

bug #65138: [troff] `device` request silently fails before first page begins

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Mon 08 Jan 2024 10:37:59 AM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Documentation Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.24.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 11 Jan 2024 05:02:04 AM UTC, comment #3: 

Argh, I screwed up the bug number in the commit message AND ChangeLog.


commit c8935f2361b44414be83a34f5e7e4b2ad57cd8b2
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Mon Jan 8 19:02:34 2024 -0600

    [docs]: Fix Savannah #65118 (`device` behavior).

    * doc/groff.texi (Postprocessor Access):
    * man/groff_diff.7.man (New requests): Clarify a point of `device`
      request behavior; a partially collected line in the top-level
      diversion must exist at least once.

    Fixes <https://savannah.gnu.org/bugs/?65118>.


G. Branden Robinson <gbranden>
Group administrator
Tue 09 Jan 2024 12:33:01 AM UTC, comment #2: 

Trying again with the verbatim bit.


$ cat EXPERIMENTS/device-control-request-and-nothing-else.roff
.device ps: nop
$ groff -ww -Z EXPERIMENTS/device-control-request-and-nothing-else.roff
x T ps
x res 72000 1 1
x init
p1
x trailer
V792000
x stop
$ cat EXPERIMENTS/device-control-request-and-partially-collected-line.roff
.device ps: nop
.br
$ groff -ww -Z EXPERIMENTS/device-control-request-and-partially-collected-line.roff
x T ps
x res 72000 1 1
x init
p1
V12000
H72000
x font 5 TR
f5
s10000
V12000
H72000
md
DFd
x X ps: nop
n12000 0
x trailer
V792000
x stop


G. Branden Robinson <gbranden>
Group administrator
Tue 09 Jan 2024 12:32:26 AM UTC, comment #1: 

A partially collected line needs to exist at least once.  If it does, you can issue a `device` request as early as you want.

So I am re-conceiving this as a documentation issue.

Exhibits:
$ cat EXPERIMENTS/device-control-request-and-nothing-else.roff
.device ps: nop
$ groff -ww -Z EXPERIMENTS/device-control-request-and-nothing-else.roff
x T ps
x res 72000 1 1
x init
p1
x trailer
V792000
x stop
$ cat EXPERIMENTS/device-control-request-and-partially-collected-line.roff
.device ps: nop
.br
$ groff -ww -Z EXPERIMENTS/device-control-request-and-partially-collected-line.roff
x T ps
x res 72000 1 1
x init
p1
V12000
H72000
x font 5 TR
f5
s10000
V12000
H72000
md
DFd
x X ps: nop
n12000 0
x trailer
V792000
x stop
-verbatim-

G. Branden Robinson <gbranden>
Group administrator
Mon 08 Jan 2024 10:37:59 AM UTC, original submission:  

Affects groff 1.22.4.


$ /usr/bin/groff --version | head -n 1
GNU groff version 1.22.4
$ printf '.device pdf: foobar\n' | /usr/bin/groff -ww -Z
x T ps
x res 72000 1 1
x init
p1
x trailer
V792000
x stop


Situations like this seem to be handled in div.cpp with a fairly casually worded fatal error message.


$ git grep -C1 sorry src/roff/troff/div.cpp
src/roff/troff/div.cpp-  if (before_first_page && begin_page())
src/roff/troff/div.cpp:    fatal("sorry, I didn't manage to begin the first page in time: use an explicit .br request");
src/roff/troff/div.cpp-  vertical_size v(vs, post_vs);
--
src/roff/troff/div.cpp-    // This can only happen with the .output request.
src/roff/troff/div.cpp:    fatal("sorry, I didn't manage to begin the first page in time: use an explicit .br request");
src/roff/troff/div.cpp-  const char *s = asciify(c);
--
src/roff/troff/div.cpp-  if (before_first_page && begin_page())
src/roff/troff/div.cpp:    fatal("sorry, I didn't manage to begin the first page in time: use an explicit .br request");
src/roff/troff/div.cpp-  the_output->copy_file(page_offset, vertical_position, filename);


But it gives the user sound advice.


$ printf '.br\n.device pdf: foobar\n' | /usr/bin/groff -ww -Z
x T ps
x res 72000 1 1
x init
p1
V12000
H72000
x font 5 TR
f5
s10000
V12000
H72000
md
DFd
x X pdf: foobar
n12000 0
x trailer
V792000
x stop


I bet myself that `fl` would work, too, and I won!


$ printf '.fl\n.device pdf: foobar\n' | /usr/bin/groff -ww -Z
x T ps
x res 72000 1 1
x init
p1
V12000
H72000
x font 5 TR
f5
s10000
V12000
H72000
md
DFd
x X pdf: foobar
n12000 0
x trailer
V792000
x stop


G. Branden Robinson <gbranden>
Group administrator

 

(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 (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 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.24.0
    2024-01-09 gbranden Item GroupWarning/Suspicious behaviour Documentation

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code