cppman icon indicating copy to clipboard operation
cppman copied to clipboard

Don't overwrite existing manpages with -m true

Open jyn514 opened this issue 5 years ago • 8 comments

cppman -m true -c overwrites pages that already exist, like memcpy and malloc, without checking. It would be nice to keep those versions, especially since they have some info that the C++ manuals don't (e.g. thread safety).

jyn514 avatar Apr 03 '19 21:04 jyn514

Looks like this could go in https://github.com/aitjcize/cppman/blob/master/cppman/main.py#L184, I might take a stab at it

jyn514 avatar Apr 03 '19 21:04 jyn514

Can you try adjust your MANPATH ? If you put the default MANPATH before cppman man path, it should find the system builtin man pages first.

aitjcize avatar Apr 07 '19 06:04 aitjcize

Would it be possible for cppman to write it in ~/.manpath when run with -m? Normally I leave $MANPATH unset and just use the defaults returned by manpath

jyn514 avatar Apr 07 '19 15:04 jyn514

Would it be possible for cppman to write it in ~/.manpath when run with -m? Normally I leave $MANPATH unset and just use the defaults returned by manpath

That is exactly what cppman does. Cppman does not overwrite any system manuals. It only adjust the ~/.manpath.

This sounds like the same issue as #91 . I am not sure where it comes from. I also can't reproduce it. If you have any hint how to reproduce it, I would be very thankful.

SGSSGene avatar Apr 07 '19 16:04 SGSSGene

~/.manpath takes precedence over other man pages. For example manpath returns /home/joshua/.node/share/man:/home/joshua/.local/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man on my machine. $MANPATH is unset and ~/.manpath contains MANDATORY_MANPATH /home/joshua/.local/share/man.

I would like ~/.manpath not to take precedence. Maybe run manpath and append ~/.local/share/man to the end of that.

jyn514 avatar Apr 07 '19 20:04 jyn514

I have finally been able to reproduce it. The program manpath does a lot of magic. I looked into the source code to understand precisely what is being done in which order, but now I am more confused than ever. (Also it reassures me that C++ is the simpler language to read ;-) ).

What I am certain about is, that the different results come from the $PATH variable, which is being processed in manpath. On one of my systems $PATH is set to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin On the other system it is set to /home/q/bin:/home/q/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

The important part is the extra /home/q/.local/bin on one system compared to the other one. manpath checks all paths in $PATH extended by ".", "../man" and "../share/man", which leads to finding /home/q/.local/share/man much earlier and setting it at the beginning of the results. While on the other system where /home/q/.local/bin is not present, it will be added much later in the process.

This also means manpath will find the cppman pages on your system independently of the entry in ~/.manpath. I don't know how to deal with this issue.

SGSSGene avatar Apr 08 '19 08:04 SGSSGene

To begin with, I suggest using 3cpp as prefix instead of 3 to distinguish cpp pages. This should help with overriding pages.

Now, whatever cppman -m true is supposed to do, it doesn't, because the output of manpath stays the same. So I set it manually in shellrc: export MANPATH="$(manpath -g):$HOME/.cache/cppman". I suggest adding this to readme.

ghost avatar Aug 16 '20 23:08 ghost

I cant confirm the bug on an Arch derivate from executing :Man inside neovim. Instead I get the autogenerated template pages loading.

matu3ba avatar Feb 10 '21 09:02 matu3ba