-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
builtins set doesn't follow symlinks when saving variables #7466
Comments
You just have to symlink the directory, not the file. We unlink it so we get atomicity, which simplifies things quite a bit. |
Hmm, it's actually not that simple for me to change that... Because the symlinks go to different places. Even though it looks like they go to the sample place, that place just contains symlinks. The symlink for Wouldn't it be possible to resolve the symlinks first, then unlink and replace the file at it's storage location? |
Probably doable in principle, not trivial though. |
The easiest approach is probably to not unlink the file at all, and just truncate + write instead? |
It needs to be atomic, so other fish always read a consistent state. Though that should already be guaranteed because we are locking the file. |
Locking is too unreliable over NFS. (http://0pointer.de/blog/projects/locking.html, http://0pointer.de/blog/projects/locking2) |
Would the project be willing to accept a patch that checks if That would still provide the required atomicity in updates. The fundamental problem I'm running into is that I symlink configuration into my home directory from a git repo, but I do it file-by-file (using I considered trying to set |
I think so; that's also what @etu suggested. I don't see an obvious problem with this solution. |
Previously, `set -U` would overwrite the symlink with a regular file. Fixes #7466
So when using
set --universal name value
it saves to.config/fish/fish_variables
. If that file is a symlink it removes the symlink and just stores as a new file instead.This for me is a problem because both my root partition and my home partition is on a tmpfs filesystem, so when this happens the change isn't persistent to any filesystem and gets lost on next reboot.
I've lost things more than once due to this, such as abbreviations that I've saved.
Recording: https://asciinema.org/a/Y3QcT1kfZcVC8tIv5I5quHy4p
System info:
I tried to run with a separate home directory:
And could perform the same actions to get the same problem.
More about my setup: https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/ https://elis.nu/blog/2020/06/nixos-tmpfs-as-home/
The text was updated successfully, but these errors were encountered: