bugGNU roff - Bugs: bug #64071, [troff] support construction of...


bug #64071: [troff] support construction of proper C strings for request arguments destined for the shell or file system

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Wed 19 Apr 2023 10:01:11 PM UTC
Category:  Core Severity:  3 - Normal
Item Group:  Feature change Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sat 13 Jan 2024 03:38:28 PM UTC, comment #1: 

I'm thinking the way to do this is:

1.  Add a function much like input.cpp's `encode_char_for_troff_output()` (as it is named in a pending push), `encode_char_for_system_output()`.

2.  Have this function encode output much as the foregoing does.  The seven ASCII specials get translated to ASCII.

3.  Translate Unicode escape sequences of the form `\[u00xx]` as C string literal octal escape sequences.  I'd prefer '\x', but that's allowed to be of arbitrary length, and without scanning ahead in the input, I expect this to be hard to handle.  There is also the problem of ambiguity.  Consider '\xffffoobar'.

4.  Reject Unicode escape sequences of more than four hex bytes or where either of the first two hex digits is not zero.  GNU troff does not futz with the libc locale, and any other approach would require doing so.

G. Branden Robinson <gbranden>
Group administrator
Wed 19 Apr 2023 10:01:11 PM UTC, original submission:  

Background, discussing only arguments to the `sy` request.


I think this will also apply to `pi` and `pso`.

At the same time, we might want to see what our story is with respect to opening file names with spaces or backslashes in them.  That would affect the `\O` escape sequence and the `cf`, `fp`, `hpf`, `hpfa`, `lf` (?), `mso`, `msoquiet`, `nx`, `open`, `opena`,  `psbb`, `so`, `soquiet`, and `trf` requests.

I expect this will break AT&T troff compatibility.  But maybe not in a way that any AT&T troff user would notice, since if the behavior of DWB 3.3 troff is any indication, you simply had no way to express C escape sequences that are valid in string literals via troff requests.

G. Branden Robinson <gbranden>
Group administrator


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one

   bug dependencies.


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
    2024-01-08 gbranden Assigned togbranden None
    2024-01-02 gbranden Dependencies- bugs #65099 is dependent
    2023-08-10 gbranden StatusPostponed None

    Back to the top

    Powered by Savane 3.13-6207.
    Corresponding source code