codehenry / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

XMonad.Prompt.Man.manPrompt uses `manpath -g`, -g appears to be an invalid option #551

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. import XMonad.Prompt.Man and set up manPrompt
2. activate and use manPrompt
3.

What is the expected output? What do you see instead?

manPrompt should provide man pages completion but it shows only CWD directories 
as completion

What version of the product are you using? On what operating system?

Gentoo 64bit Linux kernel 3.7.10-gentoo-r1
xmonad and xmonad contrib v 0.11
standard man v 1.6g (from  http://primates.ximian.com/~flucifredi/man/)

Are you using an xmonad.hs?  Please attach it and the output of "xmonad
--recompile".

no output from xmonad --recompile, xmonad.hs attached (clean, not the source of 
the problem)

Please provide any additional information below.

The whole problem is the line in getMans
paths <- getCommandOutput "manpath -g 2>/dev/null" `E.catch`

on my system, manpath does not have the -g option so it fails silently and does 
not output any paths, so then the CWD path is examined instead

I don't know when this option was removed, man v 1.6f doesn't have it either.

Original issue reported on code.google.com by ondrej.g...@gmail.com on 7 Jul 2013 at 7:13

Attachments:

GoogleCodeExporter commented 8 years ago
XMonad.Prompt.Man seems to be written for users of man-db 
<http://man-db.nongnu.org/>, which does have a -g flag.

Original comment by vogt.a...@gmail.com on 8 Jul 2013 at 3:04

GoogleCodeExporter commented 8 years ago
That would explain it.

Gentoo (CentOS too AFAIK) still uses the standard man, but migration to man-db 
is in progress (Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=284822).

I think the only proper solution is to parse the version as printed out by
`manpath -V` (this option seems to be in both versions, although the standard 
manpath does not advertize it). 

Output from standard man `manpath -V` on current Gentoo 64
manpath, version 1.6g     # <- note the comma
        # <- yes, that's one extra blank line ... 

Output from man-db `manpath -V` on Debian 6
manpath 2.5.7

I've attached a working example of such parsing and a patch that should fix the 
problem. I'm a beginner in Haskell, but it could be of some use perhaps.

Original comment by ondrej.g...@gmail.com on 8 Jul 2013 at 6:14

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by vogt.a...@gmail.com on 10 Jul 2013 at 12:55

GoogleCodeExporter commented 8 years ago
I don't have a system with the other man to test, but it works if one of the 
two calls to getCommandOutput gives an empty String:

Mon Jul 15 23:05:36 EDT 2013  Adam Vogt
  * Fix issue 551 by also getting manpath without -g flag.

  Instead of taking Ondrej's approach of figuring out which man (man-db or
  http://primates.ximian.com/~flucifredi/man/) is used by the system, just try
  both sets of flags.

Original comment by vogt.a...@gmail.com on 16 Jul 2013 at 3:17

GoogleCodeExporter commented 8 years ago
Until this fix gets into a release, here's a simple workaround that does not 
require hacking XMonad in any way:

Put the attached manpath script into your private script directory in your PATH 
(it must precede the original manpath) and make it executable 
    Example: 
    1. put it in ~/bin/ (`mkdir -p ~/bin; mv ~/Downloads/manpath ~/bin/`) and make it executable (`chmod a+x ~/bin/manpath`)
    2. put 'export PATH="~/bin:${PATH}"' in your ~/.bashrc (`echo 'export PATH="~/bin:${PATH}"' >> ~/.bashrc`)

Original comment by ondrej.g...@gmail.com on 11 Sep 2013 at 7:46

Attachments: