bug-groff
[Top][All Lists]
Advanced

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

Bug in expression handling with registers in non-numeric format


From: Nick Stoughton
Subject: Bug in expression handling with registers in non-numeric format
Date: Fri, 10 Feb 2006 18:27:48 -0800

GROFF VERSION:
[1.19.2 (and also CVS)]

MACHINE:
[i686]

OS:
[Linux - FC4]

COMPILER:
[gcc 4.0.2]

INPUT FILES:
[
cat > bug.r << EOF
.nr q 1
.nr N 1
.af q i
.ie (\n[q]=1)&(\n[N]=1) .tm Ho!
.el .tm boo
EOF
]

COMMAND LINE:
[troff bug.r]

DESCRIPTION OF INCORRECT BEHAVIOUR:
[
bug.r:4: expected `;' after scale-indicator (got `=')
boo

--------
By the time the if-else is evaluated, the number registers have been
interpolated, and the expression is

.ie (i=1)&(1=1) .tm Ho!

The "i=1" then triggers the error message (if the value is other than 1,
the message changes subtly depending on the value ... for example, if q
is 4, ".if (iv=1)&(1=1)" gives

bug.r:4: expected `;' after scale-indicator (got `v')

Original troff appears to have evaluated this expression (i=1) as false
with no error, so simply using the actual value for of the number
register rather than its formatted representation is also wrong.

NB The mm macro package trips this problem if the '%' page number
register is in "af i" with the following:

address@hidden
.\" user defined end-of-page macro
.ie d EOP .EOP
.el \{\
.       ie o .tl \\*[pg*odd-footer]
.       el .tl \\*[pg*even-footer]
.       ie (\\n[%]=1)&(\\n[N]=1) .tl \\*[pg*header]\" <------ ERROR
.       el .tl \\*[pg*footer]
.       tl ''address@hidden''
.\}

]

SUGGESTED FIX [optional]:
[
In mm, it is possible to use the "P" number register in the above
fragment
(and also in one other place) to work around this. However, I believe
the bug
is really a troff bug, and not an mm one.
]
-- 
Nick Stoughton      USENIX/FSG Standards Liaison
address@hidden     (510) 388 1413





reply via email to

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