-man fails to use ANSI commands

2023-11-19 Thread Anton Shepelev
Hello, all

`groff -man -Tutf8'  does  not  seem  to handle font
styles on my terminal.  I have made sure that  plain
`groff' works as expected:

 This is
 .ft B
 strange
 .ft R
 indeed.
 .pl \n[nl]

The  word  `strange' above is typeset in bold, which
on my terminal looks both bright and bold.   A  test
man-page, however, is output all in the same default
font style and color:

.TH 3 test
.SH Section
This is
.B strange
indeed.

whereas `man -l` renders the same source  correctly,
with  the  words `Section' and `strange' highlighted
and bold.

The incorrect output from -man shows that  it  tries
to make characters bold by typing them over, e.g.:

s^Hst^Htr^Hra^Han^Hng^Hge^He

instead of using ANSI control codes, and this has no
intended effect.  How can I cause `-man  -Tutf8'  to
use ANSI codes?




Re: -man fails to use ANSI commands

2023-11-19 Thread G. Branden Robinson
Hi Anton,

At 2023-11-19T14:53:24+0300, Anton Shepelev wrote:
> `groff -man -Tutf8'  does  not  seem  to handle font
> styles on my terminal.  I have made sure that  plain
> `groff' works as expected:
> 
>  This is
>  .ft B
>  strange
>  .ft R
>  indeed.
>  .pl \n[nl]
> 
> The  word  `strange' above is typeset in bold, which
> on my terminal looks both bright and bold.   A  test
> man-page, however, is output all in the same default
> font style and color:
> 
> .TH 3 test
> .SH Section
> This is
> .B strange
> indeed.
> 
> whereas `man -l` renders the same source  correctly,
> with  the  words `Section' and `strange' highlighted
> and bold.
> 
> The incorrect output from -man shows that  it  tries
> to make characters bold by typing them over, e.g.:
> 
> s^Hst^Htr^Hra^Han^Hng^Hge^He

Yes, that's the overstriking convention originally developed for
paper-based terminals.  People have clung to it like grim death.

By default, groff uses ECMA-48 SGR escape sequences to change the font
styles for terminals.  (Specifically, grotty(1) handles this, and its
man page has a discussion of the issues.)

However, this default has been unpopular in some quarters despite the
silliness of having nroff prepare output for a _paper_ terminal when
writing to a terminal emulator that is set up _specifically_ to emulate
a _video_ terminal (often, something like a DEC VT100, which supports
many ECMA-48 features).

The short version is that distributors sometimes modify groff to force
the overstriking convention, for a variety of (IMO, bad) reasons.

I hadn't heard of anyone making this change only for man pages, though.
Some new deviltry may be afoot on your system.

> instead of using ANSI control codes, and this has no
> intended effect.  How can I cause `-man  -Tutf8'  to
> use ANSI codes?

Check your environment for variables named "GROFF_SGR" (a Debianism) and
"GROFF_NO_SGR".  Unset them both and try "groff -man -Tutf8" again.

Regards,
Branden


signature.asc
Description: PGP signature


Re: building groff 1.23.0 on z/OS

2023-11-19 Thread G. Branden Robinson
[shifting discussion to main groff list]

Hi Mike,

At 2023-11-18T17:35:26-0800, Mike Fulton wrote:
> I have hit a problem trying to build the latest groff.
> I am able to successfully build 1.22.4
> 
> The issue I am hitting is that there is a `#include ` before
> the `config.h` file is included.
>
> Unfortunately on z/OS, `assert.h` includes `stdio.h` and the `stdio.h`
> that is pulled in is from `lib/stdio.h`. The `stdio.h` references
> `restrict` which is properly defined to __restrict__ in `config.h` but
> it isn't included yet... This causes a nasty compiler error.
[...]
> I confirmed that including `config.h` before the assert.h gave me a
> clean compile.
> 
> I can imagine a number of ways to 'fix' this. Should `config.h` be
> included before assert.h from the cpp file? If so, that's a number of
> files that would need to be changed.

I apologize for the problem; it appears to arise from a change I made
right as groff 1.23.0 was going into code freeze.

It sounds pretty closely related to the following changes:

https://git.savannah.gnu.org/cgit/groff.git/commit/?id=0c7866632d0490ac452de609c3c4d624a170c8a6

...which should have prevented this issue, but then...

https://git.savannah.gnu.org/cgit/groff.git/commit/?id=ccc63e65c723e235fafc5099b383959c92664c38

...appears to have resurrected it in a few files.

Would you like to file a Savannah ticket for this problem or would you
prefer that I did?

https://savannah.gnu.org/bugs/?group=groff&func=additem

Regards,
Branden


signature.asc
Description: PGP signature


Why does groff require psutils?

2023-11-19 Thread Lukas Javorsky
Hi,

I've been approached by a maintainer of the `psutils` package that the
groff is the only package that still requires it.
He wants to get rid of the package as many of the dependencies have shifted
from it, but the groff is still remaining

I wanted to ask what is the exact reason groff needs to require `psutils`.
I've found only a small mention in the README, however not much more:

> Ghostscript is required for creation of PDF and (X)HTML output.
> Production of (X)HTML furthermore demands tools from the 'netpbm' and
> 'psutils' packages.
>
> Thank you for your answers.

-- 
S pozdravom/ Best regards

Lukáš Javorský

Software Engineer, Core service - Databases

Red Hat 

Purkyňova 115 (TPB-C)

612 00 Brno - Královo Pole

ljavo...@redhat.com



Re: -man fails to use ANSI commands

2023-11-19 Thread Anton Shepelev
I accidentally replied to Brandon my mail, because of my
client (Sylpheed), which insists on replying to this message
my mail instead of by NNTP (via Gmane). This does not happen
with any other messages I have tried. I am sending this to
the mailing list, but the threading may be broken...

G. Branden Robinson to Anton Shepelev:

> > instead of using ANSI control codes, and this has no
> > intended effect.  How can I cause `-man -Tutf8'  to use
> > ANSI codes?
>
> Check your environment for variables named "GROFF_SGR" (a
> Debianism) and "GROFF_NO_SGR".  Unset them both and try
> "groff -man -Tutf8" again.

`export | grep -i sgr' finds nothing, unfortunately.  Where
else can I look for the reason of -man treating my virtual
terminal as a printer?  Once I find it, I will bring it up
with the administrator of that system, and then perhaps with
the distro maintainers.




Re: Why does groff require psutils?

2023-11-19 Thread G. Branden Robinson
Hi Lukas,

At 2023-11-19T17:31:40+0100, Lukas Javorsky wrote:
> I've been approached by a maintainer of the `psutils` package that the
> groff is the only package that still requires it.  He wants to get rid
> of the package as many of the dependencies have shifted from it, but
> the groff is still remaining
> 
> I wanted to ask what is the exact reason groff needs to require
> `psutils`.  I've found only a small mention in the README, however not
> much more:
> 
> > Ghostscript is required for creation of PDF and (X)HTML output.
> > Production of (X)HTML furthermore demands tools from the 'netpbm'
> > and 'psutils' packages.
> >
> > Thank you for your answers.

This is not documented as well as it could be.  I expected to find the
answer in the GNU Autoconf tests that groff uses, but unless one already
knows what binaries psutils ships, one can't find it.

Long story short: we need the "psselect" command.

Longer story.  This appears to be the only psutils command we need.

$ cat -n m4/groff.m4|sed -n '173,191p'
   173  # grohtml needs the following programs to produce images from tbl(1)
   174  # tables and eqn(1) equations.
   175
   176  dnl Any macro that tests $use_grohtml should AC_REQUIRE this.
   177
   178  AC_DEFUN([GROFF_CHECK_GROHTML_PROGRAMS], [
   179AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
   180
   181use_grohtml=no
   182missing=
   183m4_foreach([groff_prog],
   184  dnl Keep this list of programs in sync with grohtml test scripts.
   185  [[pnmcrop], [pnmcut], [pnmtopng], [pnmtops], [psselect]], [
   186AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
   187if test $[]groff_prog = missing
   188then
   189  missing="$missing 'groff_prog'"
   190fi
   191  ])

I have a long-term notion to eliminate the pre-grohtml program (the
preprocessor for grohtml) altogether; that would eliminate psselect and
at least some of our dependency on netpbm.  (I think we have another
dependency on netpbm.)

But "long-term" may mean "years away".

What does it do?

psselect(1):
   Psselect selects pages from a PostScript document, creating a new
   PostScript file. The input PostScript file should follow the
   Adobe Document Structuring Conventions.

If someone knows of a replacement for psselect, possibly in a more
widely deployed and used package, we could conceivably transition to it.
This would require some testing.

Regards,
Branden


signature.asc
Description: PGP signature


Re: -man fails to use ANSI commands

2023-11-19 Thread G. Branden Robinson
Hi Anton,

At 2023-11-20T00:20:46+0300, Anton Shepelev wrote:
> `export | grep -i sgr' finds nothing, unfortunately.  Where
> else can I look for the reason of -man treating my virtual
> terminal as a printer?  Once I find it, I will bring it up
> with the administrator of that system, and then perhaps with
> the distro maintainers.
[...]
> I accidentally replied to Brandon my mail, because of my
> client (Sylpheed), which insists on replying to this message
> my mail instead of by NNTP (via Gmane). This does not happen
> with any other messages I have tried. I am sending this to
> the mailing list, but the threading may be broken...

If you're still using groff 1.22.4, some distributions used a device
control command to tell grotty(1) to shut off SGR support.  But that
device control command was withdrawn in groff 1.23.0 (July).

https://felipec.wordpress.com/2021/06/05/adventures-with-man-color/

Does this explain what you're seeing?

Regards,
Branden


signature.asc
Description: PGP signature