fix: keep PATH exports on their own line when assembling shell-env.sh - #3166
Arshgill01 wants to merge 1 commit into
Conversation
🔍 Suggested ReviewersBased on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:
Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏 This comment was automatically generated by git-blame-auto-reviewer Last updated: 2026-09-30T04:38:50.497Z |
85f7fc2 to
a4c30be
Compare
05a29c5 to
1ed807d
Compare
|
Rebased onto latest |
4a2ea2c to
05c3e95
Compare
Still ready for review (bundled)Gentle weekly nudge — still no maintainer feedback on the open Arshgill01 set. All MERGEABLE (rebasing onto latest
Happy to address review feedback on any of them. |
923a6de to
5a93f70
Compare
5a93f70 to
fcd7cc4
Compare
trim_end() stripped the newline after eval "${shellHook:-}", so the first
task export (for example Python venv PATH) was glued onto that line. Bash
then consumed the quotes and word-split PATH at spaces, printing
"not a valid identifier" and dropping the rest of PATH.
Fixes cachix#3165
Co-authored-by: Arshdeep singh <arshgill6120@gmail.com>
fcd7cc4 to
9b9f76c
Compare
Fixes #3165.
When Python venv (or any enterShell task) re-exports
PATHand the parentPATHcontains a directory with a space,devenv shellprintedbash: export: … not a valid identifierand truncatedPATHat the first space.prepare_shelltrims the Nix env script withtrim_end(), which removes the newline aftereval "${shellHook:-}". Task exports were then appended with no separator, so the firstexport PATH='…'landed on the same physical line. Outer bash consumed the quotes;evalword-split the PATH value at spaces.Changes
push_shell_fragment, which inserts a newline before appending a non-empty fragment.prepare_shell, PTY/reloadshell-env.sh, direnv export).Tests
Some App, assert the export is on its own line, thenbashthe result and check PATH is not truncated.tests/shell-path-spaces— PATH with a space + a venv-like enterShell PATH export;--shell zshwrites.devenv/shell-env.sh(the glued assembly) anddevenv shell --covers the non-interactive path.No competing open PR for #3165.
Test plan
eval "${shellHook:-}"export PATH='…Some App…'producesnot a valid identifierand truncates PATH; with a newline separator, bash sources cleanly and PATH keeps the space-containing dir.cargo nextest run -p devenv trimmed_shell_env push_shell_fragmentdevenv-run-tests run tests --only shell-path-spacesPATH="/tmp/Some App/bin:$PATH" devenv shellin a project withlanguages.python.venv.enable = true— no export errors,echo "$PATH"still containsSome App.