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

Complains a lot when tempdir vanishes #190

Closed
eevee opened this issue Aug 20, 2014 · 5 comments
Closed

Complains a lot when tempdir vanishes #190

eevee opened this issue Aug 20, 2014 · 5 comments

Comments

@eevee
Copy link

eevee commented Aug 20, 2014

I'm on Arch and subject to the whims of systemd, which apparently include deleting anything older than ten days from /tmp whenever it feels like it.

If this happens, any vim process I've left idle for more than ten days will start spewing "Can't open file" errors, because the underlying tempdir no longer exists. Nothing important must be there, because recreating the directory manually makes everything work merrily again.

I could turn this behavior off, but given that /tmp is intended to be volatile, perhaps gitgutter should notice when its tempdir falls out from under it, and quietly recreate it?

@airblade
Copy link
Owner

airblade commented Aug 20, 2014

I can see two possible solutions here.

First, do as you suggest and have the plugin catch the "can't open file errors" and recreate the directory itself.

Second, set $TMPDIR in your vimrc to a temporary directory you have more control over, e.g. $HOME/tmp. See :h tempfile and this vim_use discussion for some background.

Would you be able to try the second option and see whether it solves the problem for you?

@eevee
Copy link
Author

eevee commented Aug 21, 2014

Hmm. It would presumably solve the problem, but then I'd have another temp dir somewhere slowly being filled with things I'd have to remember to delete, which sort of defeats the purpose of a temp dir. Maybe if I added a systemd job to empty it regularly for me... ;)

@airblade
Copy link
Owner

airblade commented Aug 21, 2014

I see your point ;)

I'd still prefer to find a general solution to this rather than add code to this plugin, because it's a general Vim problem. It might be worth your posting a question on vim_use. In the meantime I'll keep digging and see if I can find anything.

@airblade
Copy link
Owner

airblade commented Sep 17, 2014

Did you make any progress with this?

@airblade
Copy link
Owner

airblade commented Oct 15, 2014

It would be nice if vim-gitgutter handled this situation but I think really it's vim's responsibility. So I'm going to close this.

I'm not averse to including a patch which remedies this if it's simple and small.

airblade added a commit that referenced this issue Nov 26, 2020
Vim does not check the existence of its temp directory when generating
file names with tempname().  Therefore if, for some reason, the temp
directory gets deleted, Vim will continue to generate paths for file
names inside the directory.  Writes to these file paths will fail
(E482).

See #746, #433, #190, #147.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants