Skip to content

nvm.sh can clobber MANPATH, by stripping trailing colon #3144

@oliverhenshaw

Description

@oliverhenshaw

nvm current output:

system

How did you install nvm?

Install script

What steps did you perform?

After installing nvm from the install script, man pages stop working
$ man top
No manual entry for top

This is because I have MANPATH="/usr/share/lmod/lmod/share/man:" but nvm.sh changes this to MANPATH="/usr/share/lmod/lmod/share/man", i.e. drops the trailing colon.

From the Posix man page for manpath:

If $MANPATH is set, manpath displays its value rather than determining it on the fly. If $MANPATH is prefixed by a colon, then the value of the variable is appended to the list determined from the content of the configuration files. If the colon comes at the end of the value in the variable, then the determined list is appended to the content of the variable. If the value of the variable contains a double colon (::), then the determined list is inserted in the middle of the value, between the two colons.

so that

$ MANPATH=/usr/share/lmod/lmod/share/man: manpath -d
From the config file /etc/man_db.conf:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Added sections: `1', `1p', `8', `2', `3', `3p', `3pm', `4', `5', `6', `7', `9', `0p', `n', `l', `p', `o', `1x', `2x', `3x', `4x', `5x', `6x', `7x', `8x'.
manpath: warning: $MANPATH set, appending /etc/man_db.conf
path directory /home/watcher/.cargo/bin is not in the config file
path directory /home/watcher/.local/bin is not in the config file
path directory /home/watcher/bin is not in the config file
path directory /usr/lib64/qt-3.3/bin is not in the config file
path directory /usr/local/bin is in the config file
warning: /usr/local/man: No such file or directory
  adding /usr/local/share/man to manpath
path directory /usr/bin is in the config file
  adding /usr/share/man to manpath
path directory /bin is in the config file
path directory /usr/local/sbin is in the config file
warning: /usr/local/man: No such file or directory
path directory /usr/sbin is in the config file
adding mandatory man directories
warning: /usr/man: No such file or directory
/usr/share/lmod/lmod/share/man:/usr/local/share/man:/usr/share/man
$ MANPATH=/usr/share/lmod/lmod/share/man manpath -d
From the config file /etc/man_db.conf:
  Mandatory mandir `/usr/man'.
  Mandatory mandir `/usr/share/man'.
  Mandatory mandir `/usr/local/share/man'.
  Path `/bin' mapped to mandir `/usr/share/man'.
  Path `/usr/bin' mapped to mandir `/usr/share/man'.
  Path `/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/sbin' mapped to mandir `/usr/share/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
  Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
  Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
  Path `/usr/games' mapped to mandir `/usr/share/man'.
  Path `/opt/bin' mapped to mandir `/opt/man'.
  Path `/opt/sbin' mapped to mandir `/opt/man'.
  Global mandir `/usr/man', catdir `/var/cache/man/fsstnd'.
  Global mandir `/usr/share/man', catdir `/var/cache/man'.
  Global mandir `/usr/local/man', catdir `/var/cache/man/oldlocal'.
  Global mandir `/usr/local/share/man', catdir `/var/cache/man/local'.
  Global mandir `/usr/X11R6/man', catdir `/var/cache/man/X11R6'.
  Global mandir `/opt/man', catdir `/var/cache/man/opt'.
  Added sections: `1', `1p', `8', `2', `3', `3p', `3pm', `4', `5', `6', `7', `9', `0p', `n', `l', `p', `o', `1x', `2x', `3x', `4x', `5x', `6x', `7x', `8x'.
manpath: warning: $MANPATH set, ignoring /etc/man_db.conf
/usr/share/lmod/lmod/share/man

After some investigation, it looks like the shell function nvm_strip_path is the part responsible for discarding the trailing colon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions