-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
zsh: fix trailing slash breaking zshenv #7846
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
base: master
Are you sure you want to change the base?
Conversation
|
If someone could guide me on writing tests for this I would appreciate it. I only see tests testing the output of the module and not any unit tests. |
A trailing slash in user.users.<user>.home broke zshenv setup in Home Manager. The generated ~/.zshenv ended up sourcing itself, causing an infinite loop at shell startup.
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
| in | ||
| rec { | ||
| homeDir = config.home.homeDirectory; | ||
| homeDir = cleanPathStr config.home.homeDirectory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you possibly add a test case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm just realized I missed this PR a while ago and you had a comment about not knowing how to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting back to me on this. I'd happily add test cases if you could point me to an example or documentation. Let me know if you'd still like to get this merged. 😁
I tried looking for other examples and documentation but couldn't figure it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was playing around with tests and found some other cases to solve for. Just gonna push to a new branch and can you verify it works for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
If a user has a trailing
/in theiruser.users.<user>.homevalue with the zsh enabled the module fails to properly check the equality of dotDir and the home path.The libs.nix module is stripping the trailing
/from thedotDirAbsanddotDirReland not for homeDir.You can see the how the values are evaluated by running this script:
@lzpreslav actually mentioned this on the PR a few months back.
#6089 (comment)
Relevant LOC:
https://github.com/nix-community/home-manager/blob/master/modules/programs/zsh/lib.nix#L6
https://github.com/nix-community/home-manager/blob/master/modules/programs/zsh/lib.nix#L69
https://github.com/nix-community/home-manager/blob/master/modules/programs/zsh/lib.nix#L99-L100
https://github.com/nix-community/home-manager/blob/master/modules/programs/zsh/default.nix#L415
Checklist
Change is backwards compatible.
Code formatted with
nix fmtornix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.Code tested through
nix run .#tests -- test-allornix-shell --pure tests -A run.all.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.