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

[bug]: Completion symlinks being linked as absolute real paths can break when home is shared (NFS) and symlinked from different mounts #677

Open
1 task done
danielkza opened this issue Nov 1, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@danielkza
Copy link

danielkza commented Nov 1, 2024

What happened?

When setting up zinit in a home directory in an NFS server, that is mounted in different machines in different directories then symlinked to /home, the links in the completions directory will be broken, because they will be absolute and resolved to real paths:

For example:

$ ls ~/.local/share/zinit/completions | grep _scala
lrwxrwxrwx 1 dmiranda users 118 Nov  1 06:41 _scala -> /mnt/long_meaningless_path/user/home/dmiranda/.local/share/zinit/plugins/zsh-users---zsh-completions/src/_scala

This breaks when I log into a different machine using the same home directory, but that has it mounted somewhere else. As a user, it should be invisible to me, as my home dir is always correctly linked to /home/dmiranda, but the symlinks being made absolute and real breaks it completions when I move between machines.

If they were linked just as /home/dmiranda/... things would still work as expected.

I see here we list the completions files explicitly as absolute real paths:

for c in "${completions[@]:A}"; do

I believe the links should be made relative if possible, or at the least, make it an option to not realise paths, so they at become links to /home/dmiranda (or whatever is in ZINIT[HOME_DIR], ZINIT[PLUGINS_DIR], etc).

Steps to reproduce

  1. Create a directory anywhere in your system, example /mnt/test_user.
  2. Symlink /home/test_user to /mnt/test_user
  3. Install plugins with zinit as test_user. The completions directory will have symlinks pointing to /mnt/test_user.
  4. Rename /mnt/test_user, update /home/test_user symlink.
  5. Try to use zinit again, completions will be missing due to broken symlinks.

Relevant output

No response

Screenshots and recordings

No response

Operating System & Version

OS: linux-gnu | Vendor: debian | Machine: x86_64 | CPU: x86_64 | Processor: unknown | Hardware: x86_64

Zsh version

zsh 5.8 (x86_64-debian-linux-gnu)

Terminal emulator

irrelevant (iTerm2)

If using WSL on Windows, which version of WSL

None

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@danielkza danielkza added the bug Something isn't working label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants