You are not logged in.

#1 2008-08-19 08:35:21

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Unwanted brackets in man -k / apropos output

When I do man -k CMD, I get funny output like this:
CMD [] (1)       - description of CMD

What are the '[]'s doing there?

It gets worse: "man -k rdiff" gives:
...
rdiff [] (1)     - backup - local/remote mirror and incremental backup
rdiff [] (1)     - backup-statistics - summarize rdiff-backup statistics files
rdiff [] (1)     - compute and apply signature-based file differences

See what's happening: the bit after the first '-' in rdiff-* is getting chopped off and moved into the description field.
Besides being ugly, this also means that "man -k rdiff-backup" won't find the rdiff-backup entry.

I tried "sudo makewhatis -w" but the problem persists. I searched the forums, and though there are a lot of questions about man, I didn't find any about this problem.

Any ideas?

Offline

#2 2008-08-19 13:13:53

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Unwanted brackets in man -k / apropos output

I can reproduce this.
I checked on a Debian system, and everything was working perfectly there (which I expected anyway for this kind of stuff).
Then I checked their man version, and noticed they used the man replacement : man-db
http://bugs.archlinux.org/task/9130

I did pacman -S man-db as root, mandb as user. And everything works fine now.
I would suggest voting for the feature request above and adding a comment.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#3 2008-08-19 14:29:18

rooloo
Member
Registered: 2008-07-09
Posts: 218

Re: Unwanted brackets in man -k / apropos output

shining wrote:

I can reproduce this.
I checked on a Debian system, and everything was working perfectly there (which I expected anyway for this kind of stuff).
Then I checked their man version, and noticed they used the man replacement : man-db
http://bugs.archlinux.org/task/9130

I did pacman -S man-db as root, mandb as user. And everything works fine now.
I would suggest voting for the feature request above and adding a comment.

I had man-db installed once before, you lose all color support for man pages, atleast I did. This is an unwanted feature of man-db if you ask me. Can this be fixed as well?

Offline

#4 2008-08-19 16:04:19

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Unwanted brackets in man -k / apropos output

rooloo wrote:

I had man-db installed once before, you lose all color support for man pages, atleast I did. This is an unwanted feature of man-db if you ask me. Can this be fixed as well?

Arf that is true. I also hope there is a way. There must be one ! smile


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#5 2008-08-19 18:05:47

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: Unwanted brackets in man -k / apropos output

I dislike this issue also but I dislike colorless manpages more.

Offline

#6 2008-08-19 18:14:17

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Unwanted brackets in man -k / apropos output

OK, I poked around in the makewhatis code, and though I didn't take time to analyze the whole thing, the following patch seems to fix the incorrect '-' breaking on names and the empty '[]'s, and hasn't yet shown itself to break anything. Your mileage may well vary from "doesn't break anything." I'll submit the bug report and patches upstream.



--- pkg/usr/sbin/makewhatis    2008-08-19 13:14:06.000000000 -0400
+++ /usr/sbin/makewhatis    2008-08-19 13:18:45.000000000 -0400
@@ -333,7 +333,7 @@
            done = 1;
          } else {
            if ($0 ~ progname"-") {  # Fix old cat pages
-            sub(progname"-", progname" - ");
+            sub(progname"-", progname"-"); # JP changed second " - " to "-"
            }
            if ($0 ~ /[^ \\]-$/) {
              sub(/-$/, "");      # Handle Hyphenations
@@ -418,7 +418,7 @@
          sub(/ $/, "", x);               # Kill trailing spaces (again)
          sub(/\.$/, "", x);              # Kill trailing period

-          if (!match(x, / - /))
+          if (!match(x, / - /)) # Fedora has if (!match(x, / --? /))
        return;

          after_dash = substr(x, RSTART);
@@ -426,7 +426,7 @@
          while (match(head, /, /)) {
        prog = substr(head, 1, RSTART-1);
        head = substr(head, RSTART+2);
-        if (prog != progname)
+        if (prog != progname && progname != "") # JP added second clause
          prog = prog " [" progname "]";
        printf "%-*s (%s) %s\n", 20, prog, actual_section, after_dash;
          }

Last edited by Profjim (2008-08-19 18:23:02)

Offline

#7 2008-08-21 09:55:58

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Unwanted brackets in man -k / apropos output

I didn't test it, but nice job for being able to write a patch, and for sending it upstream smile

Still, it looks like switching to man-db would be a good thing.
I was using the LESS pager with colors before, and here is the tip for making it work with man-db :
http://busybox.net/lists/busybox/2007-March/026798.html

export GROFF_NO_SGR=1

It works perfectly smile

It also looks possible to switch the pager to most, and define colors in ~/.mostrc, but I did not like the result.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#8 2008-09-08 10:10:29

f2
Member
Registered: 2008-09-08
Posts: 3

Re: Unwanted brackets in man -k / apropos output

Thanks for the report Peter.

I will look at it once I am back from holiday in ten days - this is a trivial fix.

If you guys have time, can you download the upstream package and do the verification that the problem is there without any of the Arch patches?

Talk to you in a bit - F

Offline

#9 2008-09-08 10:20:07

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,477
Website

Re: Unwanted brackets in man -k / apropos output

This is the only Arch patch and it just does what is instructed in the source so should not cause the problem...
http://repos.archlinux.org/viewvc.cgi/m … revision=1

Offline

#10 2008-10-12 20:58:37

f2
Member
Registered: 2008-09-08
Posts: 3

Re: Unwanted brackets in man -k / apropos output

looking into this now. Bug is a regression in 1.6f, issue did not exist in 1.6e. Grumble :-/

Offline

#11 2008-10-12 21:08:24

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Unwanted brackets in man -k / apropos output

Thanks f2

Offline

#12 2008-10-12 21:17:07

f2
Member
Registered: 2008-09-08
Posts: 3

Re: Unwanted brackets in man -k / apropos output

brackets are a regression from 1.6f, dash-breakage seems to predate 1.6e.

Offline

Board footer

Powered by FluxBB