-
-
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
Config and/or state files in read-only file systems cause crashes and prevent logging. #2856
Comments
Similar to #818 with same changes necessary for resolution. |
I can't reproduce this with a read-only config folder (i.e. There's code in app_config.go that checks for permission errors when writing the state file and silently ignores those. My guess is that the |
Tested that fork. It is a partial fix to what was mentioned in this issue.
But while testing I also encountered a similar issue for If it is possible, I'd suggest:
|
Thanks for testing!
No, it writes to the file again in the same location where it found it. Which means that for existing users it will continue to save state.yml in the same folder as config.yml, forever. I don't think that's a problem, since state.yml is only created by lazygit, so if it exists in the config folder, that folder must be writeable. We did consider moving files to the new locations, but decided against it in #2936.
Ah, I missed this one. Log files shouldn't be saved into the config folder. According to the XDG spec they should probably go to XDG_STATE_HOME. @horriblename, could you add that change to #2936? It looks like this will just be a one-line change to the
Again, only on a read-only file system. I can't reproduce with a folder that doesn't have write permissions. But anyway, since this is a slightly unrelated problem, I think it should be fixed in a different PR (if at all). It doesn't seem like a serious issue to me. To sum it up, with the additional change of writing log files to XDG_STATE_HOME we're good in my opinion. |
log files belong in XDG_CACHE_HOME I think. Logs aren't part of the app state after all. I can add it in #2936 but would probably be better to split it off in another PR, what do you think? |
Just for reference: https://specifications.freedesktop.org/basedir-spec/0.8/ar01s03.html
|
seems reasonable to put it in XDG_STATE_HOME, will do that later in #2936 |
Describe the bug
Lazygit crashes after prompting for making a repo, before entering the TUI, if it cannot write to
$XDG_CONFIG_HOME/lazygit/state.yml
and it is not possible to log the issue usinglazy --debug
if$XDG_CONFIG_HOME/lazygit/development.log
is also not able to be written to.Both of those are inevitable to happen if the lazygit config folder is in a read-only file system.
To Reproduce
This is not the only way it can happen but it is how I specifically encountered the issue.
Steps to reproduce the an instance of the behavior:
home-manager init
.$HOME/.config/home-manager/home.nix
with a text editor.home.file.".config/lazygit/config.yml".text = "";
inside it's configuration.home-manager switch
lazygit
inside a git repositoryExpected behavior
For program state files to respect
$XDG_STATE_HOME
as mentioned in #2794 with the expected default of$HOME/.local/state
.The XDG Base Directory Specification can be found here
Version info:
This issue happens in the current lazygit nix package for nix stable 23.05 (which is lazygit 0.38.2) and on a build from the current latest commit of this repository b92c294.
I have prepended the output of the
lazygit --version
command to the stderr output of lazygit of both builds.Stderr Output:
commit=, build date=, build source=nix, version=0.38.2, os=linux, arch=amd64, git version=2.40.1
commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.40.1
The text was updated successfully, but these errors were encountered: