[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Werner LEMBERG
Subject: [bug #44714] compatibility mode: .do request and macro expansion via \* collide
Date: Fri, 03 Apr 2015 14:03:23 +0000
User-agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36


                 Summary: compatibility mode: .do request and macro expansion
via \* collide
                 Project: GNU troff
            Submitted by: wl
            Submitted on: Fr 03 Apr 2015 16:03:22 CEST
                Severity: 3 - Normal
              Item Group: None
                  Status: Confirmed
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None



Consider the following snippet.

.de1 aa
.  tm compatibility mode = '\\n(.C'
.cp 1
.do tm

The expected output is

compatibility mode = '0'

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

compatibility mode = '1'


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

0 In `src/roff/troff/input.cpp`, function `do_request` resets
`compatible_flag` after calling `interpolate_macro` (which handles the
argument of `.do`).
0 `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.
0 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.

.do tm

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


Reply to this item at:


  Nachricht gesendet von/durch Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]