Giter Site home page Giter Site logo

Comments (14)

sjackman avatar sjackman commented on July 18, 2024

Thanks for the tip! I'll move the colon to the end. I think that has a similar effect but will give priority to Linuxbrew man pages.

from brew.

sjackman avatar sjackman commented on July 18, 2024

Fixed. Thanks for the bug report!

from brew.

rwhogg avatar rwhogg commented on July 18, 2024

I've filed a PR (shown right above this comment) to also fix this in the installation script.

from brew.

azrdev avatar azrdev commented on July 18, 2024

Thanks for the tip! I'll move the colon to the end. I think that has a similar effect but will give priority to Linuxbrew man pages.

This seems to do exactly as you wish.

Thx for fixing!

from brew.

maxim-belkin avatar maxim-belkin commented on July 18, 2024

I'm not sure I understand the problem. Let's have a look at what the default export statement (export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH") does in the two possible situations.

(1) MANPATH is empty.
Then MANPATH="$HOME/.linuxbrew/share/man: — that is with the desired colon at the end.

(2) MANPATH is not empty.
Then MANPATH="$HOME/.linuxbrew/share/man:$MANPATH, that is linuxbrew's path is prepended to whatever MANPATH has been previously set.

So, I'm not sure that this change is necessary.

from brew.

sjackman avatar sjackman commented on July 18, 2024

@azrdev Please report…

echo x"$MANPATH"x
echo x"$HOME/.linuxbrew/share/man:$MANPATH"x

from brew.

azrdev avatar azrdev commented on July 18, 2024

You're right, I didn't consider the case when MANPATH is empty before. However, a MANPATH starting or ending with :: seems to yield the same result as (the standard) single :.

(2) MANPATH is not empty.
Then MANPATH="$HOME/.linuxbrew/share/man:$MANPATH, that is linuxbrew's path is prepended to whatever MANPATH has been previously set.

We need the colon at one end, for system manpages to be considered (see http://askubuntu.com/a/693612). You're assuming here whoever might have set MANPATH before should have appended the colon at the end, so brew shouldn't care about doing it?

from brew.

maxim-belkin avatar maxim-belkin commented on July 18, 2024

Users can set MANPATH so we have no right to assume that what they did with it was wrong or unintentional. Previous behavior was correct because it was only adding Linuxbrew's manpath, it was not overriding it.

from brew.

sjackman avatar sjackman commented on July 18, 2024

@azrdev Do you have an example where the previous code did not have the expected or desired behaviour?

from brew.

azrdev avatar azrdev commented on July 18, 2024

@sjackman quoting from my first comment here:

The README says you should add to your profile export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
This makes all the previous manual pages inaccessible

Actually, this is correct for both cases: (1) previously empty -> colon at the end. (2) previously set correctly (with colon at the end) -> still colon at the end.

The case it breaks is if it previously had a colon (only) at the beginning, or none at all. This might be intended by the user, but I assume most users expect less complexity. I was confused when setting MANPATH did hide the system files, even though the default value was empty. So at least a warning & explanation would be helpful at this point.

from brew.

maxim-belkin avatar maxim-belkin commented on July 18, 2024

When colon is at the beginning of MANPATH, the end result of the previous change would be:
MANPATH=$HOME/.linuxbrew/share/man::OTHER:PATHS. Note the two colons there. Because environment variables are split based on colons, this MANPATH means that the following directories are included:

  1. $HOME/.linuxbrew/share/man
  2. <empty>
  3. OTHER
  4. PATHS

The second (<empty>) directory makes sure that default man pages are searched.

from brew.

sjackman avatar sjackman commented on July 18, 2024

Hi, @azrdev. I'm not able to duplicate the failure that you describe with a colon only at the beginning. Can you please give an exact example? The following works for me.

$ export MANPATH=:$HOME/man
$ echo $MANPATH
:/home/sjackman/man
$ man -w ab # some man page provided by host but not by Linuxbrew
/usr/share/man/man1/ab.1.gz
$ MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
$ echo $MANPATH
/home/sjackman/.linuxbrew/share/man::/home/sjackman/man
$ man -w ab
/usr/share/man/man1/ab.1.gz

So as Maxim points out, you can have a colon at the beginning or at the end, or a double colon in the middle, and it will still search the system MANPATH.

from brew.

azrdev avatar azrdev commented on July 18, 2024

So as Maxim points out, you can have a colon at the beginning or at the end, or a double colon in the middle, and it will still search the system MANPATH.

Confirmed by looking at man 1 manpath, so I was wrong again. I didn't know, just relied on said askubuntu link. :)

As it stands there was never a bug, only a pitfall we could (imho should) warn the user of.

from brew.

sjackman avatar sjackman commented on July 18, 2024

No worries. Glad we sorted it out. I've reverted both commits (brew and install).

from brew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.