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

The man command cannot find the manual for software after adding the path of the bin directory to the environment variable $PATH. #4522

Open
wit-l opened this issue Apr 8, 2024 · 15 comments
Labels

Comments

@wit-l
Copy link

wit-l commented Apr 8, 2024

eg. When I add the directory /opt/nvim/bin to $PATH, the command "man -w nvim" can't find it, even the nvim/share/man/man1/nvim.1 exists.
image

@Biswa96
Copy link
Member

Biswa96 commented Apr 8, 2024

Would it be possible to use msys2 as explain in msys2.org page? Why do you want to add paths in PATH environment variable?

@wit-l
Copy link
Author

wit-l commented Apr 8, 2024

Would it be possible to use msys2 as explain in msys2.org page? Why do you want to add paths in PATH environment variable?

Because I want to use nvim anywhere.

@wit-l
Copy link
Author

wit-l commented Apr 8, 2024

Would it be possible to use msys2 as explain in msys2.org page? Why do you want to add paths in PATH environment variable?

This nvim's version is 0.10.0. It can't be installed with pacman.

@wit-l
Copy link
Author

wit-l commented Apr 8, 2024

image
The launch method is as follows
image

@rimrul
Copy link
Contributor

rimrul commented Apr 8, 2024

eg. When I add the directory /opt/nvim/bin to $PATH, the command "man -w nvim" can't find it, even the nvim/share/man/man1/nvim.1 exists. image

I might be missreading manpath(5), but it looks to me like nvim.1 should be directly in nvim/share/man/

@wit-l
Copy link
Author

wit-l commented Apr 8, 2024

eg. When I add the directory /opt/nvim/bin to $PATH, the command "man -w nvim" can't find it, even the nvim/share/man/man1/nvim.1 exists. image

I might be missreading manpath(5), but it looks to me like nvim.1 should be directly in nvim/share/man/

I didn‘t change the path of nvim.1. This was downloaded from the official repository of Neovim on GitHub. After adding neovim/bin to $PATH on Linux(ubuntu), using “man nvim” allows me to find nvim.1 located in the share/man/man1 directory.
Man is classified. You can check your /usr/share, which contains man1, man2...man8, and the nvim.1 here belongs to the first category: executable programs or shell commands, so the location of nvim.1 here is very standard. You can take a look here for explanations of various man pages.

@wit-l
Copy link
Author

wit-l commented Apr 8, 2024

eg. When I add the directory /opt/nvim/bin to $PATH, the command "man -w nvim" can't find it, even the nvim/share/man/man1/nvim.1 exists. image

I might be missreading manpath(5), but it looks to me like nvim.1 should be directly in nvim/share/man/

I didn‘t change the path of nvim.1. This was downloaded from the official repository of Neovim on GitHub. After adding neovim/bin to $PATH on Linux, using “man nvim” allows me to find nvim.1 located in the share/man/man1 directory. Man is classified. You can check your /usr/share, which contains man1, man2...man8, and the nvim.1 here belongs to the first category: executable programs or shell commands, so the location of nvim.1 here is very standard. You can take a look here for explanations of various man pages.

When the bin environment variable is added, there is no need to manually include the path of nvim.1 in $MANPATH. On Linux(ubuntu), the man command will automatically search for nvim.1 in the share/man/man1 directory at the same level as bin.

@rimrul
Copy link
Contributor

rimrul commented Apr 8, 2024

I might be missreading manpath(5), but it looks to me like nvim.1 should be directly in nvim/share/man/

I didn‘t change the path of nvim.1. This was downloaded from the official repository of Neovim on GitHub. After adding neovim/bin to $PATH on Linux, using “man nvim” allows me to find nvim.1 located in the share/man/man1 directory. Man is classified. You can check your /usr/share, which contains man1, man2...man8, and the nvim.1 here belongs to the first category: executable programs or shell commands, so the location of nvim.1 here is very standard. You can take a look here for explanations of various man pages.

When the bin environment variable is added, there is no need to manually include the path of nvim.1 in $MANPATH. On Linux, the man command will automatically search for nvim.1 in the share/man/man1 directory at the same level as bin.

I'm not talking about modifying $MANPATH. I'm talking about the search behaviour described on the man page.

By default, man-db examines the user's $PATH. For each path_element found there, it adds manpath_element to the search path. If there is no MANPATH_MAP line in the configuration file for a given path_element, then it adds all of path_element/../man, path_element/man, path_element/../share/man, and path_element/share/man that exist as directories to the search path.

That reads to me like it finds /opt/nvim/bin on $PATH and searches /opt/nvim/bin/../man, /opt/nvim/bin/man, /opt/nvim/bin/../share/man and /opt/nvim/bin/share/man, but it doesn't mention any sub directories.

Looking at a linux machine the sub directories seem to be correct, though.

@Biswa96
Copy link
Member

Biswa96 commented Apr 8, 2024

The following command work in my case.

 export MANPATH=/f/myfiles/nvim-win64/share/man:$MANPATH

neovim extracted in /f/myfiles/nvim-win64 directory. It was downloaded from https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip

@wit-l
Copy link
Author

wit-l commented Apr 8, 2024

The following command work in my case.

 export MANPATH=/f/myfiles/nvim-win64/share/man:$MANPATH

neovim extracted in /f/myfiles/nvim-win64 directory. It was downloaded from https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip

If it’s necessary to individually add the man directory to the MANPATH for each software installation, it would be too cumbersome. It would be great if the man command in msys2 could behave like it does in Ubuntu, where simply adding nvim/bin to the PATH would allow it to find nvim.1 located in nvim/share/man/man1.

@Biswa96
Copy link
Member

Biswa96 commented Apr 8, 2024

Unsetting MANPATH variable brings back the default behavior that you mentioned.

@wit-l
Copy link
Author

wit-l commented Apr 9, 2024

Unsetting MANPATH variable brings back the default behavior that you mentioned.

Thanks. Simply comment out the assignment to MANPATH in /etc/profile.

@wit-l
Copy link
Author

wit-l commented Apr 9, 2024

That reads to me like it finds /opt/nvim/bin on $PATH and searches /opt/nvim/bin/../man, /opt/nvim/bin/man, /opt/nvim/bin/../share/man and /opt/nvim/bin/share/man, but it doesn't mention any sub directories.

Looking at a linux machine the sub directories seem to be correct, though.

Here, ‘bin’ is an abbreviation for ‘binary,’ but manual files are not binary files. Therefore, I believe we can exclude the possibility of manuals being stored in the ‘bin’ directory.

@Biswa96
Copy link
Member

Biswa96 commented Apr 9, 2024

This should be fixed in filesystem package in msys2-packages. Migrating the issue...

@Biswa96 Biswa96 transferred this issue from msys2/msys2.github.io Apr 9, 2024
@Biswa96 Biswa96 added the bug label Apr 9, 2024
@wit-l wit-l closed this as completed Apr 9, 2024
@Biswa96
Copy link
Member

Biswa96 commented Apr 9, 2024

Not completed...

@Biswa96 Biswa96 reopened this Apr 9, 2024
@wit-l wit-l closed this as completed Apr 9, 2024
@wit-l wit-l reopened this Apr 9, 2024
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

3 participants