Bug 658132

Summary: MANPAGER is always invoked even when output is not a tty
Product: [Fedora] Fedora Reporter: Pádraig Brady <p>
Component: man-dbAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: cjwatson, varekova
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-21 11:15:26 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 Pádraig Brady 2010-11-29 13:30:31 UTC
I noticed with the change from man to man-db that I
could no longer drill down into man pages using ctrl-[ in vim
(I use vim as my man page viewer for colors and drill down).

The basic cause of this is that man is filtered through
$MANPAGER even if output not a terminal. This is demonstrated with:

    MANPAGER="tr a-z ." man man | cat

Therefore if you set MANPAGER to be vim, the following gives a vim warning

    man man | cat

vim also does `/usr/bin/man | col -b` internally when ctrl-[ done on a reference. That in turn will fail with the same error.

This also breaks info -> man fallback. info seems to do something like
`man word | less` and that will break if MANPAGER is being set to vim for
eg. which is confirmed with:

   MANPAGER=should_not_run info selinux

I can work around this for vim at least by doing this in my .vimrc

  augroup man
    au!
    "Ensure vim is not recursively invoked (man-db does this)
    "when doing ctrl-[ on a man page reference
    au FileType man let $MANPAGER=""
  augroup END

However, I don't think I should have to do this.
Also I'm not sure anyone would depend on $MANPAGER
always being used, given it wasn't for the previous "man" package.

Comment 1 Colin Watson 2010-12-02 12:35:38 UTC
Thanks for your report.  I've fixed it upstream in bzr revision 1289:

Thu Dec  2 12:33:43 GMT 2010  Colin Watson  <cjwatson>

        * src/man.c (make_display_command): Don't start a pager if standard
          output is not a tty (Fedora bug #658132).
        * NEWS: Document this.

Comment 2 Pádraig Brady 2010-12-02 13:44:50 UTC
Thanks Colin! Good monitoring!

FYI, vim at least will work around the issue:
http://article.gmane.org/gmane.editors.vim.devel/29086
I presume Fedora will patch in your fix.

Comment 3 Colin Watson 2010-12-02 14:15:22 UTC
There'll be a few conflicts in the patch (command_* -> pipecmd_* in more recent versions of man-db) but it should be easy enough to figure out.  Whoever's doing this can give me a shout if they need a hand, of course.

http://bazaar.launchpad.net/~cjwatson/man-db/trunk/revision/1289

Comment 4 Colin Watson 2010-12-02 19:28:20 UTC
Oops - this caused test failures on its own.  You'll need to backport revision 1291 as well.  Sorry.

Comment 5 Ivana Varekova 2011-04-21 11:15:26 UTC
Thanks, now the rawhide version (man-db-2.6.0.2-1) fixes this problem.