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

PATH updating seems a bit dodgy #1380

Closed
defhacks opened this issue Jan 6, 2024 · 1 comment · Fixed by #1400
Closed

PATH updating seems a bit dodgy #1380

defhacks opened this issue Jan 6, 2024 · 1 comment · Fixed by #1400

Comments

@defhacks
Copy link
Contributor

defhacks commented Jan 6, 2024

Describe the bug
relative or unqualified paths to mise alter $PATH unexpectedly

To Reproduce

Confirmed behaviour in both bash/zsh

relative paths yield an interesting result:

% ./mise activate zsh| grep PATH
export PATH=".:$PATH"
export __MISE_ORIG_PATH="$PATH"

but possibly more subtle and concerning is this case:

% mise activate zsh | grep PATH
export PATH=":$PATH"
export __MISE_ORIG_PATH="$PATH"

I was surprised to that both bash/zsh seem to interpret the empty string entry being pre-pended to $PATH here as adding the current working directory to $PATH.

I would propose patches to fix, but when I modified my local copy to prevent this behavior, I saw a comment about direnv, which I don't really use so I thought I'd just kick off the discussion rather than propose something that causes grief to direnv users.

@jdx
Copy link
Owner

jdx commented Jan 6, 2024

do you have experimental enabled? that actually goes down a completely different code path (see #863 if you're curious what)

I'm not sure if that's related off the top of my head, but knowing that will help me know where to look.

I would very much appreciate some help with this particular part of the codebase btw. That code is a combination of a few things:

  • it's old and since this is my first rust project, poorly written
  • it's really hard to understand what it should be doing. It's heavily based on state.
  • as a result of both, when I've made modifications I haven't taken a step back to refactor it very much, just adding bits of what I need

so it's a little bit of a train wreck—certainly the worst (but arguably most important) part of the codebase. I may have scared you off, but some fresh eyes might have some good ideas.

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 a pull request may close this issue.

2 participants