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   
Whiteboard:
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-26 01:06:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Magnus Glantz 2010-11-20 19:04:03 UTC
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):
man-db-2.5.7-2.fc14.x86_64

How reproducible:
Always

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

ESC[1mNAMEESC[0m
       man - an interface to the on-line reference manuals

ESC[1mSYNOPSISESC[0m
       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)

NAME
man - an interface to the on-line reference manuals

SYNOPSIS
       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 19:08:53 UTC
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 09:49:52 UTC
The problem is fixed in man-db-2.5.9-2.fc15.

Comment 3 Fedora Update System 2010-11-24 09:55:05 UTC
man-db-2.5.7-6.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/man-db-2.5.7-6.fc14

Comment 4 Fedora Update System 2010-11-24 22:41:36 UTC
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 08:12:27 UTC
Great job Ivana, works like a charm in man-db-2.5.7-6.fc14.

Comment 6 Fedora Update System 2010-11-26 01:06:15 UTC
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 12:54:47 UTC
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 12:55:51 UTC
BTW it would be nice to link the changes made from the bug reports:
http://pkgs.fedoraproject.org/gitweb/?p=man-db.git;a=commitdiff;h=e8aabf03
Cheers.

Comment 9 Pádraig Brady 2010-11-29 13:17:52 UTC
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 15:59:01 UTC
Guys,

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.

Thanks,

peter