bugGNU roff - Bugs: bug #64469, [troff] `-o` with valid but...

 
 

bug #64469: [troff] `-o` with valid but inapplicable argument provokes incomprehensible output driver diagnostic

Submitter:  Dave <barx>
Submitted:  Mon 24 Jul 2023 10:39:19 PM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.24.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 18 Oct 2024 12:42:30 AM UTC, comment #4: 


commit 40644c648efc313eb818b89725787fe2a10ba773
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Thu Oct 17 11:11:45 2024 -0500

    [troff]: Fix Savannah #64469 (`-o` out of bounds).

    [troff]: Better handle inapplicable or out-of-bounds (but still
    numerically valid) output page selection list (`-o` argument).

    * src/roff/troff/node.cpp: New global Boolean
      `was_any_page_in_output_list` tracks this datum; defaults false.

      (troff_output_file::trailer): When finishing up, don't write a
      "trailer" grout command (and vertical motion) if no page ever began.
      Insted, throw a warning in category `range`.

      (real_output_file::begin_page): Make `was_any_page_in_output_list`
      true if any page is written.

    Fixes <https://savannah.gnu.org/bugs/?64469>.  Thanks to Dave Kemper for
    the report.

    Exhibit:

    $ echo hello | ~/groff-stable/bin/groff -o 2
    grops:<standard input>:5: fatal error: 'V' command invalid before first 'p' command
    $ echo hello | ./build/test-groff -o 2 > /dev/null
    $ echo hello | ./build/test-groff -o 2 -wrange > /dev/null
    troff: warning: no pages in output page selection list


G. Branden Robinson <gbranden>
Group administrator
Thu 17 Oct 2024 04:20:51 PM UTC, comment #3: 

This problem (1) applies generally to output drivers (try `-T ascii`, `-T dvi`, `-T lj4`, etc.) and (2) is better solved in the formatter, and with the solution I'm working on now, no change to any output driver is necessary, and all get the benefit.

G. Branden Robinson <gbranden>
Group administrator
Thu 17 Oct 2024 04:16:20 PM UTC, comment #2: 


comment #1:

> Can reproduce with groff 1.23.0 final.
>
> This might be a good time to adopt neatroff's `.%` register, which stores the page sequence number, introduce this concept to our implementation and documentation, and fasten the `-o` option to it.


This is now tracked as bug #66348.

G. Branden Robinson <gbranden>
Group administrator
Fri 04 Aug 2023 06:59:32 PM UTC, comment #1: 

Can reproduce with groff 1.23.0 final.

This might be a good time to adopt neatroff's `.%` register, which stores the page sequence number, introduce this concept to our implementation and documentation, and fasten the `-o` option to it.

G. Branden Robinson <gbranden>
Group administrator
Mon 24 Jul 2023 10:39:19 PM UTC, original submission:  


$ groff --version | head -1
GNU groff version 1.22.4
$ echo Hello. | groff -o2 | wc
    202     577    3664
$ groff-latest --version | head -1
GNU groff version 1.23.0.rc4.19-96b92-dirty
$ echo Hello. | groff-latest -o2 | wc
grops:<standard input>:5: fatal error: 'V' command invalid before first 'p' command
      0       0       0
$ echo Hello. | groff-latest -o1 | wc
    267     820    6662

This post-rc4 build is not quite the same as the released groff 1.23, but by this point I believe there were no further code changes before the release, so I suspect (but have not built 1.23 to confirm) that this bug is in the release.

In the -o2 case, the user is asking for a page that doesn't exist, so an error is not unwarranted.  But the error generated gives little clue what the problem is.  Groff 1.22.4 produced no error here, emitting a PostScript document with no pages--which may not be the ideal outcome either but I think is slightly better than the incomprehensible diagnostic, and is arguably giving the user precisely what they asked for.

Someone testing rc3 came across similar error message (http://lists.gnu.org/r/groff/2023-02/msg00133.html).  This turned out to be contingent on a specific setting of the $GROFF_ENCODING environment variable.  My environment does not have this variable (nor any other GROFF environment variable) set.

(Found this issue while poking into http://lists.gnu.org/r/bug-groff/2023-07/msg00144.html)

Dave <barx>
Group Member

 

(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 barx (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-10-18 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.24.0
    2024-10-17 gbranden CategoryDriver grops Core
        StatusConfirmed In Progress
        Assigned toNone gbranden
        Summary[grops] -o with out-of-range number produces incomprehensible error [troff] `-o` with valid but inapplicable argument provokes incomprehensible output driver diagnostic
    2023-08-04 gbranden Summary-o with out-of-range number produces incomprehensible error [grops] -o with out-of-range number produces incomprehensible error
    2023-08-04 gbranden StatusNone Confirmed

    Back to the top

    Powered by Savane 3.14-04e1.
    Corresponding source code