Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926414 - sys-apps/man-db man ffmpeg doesn't work and other mans also have the same error (musl)
Summary: sys-apps/man-db man ffmpeg doesn't work and other mans also have the same err...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-07 17:08 UTC by Tohka
Modified: 2024-04-01 22:48 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (file.txt,21.43 KB, text/plain)
2024-03-12 17:22 UTC, Tohka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tohka 2024-03-07 17:08:05 UTC
When I type man ffmpeg I have a blank less screen and when i exit out of it i get this output

man: command exited with status 1: (cd /usr/share/man && /usr/libexec/man-db/zsoelim) | (cd /usr/share/man && /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE) | (cd /usr/share/man && preconv -e UTF-8) | (cd /usr/share/man && tbl) | (cd /usr/share/man && nroff -mandoc -c -rLL=77n -rLT=77n -Tutf8)

Not sure exactly what is wrong but I know that its reproducible on other systems. Have not tried on glibc systems though.
Comment 1 Mike Gilbert gentoo-dev 2024-03-12 15:48:28 UTC
Maybe try executing that pipeline in stages until something fails.

For example, assuming /usr/share/man/man1/ffmpeg.1.bz2 exists:

> cd /usr/share/man
> bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim
> bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE
> bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE | preconv -e UTF-8
> bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE | preconv -e UTF-8 | tbl
> bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE | preconv -e UTF-8 | tbl | nroff -mandoc -c -rLL=77n -rLT=77n -Tutf8
Comment 2 Tohka 2024-03-12 16:06:38 UTC
(In reply to Mike Gilbert from comment #1)
> Maybe try executing that pipeline in stages until something fails.
> 
> For example, assuming /usr/share/man/man1/ffmpeg.1.bz2 exists:
> 
> > cd /usr/share/man
> > bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim
> > bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE
> > bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE | preconv -e UTF-8
> > bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE | preconv -e UTF-8 | tbl
> > bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE | preconv -e UTF-8 | tbl | nroff -mandoc -c -rLL=77n -rLT=77n -Tutf8

it fails at bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE

the error output is
manconv: iconv_open ("UTF-8//IGNORE", "utf-8"): Invalid argument
Comment 3 Mike Gilbert gentoo-dev 2024-03-12 16:27:24 UTC
Please provide the output from "emerge --info sys-apps/man-db".
Comment 4 Tohka 2024-03-12 17:22:21 UTC
Created attachment 887487 [details]
emerge-info.txt

Here it is
Comment 5 Mike Gilbert gentoo-dev 2024-03-12 18:23:19 UTC
It looks like you have LANG set to "C.UTF8".

Does it work if you set LANG to "C.UTF-8" instead?
Comment 6 Tohka 2024-03-12 18:53:52 UTC
I am on musl so locales are different than in glibc. I am using the default locale that came with the stage tarball if you unpack it you see in /etc/profile.env its C.UTF8 afaik. If you wanted me to do LANG=C.UTF-8 man ffmpeg that still fails.

LANG=C.UTF-8 bzcat man1/ffmpeg.1.bz2 | /usr/libexec/man-db/zsoelim | /usr/libexec/man-db/manconv -f UTF-8:utf-8 -t UTF-8//IGNORE

Also gives the error of:
manconv: iconv_open ("UTF-8//IGNORE", "utf-8"): Invalid argument
Comment 7 Mike Gilbert gentoo-dev 2024-03-14 02:40:39 UTC
I was able to reproduce the issue.

The problem seems to be triggered by the lowercase "utf-8" in the ffmpeg man page header:

> .\" -*- mode: troff; coding: utf-8 -*-

Changing this to uppercase "UTF-8" allows man-db to render the page on musl.

Running the command with MAN_DEBUG=1 in the environment produces some useful debug output. The debug output differs with "utf-8" vs "UTF-8", but I haven't quite nailed down what is happening.
Comment 8 Tohka 2024-03-15 15:44:47 UTC
Ah that is interesting. From my experience its not just ffmpeg that has this there are quite a few man pages that use this lowercase utf-8. I am not sure if we do find a solution how could we implement a fix for all effected packages. Could we just sed and uppercase the headers?
Comment 9 Mike Gilbert gentoo-dev 2024-03-15 15:57:25 UTC
Nah, the fix will be a patch for man-db for sure. Just need to figure out exactly where this blows up.
Comment 10 Tohka 2024-03-15 16:08:03 UTC
could this patch from alpine help in anyway? https://git.alpinelinux.org/aports/tree/community/man-db/ignore.patch
Comment 11 Tohka 2024-03-15 16:10:39 UTC
yep turns out that patch fixes man ffmpeg
Comment 12 Mike Gilbert gentoo-dev 2024-03-15 18:12:16 UTC
That patch will be part of the fix. However it will need to be adapted to work with both glibc and musl and sent upstream.

The other thing that needs fixing is to have man-db recognize that "utf-8" and "UTF-8" are the same encoding and not trigger this weird chain of transcoding commands for no reason.