Skip to content
New issue

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

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

Already on GitHub? # to your account

shellenv: prepend colon to MANPATH if set #17633

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

gromgit
Copy link
Contributor

@gromgit gromgit commented Jul 5, 2024

The current appended colon means system man pages always shadow Homebrew's. There's also no point adding Homebrew's man dir, nor filling out an empty MANPATH, since man and friends will add the necessary dirs according to PATH.

Closes Homebrew/homebrew-core#176037.

Also fixed a syntax error in the *csh INFOPATH setting.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@gromgit
Copy link
Contributor Author

gromgit commented Jul 5, 2024

I've not touched fish, because (if I understand it correctly) it auto-constructs colon-delimited values from the lists contained in all variables whose names end in PATH.

Also need help fixing the PowerShell code, which I have no experience with.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gromgit! @Homebrew/maintainers can someone help out with Powershell and review Fish here?

Copy link
Member

@SMillerDev SMillerDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and in my understanding this isn't applicable to fish.

@gromgit gromgit force-pushed the shellenv/fix_manpath branch from 7e638f0 to df5dbac Compare July 5, 2024 09:30
@gromgit
Copy link
Contributor Author

gromgit commented Jul 5, 2024

@jpawlowski, as the original author of the PowerShell shellenv code, can you advise on the necessary changes (do nothing if MANPATH not set, add colon at start if it is set)? Thanks much!

The current appended colon means system man pages always shadow
Homebrew's. There's also no point adding Homebrew's man dir, nor
filling out an empty MANPATH, since `man` and friends will add the
necessary dirs according to PATH.

Closes Homebrew/homebrew-core#176037.

Also fixed a syntax error in the `*csh` INFOPATH setting.
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @gromgit! Powershell can be a follow-up.

@MikeMcQuaid MikeMcQuaid merged commit 07b6b71 into Homebrew:master Jul 8, 2024
25 checks passed
@jeremy
Copy link

jeremy commented Jul 9, 2024

When MANPATH is not set, this now triggers an unbound variable error in Bash shells with set -eu:

bash -eu -c 'unset MANPATH; eval "$(/opt/homebrew/bin/brew shellenv)"'
bash: line 5: MANPATH: unbound variable

Could use e.g.

echo "export MANPATH=\${MANPATH+:}:${MANPATH#:}${HOMEBREW_PREFIX}/share/man;"

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

Successfully merging this pull request may close these issues.

Symbolic link from man to gnuman, etc. does not work
4 participants