Description of problem:
When makewhatis constructs its database, there is a problem if the command name contain a dash.
Exemple
with the command ssh-agent the result in /var/cache/man/whatis is
ssh [] (1) - agent - xxxxxxxxxxxxxxxx
instead of
ssh-agent (1) - xxxxxxxxxxxxxxxx
And when we use a command like 'apropos agent' we get
ssh [] (1) - agent - xxxxxxxxxxxxxxxx

In the script makewhatis the problem seems to be located there
if ($0 ~ progname"-") { # Fix old cat pages
sub(progname"-", progname" - ");
}
I tried to replace
sub(progname"-", progname"---");
I get
ssh---agent [] (1) - authentication agent
It's not the real fix, but a way to locate where could be the solution.

This is actually the wrong fix. The problem is not in the lines of code
if ($0 ~ progname"-") { # Fix old cat pages
sub(progname"-", progname" - ");
}
-- those lines of code are fine and can be uncommented again.
The actual cause of the problem is that "progname" is set to be the EMPTY STRING.
If it were correctly set to the program name, the above code would be fine and would change things like "ssh-agent-description here" to
"ssh-agent - description here".
However, because it is empty, it causes the observed problem.
That is also why running "whatis man" (for example) gives
man [] (1) - format and display the on-line manual pages
with the empty string in square brackets -- which should not be there!
The real cause of both these problems is earlier:
use_zcat = match(filename,"\\.Z$") ||
match(filename,"\\.z$") || match(filename,"\\.gz$");
if (!use_zcat)
use_bzcat = match(filename,"\\.bz2");
****===> if(!use_bzcat)
use_lzcat = match(filename,"\\.lzma");
if (use_zcat || use_bzcat || use_lzcat ) {
filename_no_gz = substr(filename, 0, RSTART - 1);
} else {
filename_no_gz = filename;
}
match(filename_no_gz, "/[^/]+$");
progname = substr(filename, RSTART + 1, RLENGTH - 1);
The line marked ***====> is the problem. It should be replaced with
if (!use_zcat && ! use_bzcat)
As it stands, with gzipped manpages, z_cat is set to true by the first line, which also sets RSTART to the beginning of the .gz suffix. Then the use_bzcat assignment is (correctly) skipped, leaving use_bzcat false.
Then the problem line sees that use_bzcat is false and tries to assign use_lzcat. In so doing it runs another match command, which fails, and which overwrites RSTART and RLENGTH to zero. The final line then sets progname to the empty string.
In summary:
The fix is to put back in the lines that were commented out in the first fix attempt, and instead to alter the single line marked with ***====> above.
Can somebody with write-access to this bug please reopen it?
Thanks!