Bug 658132 - MANPAGER is always invoked even when output is not a tty
MANPAGER is always invoked even when output is not a tty
Product: Fedora
Classification: Fedora
Component: man-db (Show other bugs)
Unspecified Unspecified
low Severity medium
: ---
: ---
Assigned To: Ivana Varekova
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2010-11-29 08:30 EST by Pádraig Brady
Modified: 2011-04-21 07:15 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-04-21 07:15:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pádraig Brady 2010-11-29 08:30:31 EST
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
    "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 07:35:38 EST
Thanks for your report.  I've fixed it upstream in bzr revision 1289:

Thu Dec  2 12:33:43 GMT 2010  Colin Watson  <cjwatson@debian.org>

        * 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 08:44:50 EST
Thanks Colin! Good monitoring!

FYI, vim at least will work around the issue:
I presume Fedora will patch in your fix.
Comment 3 Colin Watson 2010-12-02 09:15:22 EST
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.

Comment 4 Colin Watson 2010-12-02 14:28:20 EST
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 07:15:26 EDT
Thanks, now the rawhide version (man-db- fixes this problem.

Note You need to log in before you can comment on or make changes to this bug.