Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 102800 - sys-apps/groff: `groff -Tascii -mandoc` doesn't process manpages correctly
Summary: sys-apps/groff: `groff -Tascii -mandoc` doesn't process manpages correctly
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-17 02:43 UTC by Shigeru Akiyama
Modified: 2013-12-03 07:26 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shigeru Akiyama 2005-08-17 02:43:56 UTC
Command to convert a manpage to a plain text file:

$ groff -t -e -mandoc -Tascii manpage.1 | col -bx > manpage.txt

which is explained in `Man-Page HOWTO', doesn't seem to work on Gentoo system,
although it works correctly on (various versions of) SuSE system.

I found that the Midnight Commander uses the following command to view a manpage:

nroff -c -Tlatin1 -mandoc manpage.1

and 

$ nroff -c -Tlatin1 -mandoc manpage.1 | col -bx > manpage.txt

seems to produce desired output correctly.

Since `nroff' is based on `groff', there must be something wrong with argument
passing mechanism of `groff' on Gentoo system.

The current version of `groff' is groff-1.19.1-r2, but older versions have the
same problem.


Reproducible: Always
Steps to Reproduce:
1.
2.
3.




root:groff# emerge info
Portage 2.0.51.22-r2 (default-linux/amd64/2005.0, gcc-3.4.4, glibc-2.3.5-r1,
2.6.12-gentoo-r6 x86_64)
=================================================================
System uname: 2.6.12-gentoo-r6 x86_64 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO http://mirror.gentoo.gr.jp
http://gentoo.gg3.net/ http://mirror.averse.net/pub/gentoo/
http://gentoo.channelx.biz/ http://gentoo.arcticnetwork.ca/
http://cudlug.cudenver.edu/gentoo/ http://ftp.gentoo.or.kr/
ftp://gg3.net/pub/linux/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/"
LINGUAS="en ja"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X alsa avi berkdb bitmap-fonts cdr crypt cups curl eds encode esd fam
foomaticdb fortran gdbm gif gnome gpm gstreamer gtk gtk2 imagemagick imlib ipv6
java jpeg kde libwww lzw lzw-tiff mad motif mp3 mpeg mysql ncurses nls ogg
opengl pam pdflib perl png python qt quicktime readline ruby sdl slang spell ssl
tcltk tcpd tetex tiff truetype-fonts type1-fonts usb userlocales vorbis xine
xml2 xmms xpm xv zlib linguas_en linguas_ja userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-08-17 02:49:25 UTC
What exactly you mean with "doesn't process manpages correctly"? The same thing
as in Bug 102760?
Comment 2 Shigeru Akiyama 2005-08-17 03:08:42 UTC
I mean output is not plain text; a manpage is not convert to a plain text file.
I am sorry, now I realize my subject line was not informative.


No, not the same bug; #102760 is a bug of `col', and its effect is truncation only.


Comment 3 SpanKY gentoo-dev 2005-08-17 18:27:54 UTC
rather than blaming groff, maybe it's col's fault (Bug 102760)
Comment 4 Shigeru Akiyama 2005-08-17 20:09:52 UTC
No, definitely not.

Output of

$ groff -t -e -mandoc -Tascii wc.1

is like this:

^[[1mNAME^[[0m
       wc - print the number of newlines, words, and bytes in files

^[[1mSYNOPSIS^[[0m
       ^[[1mwc ^[[22m[^[[4mOPTION^[[24m]... [^[[4mFILE^[[24m]...

And, output of

$ nroff -c -mandoc -Tlatin1 wc.1

is like this:


N^HNA^HAM^HME^HE
       wc - print the number of newlines, words, and bytes in files

S^HSY^HYN^HNO^HOP^HPS^HSI^HIS^HS
       w^Hwc^Hc [_^HO_^HP_^HT_^HI_^HO_^HN]... [_^HF_^HI_^HL_^HE]...

The latter can be filtered correctly by `col'.
Comment 5 SpanKY gentoo-dev 2005-08-17 21:20:16 UTC
the former outputs control codes which look fine if you give it to something
which understands control codes like `less`
Comment 6 sam 2005-09-30 04:19:39 UTC
hey i'm french, i prefer to read the manual in my native
your subject line is not unuseful.
i saw this problem yesterday. the letter with some accents in the french
man-pages are displayed like this e(C).
i don't know how to fix this while i "can't" RTFM.
Comment 7 sam 2005-10-02 23:39:14 UTC
(In reply to comment #6)
> hey i'm french, i prefer to read the manual in my native
> your subject line is not unuseful.
> i saw this problem yesterday. the letter with some accents in the french
> man-pages are displayed like this e(C).
> i don't know how to fix this while i "can't" RTFM.
> 
The problem is not coming from groff. Scuse me for this msg

Comment 8 Mathias Laurin 2008-07-20 03:26:25 UTC
Hi all, 

it is a groff problem and the solution is to pass it the -c option. This can be set in /etc/man.conf. You may also compare man.conf on your suse and gentoo. (Do not mind the funny location of my man.conf, I am a alt-prefix user, but this is irrelevant.)


17:25 /Users/laurin/Library/Gentoo/etc [0]1 % diff -u man.conf{.orig,}
--- man.conf.orig       2008-07-02 17:06:44 +0900
+++ man.conf    2008-07-02 17:25:37 +0900
@@ -93,8 +93,8 @@
 # causes problems, add the -c option to TROFF, NROFF, JNROFF.
 #
 TROFF          /Users/laurin/Library/Gentoo/usr/bin/groff -Tps -mandoc
-NROFF          /Users/laurin/Library/Gentoo/usr/bin/nroff -mandoc
-JNROFF         /Users/laurin/Library/Gentoo/usr/bin/groff -Tnippon -mandocj
+NROFF          /Users/laurin/Library/Gentoo/usr/bin/nroff -mandoc -c
+JNROFF         /Users/laurin/Library/Gentoo/usr/bin/groff -Tnippon -mandocj -c
 EQN            /Users/laurin/Library/Gentoo/usr/bin/geqn -Tps
 NEQN           /Users/laurin/Library/Gentoo/usr/bin/geqn -Tlatin1
 JNEQN          /Users/laurin/Library/Gentoo/usr/bin/geqn -Tnippon
Comment 9 Fabian Groffen gentoo-dev 2008-08-10 17:28:51 UTC
`man grotty` is the only man-page which for me shows colours (in the background and foreground example texts).

People with garbled text seem to be able to get something useful when using man -P "less -R", while setting PAGER to "less -R" doesn't work.
Comment 10 SpanKY gentoo-dev 2013-12-03 07:26:11 UTC
you need to pass these additional args:
  -P -c -P -b -P -B

these tell the postprocessor (grotty) to not use escape sequences.  the escape sequences that show up in the output are part of ascii, so the -Tascii format doesn't tell groff to filter it out.  the -mandoc says you want to do things like bold/color, so it includes the escape sequences.

or i could be full of crap and you should check with upstream to verify:
https://lists.gnu.org/archive/html/groff/