fix(nushell/windows): Fix $env.PATH getting converted to a string#6157
Merged
fix(nushell/windows): Fix $env.PATH getting converted to a string#6157
Conversation
This addresses the issue in discussion jdx#5472. Mise on nushell on windows doesn't properly convert the path to a nushell-native list. Most of the time this works fine, as long as the path stays a string. However, if anything else adds a value to the path (like manually activating a python venv), you end up with a list of 2 items: the big, `;` delimited string that was $env.PATH, and one entry for whatever was just added (now the only valid item in the path list). The problem comes from this function in the activate script: ```nu def --env "update-env" [] { # ... if $var.name == 'PATH' { $env.PATH = ($var.value | split row (char esep)) } else { # ... } ``` $env.PATH is case-insensitive in nushell [1] (actually, all environment variables are, regardless of OS [2]). Mise matches whatever capitalization is in use at run time [3], which for windows is `Path`. For the sake of the update hook though, in case something changes the capitalization of `$env.PATH` between activating mise and some later run of the hook, it's probably just better to do this comparison in a case-insensitive way. [1]: https://www.nushell.sh/book/configuration.html#path-configuration [2]: https://www.nushell.sh/book/environment.html#case-sensitivity [3]: https://github.com/jdx/mise/blob/b7583ea9cc43c78e60d044640d149958e71261e4/src/env.rs#L225C1-L231C4
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where mise's nushell integration on Windows doesn't properly handle the PATH environment variable when it has different capitalization. The fix ensures that PATH comparison is case-insensitive by converting the variable name to uppercase before comparison.
- Implements case-insensitive PATH comparison in the nushell update-env function
- Updates both the source code and corresponding test snapshot
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/shell/nushell.rs | Updates the PATH comparison to be case-insensitive using str upcase |
| src/shell/snapshots/mise__shell__nushell__tests__hook_init.snap | Updates test snapshot to reflect the case-insensitive PATH comparison |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
jdx
pushed a commit
that referenced
this pull request
Sep 5, 2025
### 🚀 Features - allow set/unset backend aliases by [@roele](https://github.com/roele) in [#6172](#6172) ### 🐛 Bug Fixes - **(aqua)** respect order of asset_strs by [@risu729](https://github.com/risu729) in [#6143](#6143) - **(java)** treat freebsd as linux (assuming linux compatability) by [@roele](https://github.com/roele) in [#6161](#6161) - **(nushell/windows)** Fix $env.PATH getting converted to a string by [@zackyancey](https://github.com/zackyancey) in [#6157](#6157) - **(sync)** create uv_versions_path dir if it doesn't exist by [@risu729](https://github.com/risu729) in [#6142](#6142) - **(ubi)** show relevent error messages for v-prefixed tags by [@risu729](https://github.com/risu729) in [#6183](#6183) - remove nodejs/golang alias migrate code by [@risu729](https://github.com/risu729) in [#6141](#6141) ### 📚 Documentation - **(task)** remove word "additional" to avoid confusions by [@risu729](https://github.com/risu729) in [#6159](#6159) ### Chore - update Cargo.lock by [@risu729](https://github.com/risu729) in [#6184](#6184) ### New Contributors - @zackyancey made their first contribution in [#6157](#6157)
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Sep 8, 2025
## [2025.9.5](https://github.com/jdx/mise/compare/v2025.9.4..v2025.9.5) - 2025-09-06 ### 🚀 Features - **(task)** add timeout support for task execution by @jdx in [#6216](jdx/mise#6216) - **(task)** sub-tasks in run lists by @jdx in [#6212](jdx/mise#6212) ### Chore - fix npm publish action by @jdx in [14f4b09](jdx/mise@14f4b09) - fix cloudflare release action by @jdx in [00afa25](jdx/mise@00afa25) - fix git-cliff for release notes by @jdx in [15a9aed](jdx/mise@15a9aed) ## [2025.9.4](https://github.com/jdx/mise/compare/v2025.9.3..v2025.9.4) - 2025-09-06 ### Chore - fix git-cliff on release by @jdx in [3c388f2](jdx/mise@3c388f2) ## [2025.9.3](https://github.com/jdx/mise/compare/v2025.9.2..v2025.9.3) - 2025-09-06 ### 🚀 Features - **(backend)** improve http error when platform url missing; list available platforms by @jdx in [#6200](jdx/mise#6200) - **(cli)** support scoped packages for all backend types by @earlgray283 in [#6213](jdx/mise#6213) - **(http)** add URL replacement feature for HTTP requests by @ThomasSteinbach in [#6207](jdx/mise#6207) ### 🐛 Bug Fixes - **(backend)** preserve arch underscores in platform keys by @jdx in [#6202](jdx/mise#6202) - **(task)** resolve hanging issue with multiple depends_post by @jdx in [#6206](jdx/mise#6206) - couldn't download node binary in Alpine, even if it exists in the mirror url by @Hazer in [#5972](jdx/mise#5972) - **breaking** use config_root for env._.path by @jdx in [#6204](jdx/mise#6204) - bugfix for paths that include spaces by @karim-elkholy in [#6210](jdx/mise#6210) ### 📚 Documentation - improve release notes generation by @jdx in [#6197](jdx/mise#6197) - fix release changelog contributor reporting by @jdx in [#6201](jdx/mise#6201) ### Chore - use fine-grained gh token by @jdx in [#6208](jdx/mise#6208) - use settings.local.json for claude config by @jdx in [fd0fba9](jdx/mise@fd0fba9) ### New Contributors - @ThomasSteinbach made their first contribution in [#6207](jdx/mise#6207) - @earlgray283 made their first contribution in [#6213](jdx/mise#6213) - @karim-elkholy made their first contribution in [#6210](jdx/mise#6210) - @Hazer made their first contribution in [#5972](jdx/mise#5972) ## [2025.9.2](https://github.com/jdx/mise/compare/v2025.9.1..v2025.9.2) - 2025-09-05 ### 🐛 Bug Fixes - **(ci)** set required environment variables for npm publishing by @jdx in [#6189](jdx/mise#6189) - **(release)** clean up extra newlines in release notes formatting by @jdx in [#6190](jdx/mise#6190) - **(release)** add proper newline after New Contributors section in cliff template by @jdx in [#6194](jdx/mise#6194) - **(release)** fix changelog formatting to remove extra blank lines by @jdx in [#6195](jdx/mise#6195) - **(release)** restore proper newline after New Contributors section by @jdx in [#6196](jdx/mise#6196) ### 🚜 Refactor - **(ci)** split release workflow into separate specialized workflows by @jdx in [#6193](jdx/mise#6193) ### Chore - **(release)** require GitHub Actions environment for release-plz script by @jdx in [#6191](jdx/mise#6191) ## [2025.9.1](https://github.com/jdx/mise/compare/v2025.9.0..v2025.9.1) - 2025-09-05 ### 🐛 Bug Fixes - python nested venv path order by @elvismacak in [#6124](jdx/mise#6124) - resolve immutable release workflow and VERSION file timing issues by @jdx in [#6187](jdx/mise#6187) ### New Contributors - @elvismacak made their first contribution in [#6124](jdx/mise#6124) ## [2025.9.0](https://github.com/jdx/mise/compare/v2025.8.21..v2025.9.0) - 2025-09-05 ### 🚀 Features - allow set/unset backend aliases by @roele in [#6172](jdx/mise#6172) ### 🐛 Bug Fixes - **(aqua)** respect order of asset_strs by @risu729 in [#6143](jdx/mise#6143) - **(java)** treat freebsd as linux (assuming linux compatability) by @roele in [#6161](jdx/mise#6161) - **(nushell/windows)** Fix $env.PATH getting converted to a string by @zackyancey in [#6157](jdx/mise#6157) - **(sync)** create uv_versions_path dir if it doesn't exist by @risu729 in [#6142](jdx/mise#6142) - **(ubi)** show relevent error messages for v-prefixed tags by @risu729 in [#6183](jdx/mise#6183) - remove nodejs/golang alias migrate code by @risu729 in [#6141](jdx/mise#6141) - mise activate not working on powershell v5 by @L0RD-ZER0 in [#6168](jdx/mise#6168) ### 📚 Documentation - **(task)** remove word "additional" to avoid confusions by @risu729 in [#6159](jdx/mise#6159) ### Chore - update Cargo.lock by @risu729 in [#6184](jdx/mise#6184) ### New Contributors - @zackyancey made their first contribution in [#6157](jdx/mise#6157)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses the issue in discussion #5472.
Mise on nushell on windows doesn't properly convert the path to a nushell-native list. Most of the time this works fine, as long as the path stays a string. However, if anything else adds a value to the path (like manually activating a python venv), you end up with a list of 2 items: the big,
;delimited string that was $env.PATH, and one entry for whatever was just added (now the only valid item in the path list).The problem comes from this function in the activate script:
$env.PATHis case-insensitive in nushell 1 (actually, all environment variables are, regardless of OS 2). Mise matches whatever capitalization is in use at run time 3, which for windows isPath. For the sake of the update hook though, in case something changes the capitalization of$env.PATHbetween activating mise and some later run of the hook, it's probably just better to do this comparison in a case-insensitive way.