bugGNU troff - Bugs: bug #44714, compatibility mode: .do request...


bug #44714: compatibility mode: .do request and macro expansion via \* collide

Submitted by:  Werner LEMBERG <wl>
Submitted on:  Fri 03 Apr 2015 02:03:22 PM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Confirmed
Privacy: PublicAssigned to: None
Open/Closed: OpenPlanned Release: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 03 Apr 2015 02:03:22 PM UTC, original submission:

Consider the following snippet.

The expected output is

since macro `.aa` is defined with `.de1`. However, due to a bug in troff you get


Reason of the problem is a clash between the `.do` request and the immediately following macro expansion via `\*`.

  1. In `src/roff/troff/input.cpp`, function `do_request` resets `compatible_flag` after calling `interpolate_macro` (which handles the argument of `.do`).
  2. `interpolate_macro` calls `token::next` to get the next input token, and this function expands `\*(aa` and processes tokens until it gets a 'real' one.
  3. Since `aa` is defined with the `de1` request, it starts internally with a `PUSH_GROFF_MODE` pseudo-character that makes troff save the compatibility flag and switch off compatibility mode. Unfortunately, this happens too early, and `do_request` overrides this.

An easy work-around is to insert a no-op line.

Alas, fixing this bug is not trivial, as far as I can see; it's probably necessary to redesign the compatibility mode handling.

Werner LEMBERG <wl>
Project Administrator


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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by wl (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1