Bug 655385

Summary: LESS_IS_MORE=1 ruins formating
Product: [Fedora] Fedora Reporter: Magnus Glantz <mglantz>
Component: man-dbAssignee: Ivana Varekova <varekova>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 14CC: p, pschiffe, varekova
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: man-db-2.5.7-6.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-25 20:06:23 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Magnus Glantz 2010-11-20 14:04:03 EST
Description of problem:
If LESS_IS_MORE=1 is set formating for all man pages is ruined.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. $ export LESS_IS_MORE=1
2. $ man man
Actual results:

       man - an interface to the on-line reference manuals

       ESC[1mman  ESC[22m[ESC[1m-C  ESC[4mESC[22mfileESC[24m]  [ESC[1m-dESC[22m]  [ESC[1m-DESC[22m]  [ESC[1m--warningsESC[22m[=ESC[4mwarningsESC[24m]]  [ESC[1m-R  ESC[4mESC[22mencodingESC[24m]  [ESC[1m-L  ESC[4mESC[22mlocaleESC[24m]  [ESC[1m-m ESC[4mESC[22msystemESC[24m[,...]] [ESC[1m-M ESC[4mESC[22mpathESC[24m] [ESC[1m-S ESC[4mESC[22mlistESC[24m] [ESC[1m-e ESC[4mESC[22mextensionESC[24m] [ESC[1m-iESC[22m|ESC[1m-IESC[22m] [ESC[1m--regexESC[22m|ESC[1m--wildcardESC[22m]

Expected results:
MAN(1)                                                                       Manual pager utils                                                                       MAN(1)

man - an interface to the on-line reference manuals

       man  [-C  file]  [-d]  [-D]  [--warnings[=warnings]]  [-R  encoding]  [-L  locale]  [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I] [--regex|--wildcard]
       [--names-only] [-a] [-u] [--no-subpages]  [-P  pager]  [-r  prompt]  [-7]  [-E  encoding]  [--no-hyphenation]  [--no-justification]  [-p  string]  [-t]  [-T[device]]
       [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ...

Additional info:
All the latest patches applied.
Comment 1 Magnus Glantz 2010-11-20 14:08:53 EST
Reason of setting LESS_IS_MORE was at least some years ago to be able to exit a man page without clearing the screen, keeping what was displayed on the screen when issuing 'q'. This actually still works when setting the variable, but, the man-page's formating so bad that it's useless.
Comment 2 Ivana Varekova 2010-11-24 04:49:52 EST
The problem is fixed in man-db-2.5.9-2.fc15.
Comment 3 Fedora Update System 2010-11-24 04:55:05 EST
man-db-2.5.7-6.fc14 has been submitted as an update for Fedora 14.
Comment 4 Fedora Update System 2010-11-24 17:41:36 EST
man-db-2.5.7-6.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update man-db'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/man-db-2.5.7-6.fc14
Comment 5 Magnus Glantz 2010-11-25 03:12:27 EST
Great job Ivana, works like a charm in man-db-2.5.7-6.fc14.
Comment 6 Fedora Update System 2010-11-25 20:06:15 EST
man-db-2.5.7-6.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 7 Pádraig Brady 2010-11-26 07:54:47 EST
I use vim to browse my man pages and also noticed this new messed up format.
But I was able to work around it by setting: export GROFF_NO_SGR=1

I see you hardcoded the addition of the -c option to nroff.
That means that if you do want SGR codes shown, you can't.
I.E. with the above change, one can no longer use the following
command to dump a man page with highlights: MANPAGER=cat man man

Would it perhaps have been better to auto set
GROFF_NO_SGR in the logic dealing with LESS_IS_MORE?
Comment 8 Pádraig Brady 2010-11-26 07:55:51 EST
BTW it would be nice to link the changes made from the bug reports:
Comment 9 Pádraig Brady 2010-11-29 08:17:52 EST
Some more notes for reference:

on ubuntu 10.04 with groff-base 1.20.1-7
The following does _not_ show highlights (SGR codes)

printf '.TH header\n.SH highlight\n' | nroff -mandoc

while on fedora 14 + groff-1.20.1-2.fc14.i686
the above _does_ show SGR codes unless GROFF_NO_SGR is set

The nroff commands run by both ubuntu and fedora are
the same I think, apart from this new -c option in fedora
added in the above patch.
Comment 10 Peter Schiffer 2013-04-29 11:59:01 EDT

I just wanted to let you know that I'm going to drop the patch used to fix this bug. As Pádraig mentioned, now it's impossible to show SGR codes when desired.

Magnus, if you want to use LESS_IS_MORE variable, please use also GROFF_NO_SGR.