Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overwrite existing manpages with -m true #98

Open
jyn514 opened this issue Apr 3, 2019 · 8 comments
Open

Don't overwrite existing manpages with -m true #98

jyn514 opened this issue Apr 3, 2019 · 8 comments
Labels

Comments

@jyn514
Copy link

jyn514 commented Apr 3, 2019

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
Copy link
Author

jyn514 commented Apr 3, 2019

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

@aitjcize
Copy link
Owner

aitjcize commented Apr 7, 2019

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.

@jyn514
Copy link
Author

jyn514 commented Apr 7, 2019

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

@SGSSGene
Copy link
Collaborator

SGSSGene commented Apr 7, 2019

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.

@jyn514
Copy link
Author

jyn514 commented Apr 7, 2019

~/.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.

@SGSSGene
Copy link
Collaborator

SGSSGene commented Apr 8, 2019

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 SGSSGene added the Bug label Apr 13, 2019
@ghost
Copy link

ghost commented Aug 16, 2020

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.

@matu3ba
Copy link

matu3ba commented Feb 10, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants