Re: CVS commit: src/share/tmac

2019-12-25 Thread Steffen Nurpmeso
Robert Elz wrote in <11416.1577299...@jinx.noi.kre.to>:
 |Date:Wed, 25 Dec 2019 18:06:39 +0100
 |From:Steffen Nurpmeso 
 |Message-ID:  <20191225170639.ddhqn%stef...@sdaoden.eu>
 |
 || Maybe the warning should really simply be removed, or only occur
 || if explicitly requested, i.e., remove the "el" warning bit from
 || the "all" level, just as is already done for some others; i guess
 || that would be the best.
 |
 |Not really, a truly unmatched .el (the common cause is
 |
 | .if ...
 | .el ...
 |
 |) truly is an error, and a warning for that case is entirely
 |reasonable.   What's broken is generating it because of a chain
 |of .ie / .el .ie / .el .ie / .el
 |
 |Each .ie needs a matching .el whether or not the .ie is actually
 |executed.

The warning occurs on "if stack is empty" condition.  This was my
impression after doing a grep and having a short completely
context free look at the code, of course.
Other than that you are of course right.

 |kre
 --End of <11416.1577299...@jinx.noi.kre.to>

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: CVS commit: src/share/tmac

2019-12-25 Thread Robert Elz
Date:Wed, 25 Dec 2019 18:06:39 +0100
From:Steffen Nurpmeso 
Message-ID:  <20191225170639.ddhqn%stef...@sdaoden.eu>

  | Maybe the warning should really simply be removed, or only occur
  | if explicitly requested, i.e., remove the "el" warning bit from
  | the "all" level, just as is already done for some others; i guess
  | that would be the best.

Not really, a truly unmatched .el (the common cause is

.if ...
.el ...

) truly is an error, and a warning for that case is entirely
reasonable.   What's broken is generating it because of a chain
of .ie / .el .ie / .el .ie / .el

Each .ie needs a matching .el whether or not the .ie is actually
executed.

kre



Re: CVS commit: src/share/tmac

2019-12-25 Thread Steffen Nurpmeso
Robert Elz wrote in <18872.1577152...@jinx.noi.kre.to>:
 |Date:Mon, 23 Dec 2019 23:45:34 +0100
 |From:Steffen Nurpmeso 
 |Message-ID:  <20191223224534.8ufgy%stef...@sdaoden.eu>
 |
 |
 |||Troff reads .ie and checks the condition.  The condition is true and
 |||so the rest of the line is executed.  Then troff reads .el that
 |||matches successful .ie, so the .el is discarded.
 |||
 |||Then it reads .el which is not matched with any .ie that troff has
 |||seen.  It's usually silently discarded,
 |
 |That is what is (always was) intended to happen.
 |
 |||but since we run with -ww we
 |||get the warning about an unbalanced .el
 |
 |That's a broken warning.   The code in a "discarded" .el needs to be
 |examined anyway (if it weren't, the \{ \} block to group the code
 |together wouldn't work, and when doing that, it can easily notice an
 |embedded .ie (it must be immediately after the .el so looking for it is
 |not hard) which will require another matching .el, and make sure that
 |things are correctly balanced.   That would be a useful wraning.
 |
 |The
 | .ie
 | .el .ie
 | .el .ie
 | .el
 |
 |idiom has been used in troff (including by troff's authors) forever.

Forever, me too.  It is the very first groff commit of James Clark
which added that behaviour (1991-06-02 04:20:34 -0500).  Other
than that i do not think it is a broken warning, my mailer for
example simply bails with error if the if conditional stack is
empty, so broken is possibly that the warning only happens with
-w, and not by default. 

 |Deciding to make that improper now, just because someone who doesn't
 |understand, or cannot work out how to handle it correctly, is absurd.
 |
 |Perhaps (originally) the ".el .ie" combination could have been made
 |a macro of its own, it should really be treated as if it were (like
 |the "elif" word in sh), but adding more code to process another macro,
 |just to save (what would be) 3 input bytes per use wouldn't really
 |have been justifiable.

Maybe the warning should really simply be removed, or only occur
if explicitly requested, i.e., remove the "el" warning bit from
the "all" level, just as is already done for some others; i guess
that would be the best.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: CVS commit: src/share/tmac

2019-12-24 Thread Valery Ushakov
On Tue, Dec 24, 2019 at 16:13:56 -, Christos Zoulas wrote:

> In article <20191224113037.gl24...@pony.stderr.spb.ru>,
> Valery Ushakov   wrote:
> >On Tue, Dec 24, 2019 at 08:46:49 +0700, Robert Elz wrote:
> >
> >>   |  |but since we run with -ww we
> >>   |  |get the warning about an unbalanced .el
> >> 
> >> That's a broken warning.
> >
> >Amen.  But let's be honest, in this day and age *very* few people can
> >can read troff, never mind write it (and I don't count myself as one),
> >so a warning from groff, however broken, will just confuse and upset
> >the users.  Since silencing this warning doesn't require that much of
> >an effort and doesn't mutilate the code that much, it's easier to just
> >shut it up.
> 
> We should file a bug report with groff though (and optionally supply a fix).

We are sticking to groff 1.19 that is still GPLv2+.  1.20 (released 11
years ago) switched to GPLv3+.  Current version is 1.22.4.  It would
make sense to switch to heirloom doctools (CDDL), but the general
sentiment seems to be that we don't want to have troff in base as it's
not cool, nobody knows how to use it and we don't use it for manpages
anymore anyway. :(

For the in-tree stuff we only use troff for isntall notes and for
(very very old and often out of date) documents in /usr/share/doc

-uwe


Re: CVS commit: src/share/tmac

2019-12-24 Thread Christos Zoulas
In article <20191224113037.gl24...@pony.stderr.spb.ru>,
Valery Ushakov   wrote:
>On Tue, Dec 24, 2019 at 08:46:49 +0700, Robert Elz wrote:
>
>> Date:Mon, 23 Dec 2019 23:45:34 +0100
>> From:Steffen Nurpmeso 
>> Message-ID:  <20191223224534.8ufgy%stef...@sdaoden.eu>
>> 
>> 
>>   |  |Troff reads .ie and checks the condition.  The condition is true and
>>   |  |so the rest of the line is executed.  Then troff reads .el that
>>   |  |matches successful .ie, so the .el is discarded.
>>   |  |
>>   |  |Then it reads .el which is not matched with any .ie that troff has
>>   |  |seen.  It's usually silently discarded,
>> 
>> That is what is (always was) intended to happen.
>
>Sure.
>
>
>>   |  |but since we run with -ww we
>>   |  |get the warning about an unbalanced .el
>> 
>> That's a broken warning.
>
>Amen.  But let's be honest, in this day and age *very* few people can
>can read troff, never mind write it (and I don't count myself as one),
>so a warning from groff, however broken, will just confuse and upset
>the users.  Since silencing this warning doesn't require that much of
>an effort and doesn't mutilate the code that much, it's easier to just
>shut it up.

We should file a bug report with groff though (and optionally supply a fix).

christos



Re: CVS commit: src/share/tmac

2019-12-24 Thread Valery Ushakov
On Tue, Dec 24, 2019 at 08:46:49 +0700, Robert Elz wrote:

> Date:Mon, 23 Dec 2019 23:45:34 +0100
> From:Steffen Nurpmeso 
> Message-ID:  <20191223224534.8ufgy%stef...@sdaoden.eu>
> 
> 
>   |  |Troff reads .ie and checks the condition.  The condition is true and
>   |  |so the rest of the line is executed.  Then troff reads .el that
>   |  |matches successful .ie, so the .el is discarded.
>   |  |
>   |  |Then it reads .el which is not matched with any .ie that troff has
>   |  |seen.  It's usually silently discarded,
> 
> That is what is (always was) intended to happen.

Sure.


>   |  |but since we run with -ww we
>   |  |get the warning about an unbalanced .el
> 
> That's a broken warning.

Amen.  But let's be honest, in this day and age *very* few people can
can read troff, never mind write it (and I don't count myself as one),
so a warning from groff, however broken, will just confuse and upset
the users.  Since silencing this warning doesn't require that much of
an effort and doesn't mutilate the code that much, it's easier to just
shut it up.

-uwe


Re: CVS commit: src/share/tmac

2019-12-23 Thread Robert Elz
Date:Mon, 23 Dec 2019 23:45:34 +0100
From:Steffen Nurpmeso 
Message-ID:  <20191223224534.8ufgy%stef...@sdaoden.eu>


  |  |Troff reads .ie and checks the condition.  The condition is true and
  |  |so the rest of the line is executed.  Then troff reads .el that
  |  |matches successful .ie, so the .el is discarded.
  |  |
  |  |Then it reads .el which is not matched with any .ie that troff has
  |  |seen.  It's usually silently discarded,

That is what is (always was) intended to happen.

  |  |but since we run with -ww we
  |  |get the warning about an unbalanced .el

That's a broken warning.   The code in a "discarded" .el needs to be
examined anyway (if it weren't, the \{ \} block to group the code
together wouldn't work, and when doing that, it can easily notice an
embedded .ie (it must be immediately after the .el so looking for it is
not hard) which will require another matching .el, and make sure that
things are correctly balanced.   That would be a useful wraning.

The
.ie
.el .ie
.el .ie
.el

idiom has been used in troff (including by troff's authors) forever.
Deciding to make that improper now, just because someone who doesn't
understand, or cannot work out how to handle it correctly, is absurd.

Perhaps (originally) the ".el .ie" combination could have been made
a macro of its own, it should really be treated as if it were (like
the "elif" word in sh), but adding more code to process another macro,
just to save (what would be) 3 input bytes per use wouldn't really
have been justifiable.

kre



Re: CVS commit: src/share/tmac

2019-12-23 Thread Steffen Nurpmeso
Valery Ushakov wrote in <20191223222133.gj24...@pony.stderr.spb.ru>:
 |On Mon, Dec 23, 2019 at 22:13:23 +0100, Steffen Nurpmeso wrote:
 |> Valeriy E. Ushakov wrote in <20191223201734.0e415f...@cvs.netbsd.org>:
 |>
 |>|Modified Files:
 |>| src/share/tmac: doc2html
 |>|
 |>|Log Message:
 |>|Fix if/else syntax in previous.
 |> 
 |> What was wrong with that?
 |> 
 |> .   ie 'utf8'\*[.T]' \
 |> . ds mx:istty
 |> .   el .ie 'latin1'\*[.T]' \
 |> . ds mx:istty
 |> .   el .ie 'ascii'\*[.T]' \
 |> . ds mx:istty
 |> .   el .ie 'pdf'\*[.T]' \
 |> . mx:dump-init-pdf
 |> .   el .ie 'html'\*[.T]' \
 |> . mx:dump-init-html
 |> .   el \
 |> . rm mx:gogogo
 |> 
 |> is perfectly valid roff code.
 |
 |Try running it with warnings (-ww), as the build process does.  You'll
 |get
 |
 |warning: unbalanced .el request
 |
 |Consider
 |
 |  .ie '\*(.T'ascii'  .ds html-charset US-ASCII
 |  .el .ie '\*(.T'latin1' .ds html-charset ISO-8859-1
 |  .el .ie '\*(.T'utf8'   .ds html-charset UTF-8
 |  .el .ab unsupported encoding \*(.T
 |
 |executed with -Tascii.
 |
 |Troff reads .ie and checks the condition.  The condition is true and
 |so the rest of the line is executed.  Then troff reads .el that
 |matches successful .ie, so the .el is discarded.
 |
 |Then it reads .el which is not matched with any .ie that troff has
 |seen.  It's usually silently discarded, but since we run with -ww we
 |get the warning about an unbalanced .el
 |
 |The the same happens again for the next .el, the number of warnings
 |depends on which .ie in the chain was successful (no warnings for
 |utf-8, 1 warning for latin1, two for ascii).

Interesting.  You are right.  Never encountered that, i have to
change some macros of mine!

A nice Christmas i wish!
Ciao from Germany,

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: CVS commit: src/share/tmac

2019-12-23 Thread Valery Ushakov
On Mon, Dec 23, 2019 at 22:13:23 +0100, Steffen Nurpmeso wrote:

> Valeriy E. Ushakov wrote in <20191223201734.0e415f...@cvs.netbsd.org>:
>
>  |Modified Files:
>  | src/share/tmac: doc2html
>  |
>  |Log Message:
>  |Fix if/else syntax in previous.
> 
> What was wrong with that?
> 
> .   ie 'utf8'\*[.T]' \
> . ds mx:istty
> .   el .ie 'latin1'\*[.T]' \
> . ds mx:istty
> .   el .ie 'ascii'\*[.T]' \
> . ds mx:istty
> .   el .ie 'pdf'\*[.T]' \
> . mx:dump-init-pdf
> .   el .ie 'html'\*[.T]' \
> . mx:dump-init-html
> .   el \
> . rm mx:gogogo
> 
> is perfectly valid roff code.

Try running it with warnings (-ww), as the build process does.  You'll
get

warning: unbalanced .el request

Consider

  .ie '\*(.T'ascii'  .ds html-charset US-ASCII
  .el .ie '\*(.T'latin1' .ds html-charset ISO-8859-1
  .el .ie '\*(.T'utf8'   .ds html-charset UTF-8
  .el .ab unsupported encoding \*(.T

executed with -Tascii.

Troff reads .ie and checks the condition.  The condition is true and
so the rest of the line is executed.  Then troff reads .el that
matches successful .ie, so the .el is discarded.

Then it reads .el which is not matched with any .ie that troff has
seen.  It's usually silently discarded, but since we run with -ww we
get the warning about an unbalanced .el

The the same happens again for the next .el, the number of warnings
depends on which .ie in the chain was successful (no warnings for
utf-8, 1 warning for latin1, two for ascii).

-uwe


Re: CVS commit: src/share/tmac

2019-12-23 Thread Steffen Nurpmeso
Valeriy E. Ushakov wrote in <20191223201734.0e415f...@cvs.netbsd.org>:
 |Module Name:  src
 |Committed By: uwe
 |Date: Mon Dec 23 20:17:33 UTC 2019
 |
 |Modified Files:
 | src/share/tmac: doc2html
 |
 |Log Message:
 |Fix if/else syntax in previous.

What was wrong with that?

.   ie 'utf8'\*[.T]' \
. ds mx:istty
.   el .ie 'latin1'\*[.T]' \
. ds mx:istty
.   el .ie 'ascii'\*[.T]' \
. ds mx:istty
.   el .ie 'pdf'\*[.T]' \
. mx:dump-init-pdf
.   el .ie 'html'\*[.T]' \
. mx:dump-init-html
.   el \
. rm mx:gogogo

is perfectly valid roff code.

 |To generate a diff of this commit:
 |cvs rdiff -u -r1.69 -r1.70 src/share/tmac/doc2html

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


CVS commit: src/share/tmac

2019-11-26 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Nov 26 08:38:19 UTC 2019

Modified Files:
src/share/tmac: doc2html

Log Message:
PR toolchain/54715

Remove duplicate (incorrect) version of the .Lk macro, so the
earlier (fancier and functional) definition survives.

For now simply comment it out.  Sometime later this one should be
removed - but the two have been present since these macros were
first imported (1999) so leaving this visible (but removed) a
little longer shouldn't hurt.

I (believe) this one is the only duplicate of this form.

With this change the Lk macro in doc2html should work as it is designed
(but does not call other macros, and can only have punctuation following
the URL and (optional) anchor args (2nd arg is the anchor if it isn't
punctuation).

Tested by martin@


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/share/tmac/doc2html

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/tmac

2019-11-26 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Nov 26 08:38:19 UTC 2019

Modified Files:
src/share/tmac: doc2html

Log Message:
PR toolchain/54715

Remove duplicate (incorrect) version of the .Lk macro, so the
earlier (fancier and functional) definition survives.

For now simply comment it out.  Sometime later this one should be
removed - but the two have been present since these macros were
first imported (1999) so leaving this visible (but removed) a
little longer shouldn't hurt.

I (believe) this one is the only duplicate of this form.

With this change the Lk macro in doc2html should work as it is designed
(but does not call other macros, and can only have punctuation following
the URL and (optional) anchor args (2nd arg is the anchor if it isn't
punctuation).

Tested by martin@


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/share/tmac/doc2html

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/tmac/doc2html
diff -u src/share/tmac/doc2html:1.67 src/share/tmac/doc2html:1.68
--- src/share/tmac/doc2html:1.67	Tue Nov 22 00:36:49 2016
+++ src/share/tmac/doc2html	Tue Nov 26 08:38:19 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: doc2html,v 1.67 2016/11/22 00:36:49 kamil Exp $
+.\" $NetBSD: doc2html,v 1.68 2019/11/26 08:38:19 kre Exp $
 .\"
 .\" Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -788,12 +788,12 @@ AT UNIX\\$*
 .	as doc-pcresult \\*[an-eol]
 .	pc-fin
 ..
-.de Lk
-.	as doc-pcresult \\$1
-.	shift
-.	recurse \\$@
-.	pc-fin
-..
+.\".de Lk
+.\".	as doc-pcresult \\$1
+.\".	shift
+.\".	recurse \\$@
+.\".	pc-fin
+.\"..
 .de Mt
 .	as doc-pcresult \\$1
 .	shift