msys2 / MSYS2-packages

Package scripts for MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
1.28k stars 485 forks source link

man/groff: `man` command shows some error of `grotty` / `troff` for non-console output #4339

Open KSR-Yasuda opened 8 months ago

KSR-Yasuda commented 8 months ago

Description / Steps to reproduce the issue

With groff v1.23 package, man command output errors of grotty and troff as below. It happens only for non-console output (i.e. redirected, or piped output).

% pacman -U groff-1.23.0-2-x86_64.pkg.tar.zst
% /usr/bin/man bash >/dev/null          # Error output as below w/ groff v1.23
grotty:<standard input>:(<standard input>):9: warning: unrecognized X command 'sgr 0' ignored
troff:<standard input>:2073: warning: cannot select font 'CW'
troff:<standard input>:3716: warning: cannot select font 'CW'
troff:<standard input>:3716: warning: cannot select font 'CW'
troff:<standard input>:5383: warning: cannot select font 'CW'
troff:<standard input>:5386: warning: cannot select font 'CW'
troff:<standard input>:5970: warning: cannot select font 'CW'
troff:<standard input>:5982: warning: cannot select font 'CW'
troff:<standard input>:7242: warning: cannot select font 'CW'

% groff --version
GNU groff version 1.23.0
Copyright (C) 2022 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file
named COPYING.

called subprograms:

GNU troff (groff) version 1.23.0
GNU grops (groff) version 1.23.0

% pacman -Q groff
groff 1.23.0-2

This had not happened with groff v1.22 or before:

% pacman -U groff-1.22.4-4-x86_64.pkg.tar.zst
% /usr/bin/man bash >/dev/null          # No error output w/ groff v1.22

% groff --version
GNU groff version 1.22.4
Copyright (C) 2018 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file
named COPYING.

called subprograms:

GNU grops (groff) version 1.22.4
GNU troff (groff) version 1.22.4

% pacman -Q groff
groff 1.22.4-4

Just calling man in bash console, it does not raise this error.

However, in vim's :Man command (enabled with :runtime ftplugin/man.vim line in .vimrc), it does (probably :Man command redirects man output into some file).

Expected behavior

Do not show this error for non-console output.

Or is there any option or something to avoid this?

Actual behavior

As above.

Verification

Windows Version

MINGW64_NT-10.0-19045

Are you willing to submit a PR?

No response

Biswa96 commented 8 months ago

In my case, the /usr/bin/man bash >/dev/null command shows same output in msys2 and in bare metal ArchLinux installation. Also, the output looks like warnings only.

Here is the screenshot from ArchLinux.

image

KSR-Yasuda commented 8 months ago

Thank you for checking.

I found the troff warnings can be suppressed by man --warnings=\!w, but, still the grotty warning remains...

KSR-Yasuda commented 8 months ago

https://lists.gnu.org/archive/html/groff/2023-07/msg00057.html#:~:text=You%20can%20arrange,to%20any%0Avalue%29%2E This says to use env var MANROFFOPT="-c" or GROFF_NO_SGR, but these also do not work.

KSR-Yasuda commented 8 months ago

Vim's :Man command looks trying to avoid this warning by ${GROFF_NO_SGR}:

" /usr/share/vim/vim91/autoload/dist/man.vim (Last Change: 2023 Jun 28)

101 func dist#man#GetPage(cmdmods, ...)

                                     (snip)

191   let env_cmd = s:env_has_u ? 'env -u MANPAGER' : 'env MANPAGER=cat'
192   let env_cmd .= ' GROFF_NO_SGR=1'
193   let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page)
194 
195   silent exec "r !" . man_cmd

                                     (snip)

216 endfunc

Is ${GROFF_NO_SGR} env var actually working?