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

Consider setting XDG_DATA_DIRS in shellenv on Linux #18317

Closed
1 task done
notfirefox opened this issue Sep 12, 2024 · 1 comment · Fixed by #18326
Closed
1 task done

Consider setting XDG_DATA_DIRS in shellenv on Linux #18317

notfirefox opened this issue Sep 12, 2024 · 1 comment · Fixed by #18326
Labels
features New features help wanted We want help addressing this

Comments

@notfirefox
Copy link
Contributor

notfirefox commented Sep 12, 2024

Verification

Provide a detailed description of the proposed feature

It would be nice if the command below would set up everything needed on Linux.

$ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

It does however not configure $XDG_DATA_DIRS as shown below.

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Homebrew's share was not found in your XDG_DATA_DIRS but you have
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
Consider adding Homebrew's share directory to XDG_DATA_DIRS like so:
  echo 'export XDG_DATA_DIRS="/home/linuxbrew/.linuxbrew/share:$XDG_DATA_DIRS"' >> ~/.zshrc

The suggestion would be to let the shellenv script also handle the $XDG_DATA_DIRS environment variable, e.g.

if [ -n "$XDG_DATA_DIRS" ]; then
    export XDG_DATA_DIRS="/home/linuxbrew/.linuxbrew/share:$XDG_DATA_DIRS"
fi

What is the motivation for the feature?

The shellenv script is there to assist the user with the setup of the shell environment. Therefore it might be sensible to also let it handle the $XDG_DATA_DIRS environment variable.

How will the feature be relevant to at least 90% of Homebrew users?

This feature only affects Homebrew users on Linux.

What alternatives to the feature have been considered?

Keeping the situation as it is, i.e. not setting $XDG_DATA_DIRS in the shellenv script.

@notfirefox notfirefox added the features New features label Sep 12, 2024
@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Sep 12, 2024
@MikeMcQuaid
Copy link
Member

This could be set as long as it's Linux-only 👍🏻

notfirefox added a commit to notfirefox/brew-fork that referenced this issue Sep 16, 2024
Some programs like `vapigen` might not work correctly, when `XDG_DATA_DIRS`
does not include `$HOMEBREW_PREFIX/share`. Instead of requiring the user
to manually adjust the shell environment, we can set `XDG_DATA_DIRS` as
part of `cmd/shellenv`, so that it is sufficient to run `brew shellenv`
on any particular system.

Fixes Homebrew#18317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New features help wanted We want help addressing this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants