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

Only add Nix paths to $PATH if not already in there #9297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kra-mo
Copy link

@kra-mo kra-mo commented Nov 5, 2023

Motivation

This fixes the paths being added multiple times if the user logs out and back in

Add 👍 to pull requests you find important.

@kra-mo kra-mo requested a review from edolstra as a code owner November 5, 2023 12:42
@abathur
Copy link
Member

abathur commented Nov 5, 2023

I'm not sure it's documented, but my interpretation is that both of these profile scripts are intended to be POSIX sh.

IIRC [[ is a ksh/bash-ism, and in turn I think =~ is supported by [[.

I have a draft PR open that uses case to make an equivalent change because a tester gave feedback that mentioned this appending issue:

It isn't a given that my PR will move ahead at all, so it's fine with me if you'd like to try to cherry-pick that bit and land it in this PR.

When people source the Nix profile scripts more than once,
they can cause appended PATH variables to grow longer each
time. This is somewhat benign, but it does spook people and
cause support load.

(cherry picked from commit cc5db08)
@kra-mo
Copy link
Author

kra-mo commented Nov 9, 2023

Thanks, I cherry-picked that commit instead.

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

Successfully merging this pull request may close these issues.

2 participants