[-- Attachment #1: Type: text/plain, Size: 1040 bytes --] Hi! Consider the following file: -- >8 -- .EQ delim %% .EN .if 0 A % B % C .if 1 D % E % F -- >8 -- What'd you expect to see here? I'd expect D E F, with eqnified E, and groff agrees: -- >8 -- $ groff -e -Tutf8 < a.1 | grep -v '^$' D E F -- >8 -- However, mandoc (1.14.4-1 and latest CVS as of an hour ago) does not: -- >8 -- $ ./mandoc < a.1 | grep -v '^$' () () B C D E F () -- >8 -- Disabling eqn inline delimiters gives us the expected from both: -- >8 -- $ cat a.1 .if 0 A % B % C .if 1 D % E % F $ groff -e -Tutf8 < a.1 | grep -v '^$' D % E % F $ ./mandoc < a.1 | grep -v '^$' () () D % E % F () -- >8 -- This smells like a bug to me, for reasons I assume obvious. Best, наб [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]
Hi, Nab wrote on Wed, Sep 08, 2021 at 03:24:48PM +0200: > Consider the following file: > -- >8 -- > .EQ > delim %% > .EN > .if 0 A % B % C > .if 1 D % E % F > -- >8 -- [...] > However, mandoc (1.14.4-1 and latest CVS as of an hour ago) does not: > -- >8 -- > $ ./mandoc < a.1 | grep -v '^$' > () () > B C D E F > () > -- >8 -- [..] > This smells like a bug to me, for reasons I assume obvious. Yes, that is a bug, and it was so far unknown, too. The reason for the bug is that roff.c implements eqn(7) delim by replacing delimited equations with .EQ/.EN blocks on the fly, and then they are no longer on the conditional line. Fixing it requires to either implement delim in a completely different way, which would cause very major code changes. Or the delim handling could possibly be moved after the handling of conditionals in roff_parseln(). But the code in that function is very prone to regressions. Consequently, i won't attempt fixing this bug before the upcoming release, the risk of breaking the release in a way that might be even worse is too high, and besides, this causes too much effort to be resolved before release. Instead, i'm adding an entry to the TODO file: - eqn(7) delimiters cause conditional lines to misbehave nabijaczleweli 8 Sep 2021 15:24:48 +0200 loc * exist *** algo *** size * imp * Thanks for reporting! Ingo -- To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
[-- Attachment #1: Type: text/plain, Size: 477 bytes --] On Thu, Sep 09, 2021 at 02:21:53PM +0200, Ingo Schwarze wrote: > Consequently, i won't attempt fixing this bug before the upcoming > release, the risk of breaking the release in a way that might be > even worse is too high, and besides, this causes too much effort > to be resolved before release. Fair enough; as a work-around, apparently -- >8 -- .EQ delim %% .EN .if 0 \{ A % B % C \} .if 1 \{ D % E % F \} -- >8 -- works in both mandoc and groff. наб [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]