Piping man into grep - grotty sgr0 message

2023-07-18 Thread Michael J. Donovan

Updated to 1.23.0
man works as before, except when you pipe its output to another command.

    man ls | grep color
    grotty::():9: warning: unrecognized 
X command 'sgr 0' ignored

   --color[=WHEN]

The same thing happens here:
    man ls | cat

In my .bashrc:
    export MANROFFOPT='-c'
    export GROFF_NO_SGR=1

The only way to suppress the grotty message is with brute force:
    man ls 2>/dev/null | grep color

-Mike


Re: Piping man into grep - grotty sgr0 message

2023-07-18 Thread G. Branden Robinson
Hi Michael,

At 2023-07-18T17:47:35-0400, Michael J. Donovan via wrote:
> Updated to 1.23.0
> man works as before, except when you pipe its output to another command.
> 
>     man ls | grep color
>     grotty::():9: warning: unrecognized X
> command 'sgr 0' ignored
>    --color[=WHEN]

It looks like your distributor might be carrying a somewhat popular
patch, often to the "site.tmac" file, that injects an "sgr" device
control command into *roff output.

Here's an example:

https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/tools/text/groff/site.tmac

> In my .bashrc:
>     export MANROFFOPT='-c'
>     export GROFF_NO_SGR=1

These are mutually redundant; you only need one of them.  And you still
get the diagnostic message because the patch linked above pays no heed
to the "GROFF_NO_SGR" environment variable.

The "GROFF_SGR" (note the absence of "NO") patch apparently originated
with Debian 21 years ago, but its package maintainer, Colin Watson, who
handled groff (and man-db) for that distribution then and now, has
dropped it from Debian's groff 1.23.0 packages.

https://salsa.debian.org/debian/groff/-/commit/f0a34f20ff772f692255b7e32a05630c639f75a8

Colin's commit message summarizes the rationale for this decision more
succinctly than I would.

>> I turned these off for Debian in 2002 because pagers didn't cope well
>> at the time, but it's now 21 years later and things have changed; SGR
>> escape sequences resolve some ambiguity (see #963490) and are
>> required for new features such as clickable hyperlinks.

On the other hand, from Web traffic I have noticed that some people are
aggrieved because when grotty(1) uses SGR escape sequences instead of
overstriking, a somewhat popular hack to get the less(1) pager to
colorize elements of man pages is defeated.

Here is a discussion of that issue from this list earlier this month.

https://lists.gnu.org/archive/html/groff/2023-07/msg00058.html

The take-away is: drop the patch to "site.tmac" or ask your distributor
to do so.

Does this help?

Regards,
Branden


signature.asc
Description: PGP signature


Re: Bug#1018737: /usr/bin/rst2man: rst2man: .TH 5th field shouldn't be empty

2023-07-18 Thread G. Branden Robinson
Hi Alex,

At 2022-09-07T00:13:18+0200, Alejandro Colomar wrote:
>> "Those types are not 'abstract'--they are as real as int and float."
>> -- guess who?
> 
> :p  By the way, an actual link to the context of the quote would be
> nice.  I've only found copies of the quote without context.  Where did
> that appear?

Earliest source I can find is a 1991 paper by Stroustrup.  See the
bottom of page 5.

https://www.stroustrup.com/whatis.pdf

Regards,
Branden


signature.asc
Description: PGP signature