Discussion:
[bug #58162] unicode.tmac re-enables compatibility mode
(too old to reply)
G. Branden Robinson
2020-04-12 03:55:09 UTC
Permalink
URL:
<https://savannah.gnu.org/bugs/?58162>

Summary: unicode.tmac re-enables compatibility mode
Project: GNU troff
Submitted by: gbranden
Submitted on: Sun 12 Apr 2020 03:55:07 AM UTC
Category: Macro - others
Severity: 3 - Normal
Item Group: Incorrect behaviour
Status: In Progress
Privacy: Public
Assigned to: gbranden
Open/Closed: Open
Discussion Lock: Any
Planned Release: None

_______________________________________________________

Details:

John Gardner noticed the following regression test failure (for a different
software project) on groff git HEAD relative to groff 1.22.4 (which does not
have this bug).


*Command:*
printf '.ds FOO BAR\n\\*[FOO]' | groff -C -Tutf8 | head -n1

*Expected output:*
FOO]

*Actual output:*
BAR
From a glance, it looks like the `.C` register is being set twice: once by the
calling tty.tmac, and again by unicode.tmac.


So the saved register value was being clobbered.

The real problem here, contrary to my initial thoughts on the mailing list
thread, is not the save/restore approach but a namespace problem. A common
pattern in macro files and in the man pages in the tree is to just save the .C
register in a register named _C. This fails as soon as nesting happens.

A while back I ground through all the man pages to make them save to
uniquely-named registers, but out of timidity I did not the stuff in the tmac
directory, where it actually would have done more good. When I added
save/restore to this file in 2019, I cautiously copied examples from the same
directory. But they were bad examples in this respect!




_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?58162>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
G. Branden Robinson
2020-04-12 03:57:31 UTC
Permalink
Follow-up Comment #1, bug #58162 (project groff):

Savannah cruelly truncated my bug submission. Fortunately, I was able to go
back in my browser history and get it.

What gives, Savannah?

---

John Gardner noticed the following regression test failure (for a different
software project) on groff git HEAD relative to groff 1.22.4 (which does not
have this bug).


*Command:*
printf '.ds FOO BAR\n\\*[FOO]' | groff -C -Tutf8 | head -n1

*Expected output:*
FOO]

*Actual output:*
BAR
From a glance, it looks like the `.C` register is being set twice: once by the
calling tty.tmac, and again by unicode.tmac.


So the saved register value was being clobbered.

The real problem here, contrary to my initial thoughts on the mailing list
thread, is not the save/restore approach but a namespace problem. A common
pattern in macro files and in the man pages in the tree is to just save the .C
register in a register named _C. This fails as soon as nesting happens.

A while back I ground through all the man pages to make them save to
uniquely-named registers, but out of timidity I did not the stuff in the tmac
directory, where it actually would have done more good. When I added
save/restore to this file in 2019, I cautiously copied examples from the same
directory. But they were bad examples in this respect!

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?58162>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
G. Branden Robinson
2020-04-12 03:59:54 UTC
Permalink
Follow-up Comment #2, bug #58162 (project groff):

I have a voodoo doll of Savannah and I am burning it, slowly.

---

John Gardner noticed the following regression test failure (for a different
software project) on groff git HEAD relative to groff 1.22.4 (which does not
have this bug).


*Command:*
printf '.ds FOO BAR\n\\*[FOO]' | groff -C -Tutf8 | head -n1

*Expected output:*
FOO]

*Actual output:*
BAR
From a glance, it looks like the `.C` register is being set twice: once by the
calling tty.tmac, and again by unicode.tmac.


So the saved register value was being clobbered.

The real problem here, contrary to my initial thoughts on the mailing list
thread, is not the save/restore approach but a namespace problem. A common
pattern in macro files and in the man pages in the tree is to just save the .C
register in a register named _C. This fails as soon as nesting happens.

A while back I ground through all the man pages to make them save to
uniquely-named registers, but out of timidity I did not the stuff in the tmac
directory, where it actually would have done more good. When I added
save/restore to this file in 2019, I cautiously copied examples from the same
directory. But they were bad examples in this respect!

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?58162>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
G. Branden Robinson
2020-04-12 04:02:27 UTC
Permalink
Follow-up Comment #3, bug #58162 (project groff):

Those of you reading only the email interface will think I'm an EVEN BIGGER
idiot than I am. Check the web interface.

Bad verbatim pairing is not handled gracefully.

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?58162>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Loading...