Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
man-page looks weird
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sat Mar 23, 2024 2:28 pm    Post subject: man-page looks weird Reply with quote

I discovered a funny 'problem'.
All man-pages look like this.
Code:
equery − Gentoo Package Query Tool

is a collection of modules for querying the state of Gentoo pack‐
ages, files and USE flags.

Output a help message.
Be  less verbose where possible. In some modules, this option can
increase the output speed.
Do not colorize output.
Turn off automatic pipe detection. Use this option if you do  not
want  to  detect if the output is being directed to the screen or
to another program and adjust color and verbosity accordingly.
Display Gentoolkit’s version. Please include this in all bug  re‐
ports. (see below)

uses  a  system of modules. Each module has both a long and short
name. The list below uses the notation "module (m)", where  m  is
the  short  name  and  module is the long name.  You can view the
message for a specific module by using as either a global  option
(after  and  before  the module name) or as a local option (after
the module name).

List the package that owns FILE.  Normally, only one package will
own FILE. If multiple packages own the same file it should be re‐
ported. (see below)
...

I have a freshly installed system running Plasma Desktop.

Does anyone have an idea where I could look?
_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
sublogic
Apprentice
Apprentice


Joined: 21 Mar 2022
Posts: 265
Location: Pennsylvania, USA

PostPosted: Sat Mar 23, 2024 10:41 pm    Post subject: Reply with quote

The missing text in your display is either bold or underlined in mine. is your TERM variable set correctly ?
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sat Mar 23, 2024 11:10 pm    Post subject: Reply with quote

$TERM looks good to me.
Code:
echo $TERM
xterm-256color


I use alacritty as a terminal.
but I also get the same result with konsole
_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 382
Location: Naarm/Melbourne, Australia

PostPosted: Sun Mar 24, 2024 12:31 am    Post subject: Reply with quote

Do you have the GROFF_NO_SGR variable set in your environment, i.e. as shown by the output of running the `env` command? If so, what is its value? If it's not set, could you please report whether you still get the issue after doing:

Code:
$ export GROFF_NO_SGR=1
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sun Mar 24, 2024 10:12 am    Post subject: Reply with quote

Thanks for the reply.
This variable is set and the output is the same.
Code:
env | grep -E "GROFF|MAN|TERM"
SESSION_MANAGER=local/purix:@/tmp/.ICE-unix/2509,unix/purix:/tmp/.ICE-unix/2509
COLORTERM=truecolor
LESS_TERMCAP_se=
LESS_TERMCAP_so=
GROFF_ENCODING=UTF8
MANPATH=/usr/share/gcc-data/x86_64-pc-linux-gnu/13/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.41/man:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man
GROFF_NO_SGR=yes
TERM=xterm-256color
LESS_TERMCAP_mb=
LESS_TERMCAP_me=
LESS_TERMCAP_md=
MANPAGER=less -s -M +Gg
LESS_TERMCAP_ue=
LESS_TERMCAP_us=

It's not a problem with the color or the font, it's all perfect.
The problem is that the formatting is completely missing. Everything is displayed in one block.
A typical man page looks like this
Code:
Name
cat - concatenate files and print on the standard output
Synopsis
cat [OPTION]... [FILE]...
Description

Concatenate FILE(s), or standard input, to standard output.

-A, --show-all
    equivalent to -vET
-b, --number-nonblank
    number nonempty output lines
etc
ect

I get everything in one block. An yes, with color and bold font.
Code:
cat - concatenate files and print on the
standard output Synopsiscat [OPTION]...
[FILE]...Description Concatenate FILE(s)
, or stand ard input, to standard output.
-A, --show-all e quivalent to -vET -b, --
number-nonblank num ber nonempty output l
ines
ect
ect

I've never seen anything like this before
_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 382
Location: Naarm/Melbourne, Australia

PostPosted: Sun Mar 24, 2024 11:19 am    Post subject: Reply with quote

Do you still get the same formatting issues if you don't involve `less`? E.g. if you run:

Code:
groff -man -Tutf8 /usr/share/man/man1/cat.1
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sun Mar 24, 2024 2:09 pm    Post subject: Reply with quote

No, unfortunately not.
Code:
LC_TIME=en_US.UTF-8 groff -man -Tutf8 /usr/share/man/man1/cat.1
preconv: error: can't open '/usr/share/man/man1/cat.1': No such file or directory

But the file is there.
Code:
ls -l /usr/share/man/man1/cat*
-rw-r--r-- 1 root root 1084 23. Mär 11:13 /usr/share/man/man1/cat.1.bz2


When I unzip cat.1.bz2, I get a file cat.1.
With this file, the man-page works as it should, but without colors.
Code:
groff -man -Tutf8 /home/jean/Downloads/extrakt/cat.1
CAT(1)                   Dienstprogramme für Benutzer                   CAT(1)

BEZEICHNUNG
       cat - Dateien aneinanderhängen und in die Standardausgabe schreiben

ÜBERSICHT
       cat [OPTION]… [DATEI]…

BESCHREIBUNG
       DATEI(en) auf Standardausgabe verketten.

       liest ohne DATEI oder wenn DATEI - ist, aus der Standardeingabe.

       -A, --show-all
              äquivalent zu -vET

       -b, --number-nonblank
              nichtleere Ausgabezeilen nummerieren, überschreibt -n
ect ...

_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 382
Location: Naarm/Melbourne, Australia

PostPosted: Sun Mar 24, 2024 11:34 pm    Post subject: Reply with quote

Oh, my apologies, i forgot that man pages are bzip2'ed by default; i have them uncompressed on my system, as i use mandoc instead of man-db+groff, and mandoc doesn't support bzip2 compression (but given the size of storage nowadays, i feel the savings offered by compression are marginal).

So, what's being done by the groff(1) command i provided is page layout, without any sequences to indicate typeface formatting (as per the relevant man(7) macros, such as '.B' for bold, in the man page source). The fact that the layout is correct prior to less(1) getting involved suggests that something is indeed going askew once `less` gets a hold of the output of `groff`.

There are known issues with how `less` uses overstriking sequences, rather than ECMA-48 escape sequences: https://git.savannah.gnu.org/cgit/groff.git/tree/PROBLEMS?id=198346d187de9e340bbf9d4f80c2dc4d42f5f74e#n121. i would suggest seeing what happens if you don't set GROFF_NO_SGR, and additionally, what happens if you pass the '-R'/'--RAW-CONTROL-CHARACTERS' option to `less`. (On my own system, i don't have the MANPAGER variable set, but i have LESS set to "--RAW-CONTROL-CHARS --no-init --save-marks".)
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Mon Mar 25, 2024 9:18 am    Post subject: Reply with quote

Unfortunately no change.
Neither 'GROFF_NO_SGR=no' nor LESS='-R'/'--RAW-CONTROL-CHARACTERS' does anything.

I think this is a fundamental problem that may have arisen during installation.
I'm now switching to the new profile and rebuilding the system.
Maybe the problem will solve itself, maybe I'll reinstall, or maybe I'll switch to mandoc.

In any case, I thank you very very much for your help.
_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
t3k0
n00b
n00b


Joined: 27 Nov 2007
Posts: 59

PostPosted: Thu May 16, 2024 10:13 pm    Post subject: Reply with quote

Hi all.

I have exactly the same issue. I assume it appeard after upgrading my system to the default/linux/amd64/23.0/split-usr/desktop profile. But I don't know for sure if it was caused by this.

I tried to find information here https://wiki.gentoo.org/wiki/Man_page but nothing which helped.
Further, I tried different values with the MANWIDTH variable. But this didn't have any impact at all.

I can confirm that after flexibeast's comment:
Code:
groff -man -Tutf8 /usr/share/man/man1/cat.1


The layout looked as it is supposed to look. (I bunzip2-ed first.)

Another maybe helpful hint despite the weird format.
I cannot search for the "-" minus sign. It is not found.
First I thought this is an encoding issue, so I switched the termial from UTF-8 to ISO-8859-15. But no difference.

Quote:
if you don't set GROFF_NO_SGR

If I unset (which it was in the first place) it looks still wrong. (Same for GROFF_NO_SGR=1)

You're command for less
Quote:
-R'/'--RAW-CONTROL-CHARACTERS
does not work.

It results in

Code:
There is no -/ option ("less --help" for help)
Press RETURN to continue


What should we do?
Should we file a bug report since more users seem to be affected?
Back to top
View user's profile Send private message
thumper
Guru
Guru


Joined: 06 Dec 2002
Posts: 554
Location: Venice FL

PostPosted: Fri May 17, 2024 12:28 am    Post subject: Reply with quote

t3k0 wrote:
Hi all.
What should we do?
Should we file a bug report since more users seem to be affected?


I have exactly the same issue, had it for about a year it seems, occasionally I'd spend an afternoon trying to fix it, but to no avail.

George
Back to top
View user's profile Send private message
t3k0
n00b
n00b


Joined: 27 Nov 2007
Posts: 59

PostPosted: Fri May 17, 2024 4:00 pm    Post subject: Reply with quote

To give some further input:

While investigating, I found this article https://lwn.net/Articles/947941/, which I thought could be related, because of the wrong minus "-" sign I mentioned above.
However, a downgrade to groff-1.22.4 did not solve the issue. While normally I should be concluding that it is not related to the change in groff-1.23.0 mentioned in this article, I still have the impression that it is related to a bug with this package.
Back to top
View user's profile Send private message
vthriller
n00b
n00b


Joined: 20 May 2024
Posts: 5

PostPosted: Mon May 20, 2024 6:37 pm    Post subject: Reply with quote

t3k0 wrote:

You're command for less
Quote:
-R'/'--RAW-CONTROL-CHARACTERS
does not work.

It results in

Code:
There is no -/ option ("less --help" for help)
Press RETURN to continue



Just use either -R or --RAW-CONTROL-CHARACTERS, that's just two spellings of the same option.
Back to top
View user's profile Send private message
t3k0
n00b
n00b


Joined: 27 Nov 2007
Posts: 59

PostPosted: Mon May 20, 2024 6:50 pm    Post subject: Reply with quote

:roll: I could have figured this out myself.

But no effect.

I tried both
Code:
LESS="--RAW-CONTROL-CHARS" man [mymanpage]


and just to be sure also

Code:
man --pager="less -R" [mymanpage]


but to no success.
The man page is still in justification and the "-" sign is a different one than on my keyboard.
Back to top
View user's profile Send private message
muddle
n00b
n00b


Joined: 01 May 2007
Posts: 29

PostPosted: Mon Aug 19, 2024 7:28 pm    Post subject: Reply with quote

I had the same issue with man not formatting the man pages. After slightly modifying the file /etc/man_db.conf, man started to work again. I found the difference by comparing the config with a version from a computer where everything worked.

This is what I had to change:

diff man_db.conf.working /etc/man_db.conf
Code:

83,84c83,84
< DEFINE        troff   groff -mandoc -c
< DEFINE        nroff   nroff -mandoc -c
---
> DEFINE        troff   groff -c
> DEFINE        nroff   nroff -c


So adding -mandoc in the lines 83 and 84 helped in my case. (The package app-text/mandoc-1.14.6 was already installed on my computer). I'm not sure why/when this changes made it into the file in the first place.
Back to top
View user's profile Send private message
thumper
Guru
Guru


Joined: 06 Dec 2002
Posts: 554
Location: Venice FL

PostPosted: Mon Aug 19, 2024 10:43 pm    Post subject: Reply with quote

muddle wrote:
So adding -mandoc in the lines 83 and 84 helped in my case. (The package app-text/mandoc-1.14.6 was already installed on my computer). I'm not sure why/when this changes made it into the file in the first place.


I found mandoc was installed, all DEFINE statements were commented out, i added
Code:
mandoc -c
to those 2 lines as shown in your post, uncommented the 2 lines, and it fixed my viewing of man pages.

Thank you,

George
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 382
Location: Naarm/Melbourne, Australia

PostPosted: Tue Aug 20, 2024 12:37 am    Post subject: Reply with quote

`-mandoc` in this instance isn't a reference to the `app-text/mandoc` package; it's stating that `groff` should be called with the `-m` option and `andoc` as the argument to that option. Quoting the groff(1) man page:
Quote:
andoc is a wrapper package specific to GNU roff that recognizes whether a document uses man or mdoc format and loads the corresponding macro package. It can be specified on the command line as -mandoc.

mdoc(7) is another macro set / 'format' for man pages, which provides semantics-based markup, rather than presentation-based markup as in the case of man(7). It's used for man pages on OpenBSD, and it's what i've used to port documentation in the skaware ecosystem (e.g. s6) from HTML to man pages.

If adding `-mandoc` to /etc/man_db.conf affects how man pages are displayed, that means your system isn't actually defaulting to the use of `app-text/mandoc` to display man pages, but is instead using man_db+groff. To use `app-text/mandoc` instead, you'd need to specify the `system-man` USE flag for that package. There are issues with doing so, however, as i've described in the 'Mandoc' page on the wiki (as a `mandoc` user myself), so switching over isn't something one should do lightly.
Back to top
View user's profile Send private message
t3k0
n00b
n00b


Joined: 27 Nov 2007
Posts: 59

PostPosted: Sat Aug 24, 2024 1:16 pm    Post subject: Reply with quote

Thanks for your replies.

The trick of muddle adding replacing lines 83 and 84 with

Code:

DEFINE        troff   groff -mandoc -c
DEFINE        nroff   nroff -mandoc -c


also works for me. I have never edited this file. Isn't this the default?

Concerning flexibeast's comment:
I checked the USE-flags of app-text/mandoc-1.14.6 and I have "system-man" unset.


  • How should the system actually be configured? Is the editing of /etc/man_db.conf the preferred solution or should users go with the "system-man" setting as described in the https://wiki.gentoo.org/wiki/Mandoc ?
  • Is this a bug which should be reported, if one of the settings is not correct for whatever reason? Because other users are affected I guess this is a more general issue.
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 382
Location: Naarm/Melbourne, Australia

PostPosted: Sat Aug 24, 2024 11:38 pm    Post subject: Reply with quote

There are two possibilities for which system is used for man pages:

* The default, a combination of sys-apps/man-db (which will get pulled in by default via virtual/man) and sys-apps/groff (the actual program used to render man pages for displaying in this context). This possibility is the one that makes use of the /etc/man_db.conf file.

* The `mandoc` program, which doesn't use either man-db or groff, and which is distinct from the `-mandoc` option+argument to the `groff` program. Installing the app-text/mandoc package simply makes the program available; to make the `mandoc` program the one that gets used to render man pages, you have to set the `system-man` USE flag on app-text/mandoc. The /etc/man_db.conf file is irrelevant in this context; it's not used by the `mandoc` program.

As i said at the start of my previous comment, the text:
Code:
groff -mandoc -c

in /etc/man_db.conf is not referring to the `mandoc` program. It's basically a command line, i.e.:
Code:
$ groff -mandoc -c

What `-mandoc` means here is that groff should do autodetection of whether a man page is in man(7) format or mdoc(7) format, and then use the appropriate macro set (i.e. `man` or `mdoc`) to render it accordingly.

The start of the raw contents of a man page in man(7) format will look something like:
Code:
.TH CAT "1" "March 2024" "GNU coreutils 9.5" "User Commands"
.SH NAME
cat \- concatenate files and print on the standard output
.SH SYNOPSIS

whereas the start of the raw contents of a man page in mdoc(7) format will look something like:
Code:
.Dd November 7, 2023
.Dt S6-LOG 8
.Os
.Sh NAME
.Nm s6-log
.Nd reliable logging program with automated log rotation, similar to daemontools' multilog[1], with full POSIX regular expression support
.Sh SYNOPSIS

The raw contents of a man page can be seen by passing the `-L` option to the `less` command, which says to not to any preprocessing on the file. For example:
Code:
$ less -L /usr/share/man/man1/cat.1

Hope that clarifies things?
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 382
Location: Naarm/Melbourne, Australia

PostPosted: Sat Aug 24, 2024 11:57 pm    Post subject: Reply with quote

Oh, sorry, i also meant to say, regarding:
t3ko wrote:
Is this a bug which should be reported

i would say that the /etc/man_db.conf file should indeed have:
Code:
DEFINE        troff   groff -mandoc -c
DEFINE        nroff   nroff -mandoc -c

by default, and yes, if it doesn't, a bug report should be created - i feel users shouldn't have to know whether a given man page was written in man(7) or mdoc(7). If you do open a bug, please link to it here, so i can follow the discussion. :-)

(And i again emphasise that this is orthogonal to the `system-man` USE flag, which is about which program to use by default for rendering man pages (groff or mandoc), not about the configuration of the man-db+groff option, which is what the /etc/man_db.conf issue is part of.)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum