tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* eqn delimiters break conditionals
@ 2021-09-08 13:24 наб
  2021-09-09 12:21 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: наб @ 2021-09-08 13:24 UTC (permalink / raw)
  To: tech

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: eqn delimiters break conditionals
  2021-09-08 13:24 eqn delimiters break conditionals наб
@ 2021-09-09 12:21 ` Ingo Schwarze
  2021-09-09 17:12   ` наб
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2021-09-09 12:21 UTC (permalink / raw)
  To: nabijaczleweli; +Cc: tech

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: eqn delimiters break conditionals
  2021-09-09 12:21 ` Ingo Schwarze
@ 2021-09-09 17:12   ` наб
  0 siblings, 0 replies; 3+ messages in thread
From: наб @ 2021-09-09 17:12 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-09 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 13:24 eqn delimiters break conditionals наб
2021-09-09 12:21 ` Ingo Schwarze
2021-09-09 17:12   ` наб

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).