bugGNU roff - Bugs: bug #64957, [troff] commit 429723c3ec broke...

 
 

bug #64957: [troff] commit 429723c3ec broke `device` and `output` requests, and `pdfbackground`

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Fri 01 Dec 2023 07:44:09 PM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Incorrect 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 01 Dec 2023 09:07:29 PM UTC, comment #1: 


commit 0b403f7971e7b7965f7853b05dec3ce1128f943e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Fri Dec 1 13:57:47 2023 -0600

    [troff]: Fix Savannah #64957 (`device`, `output`).

    ...requests were broken.

    The GNU troff(1) internal function `has_arg()` has a side effect of
    advancing the token pointer (a sort of cursor into the input stream).
    So when I changed `device_request()` and `output_request()` to use
    `has_arg()` in commit 429723c3ec (10 November), the first character of
    the argument got stripped, making it unintelligible to the output
    driver.

    * src/roff/troff/input.cpp (device_request, output_request): Drop call
      of `has_arg()` in favor of `input_stack::peek()`.  Manually discard
      space characters until reaching something else; if that is a newline
      or EOF, bail out of request processing.  Otherwise, proceed with
      warning diagnostic as before.


G. Branden Robinson <gbranden>
Group administrator
Fri 01 Dec 2023 07:44:09 PM UTC, original submission:  

This problem arose on 10 November, but took a little while to notice.

The GNU troff(1) internal function `has_arg()` has a side effect of advancing the token pointer (a sort of cursor into the input stream).  So when I changed `device_request()` and `output_request()` to use `has_arg()`, the first character of the argument got stripped, making it unintelligible to the output driver (gropdf(1)).

In other words,


.device pdf: niftyfeature arg1 arg2 arg3


became this.


.device df: niftyfeature arg1 arg2 arg3


The visible effect of this is that the background colors and box borders in msboxes.pdf went missing.

Nothing else broke (as far as I can tell) because (A) pretty much no part of groff appears to use the `output` request and (B) in most places where device control commands are issued, it is done with `\X` escape sequences which are not effected.

This isn't a problem with most other users of `has_arg()` because they proceed to use the token pointer.  But these functions don't, because they gather input with `get_copy()` instead.

I have a patch in preparation.

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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-01 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.24.0

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code