malformed man pages

Dan Nelson dnelson at allantgroup.com
Sat Dec 5 06:55:21 UTC 2009


In the last episode (Dec 05), Sagara Wijetunga said:
> Dan Nelson wrote:
> > In the last episode (Dec 04), Sagara Wijetunga said:
> >>
> >> We have an issue on Tomahawk Desktop (an upcoming FreeBSD-based distro)
> >> that all man pages malformed.
> >>
> >> Eg. man tar shows as follows:
> >> 1mNAME0m
> >>      1mtar 22m-- format of tape archive files
> >>
> >> 1mDESCRIPTION0m
> >>      The 1mtar 22marchive format collects any number of files, 
> >> directories, and
> >>     
> >
> > That looks sort of like malformed ANSI escape codes (bold would be "ESC
> > [ 1 m", but the man utilities shouldn't be generating those.  If you run
> > "man 5 tar | hd | head", what do you get?  I get this:
> >
> > 00000000  54 41 52 28 35 29 09 09  09 20 20 46 72 65 65 42  |TAR(5)...  FreeB|
> > 00000010  53 44 20 46 69 6c 65 20  46 6f 72 6d 61 74 73 20  |SD File Formats |
> > 00000020  4d 61 6e 75 61 6c 09 09  09 54 41 52 28 35 29 0a  |Manual...TAR(5).|
> > 00000030  0a 4e 08 4e 41 08 41 4d  08 4d 45 08 45 0a 20 20  |.N.NA.AM.ME.E.  |
> > 00000040  20 20 20 74 08 74 61 08  61 72 08 72 20 2d 2d 20  |   t.ta.ar.r -- |
> > 00000050  66 6f 72 6d 61 74 20 6f  66 20 74 61 70 65 20 61  |format of tape a|
> > 00000060  72 63 68 69 76 65 20 66  69 6c 65 73 0a 0a 44 08  |rchive files..D.|
> > 00000070  44 45 08 45 53 08 53 43  08 43 52 08 52 49 08 49  |DE.ES.SC.CR.RI.I|
> > 00000080  50 08 50 54 08 54 49 08  49 4f 08 4f 4e 08 4e 0a  |P.PT.TI.IO.ON.N.|
> > 00000090  20 20 20 20 20 54 68 65  20 74 08 74 61 08 61 72  |     The t.ta.ar|
> >
> > The doubled letters are handled by /usr/bin/less and converted to bold
> > before displaying.  If you get the same hd output as I have above, then
> > we know that the manpage is fine, and your problem is in /usr/bin/less
> > or your terminal type is incorrect.  If you see ANSI escape codes in the
> > hd output, then we know the problem is with the manpage tools.
>
> Here is what I get:
> 
> man 5 tar | hd | head
> 
> /usr/share/groff/1.20.1/tmac/doc.tmac:3375: bad character definition

^ this looks suspicious. doc.tmac should live at /usr/share/tmac/doc.tmac

> 00000000  54 41 52 28 35 29 09 09  09 20 20 20 20 42 53 44  |TAR(5)...    BSD|
> 00000010  20 46 69 6c 65 20 46 6f  72 6d 61 74 73 20 4d 61  |File  Formats Ma|
> 00000020  6e 75 61 6c 09 09 09 54  41 52 28 35 29 0a 0a 31  |nual...TAR(5)..1|
> 00000030  6d 4e 41 4d 45 30 6d 0a  20 20 20 20 20 31 6d 74  |mNAME0m.     1mt|
> 00000040  61 72 20 32 32 6d 2d 2d  20 66 6f 72 6d 61 74 20  |ar 22m-- format |
> 00000050  6f 66 20 74 61 70 65 20  61 72 63 68 69 76 65 20  |of tape archive |
> 00000060  66 69 6c 65 73 0a 0a 31  6d 44 45 53 43 52 49 50  |files..1mDESCRIP|
> 00000070  54 49 4f 4e 30 6d 0a 20  20 20 20 20 54 68 65 20  |TION0m.     The |
> 00000080  31 6d 74 61 72 20 32 32  6d 61 72 63 68 69 76 65  |1mtar 22marchive|
> 00000090  20 66 6f 72 6d 61 74 20  63 6f 6c 6c 65 63 74 73  | format collects|
> Error executing formatting or display command.
> system command exited with status 36096
> No entry for tar in section 5 of the manual

^ the above 3 lines you can ignore; man is just complaining because we
^ stopped reading its output after a few lines. 

> We use /usr/bin/less from ftp://ftp.gnu.org/gnu/less, the 
> less-382.tar.gz, unpatched.
> 
> Does the less need to be patched in FreeBSD? If so, is there such a 
> patch exist?

Since your output differs from mine, the manpages are getting damaged before
they reach /usr/bin/less.

Have you maybe installed your own copy of GNU groff?  The original source
enables ANSI escapes in manpages, but the version in FreeBSD disables them. 
Make sure your /usr/share/tmac/troffrc matches the content at
http://svn.freebsd.org/viewvc/base/stable/8/contrib/groff/tmac/troffrc?view=markup
, especially the last 10 lines or so, and check for other installations of
groff.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list