Bug 1631837 - systemd-tmpfiles-clean.service removing vim's /tmp/* dirs
Summary: systemd-tmpfiles-clean.service removing vim's /tmp/* dirs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: vim
Version: rawhide
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Leigh Griffin
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-21 16:28 UTC by Brian J. Murrell
Modified: 2020-05-13 02:55 UTC (History)
7 users (show)

Fixed In Version: vim-8.2.735-1.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-13 02:55:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Brian J. Murrell 2018-09-21 16:28:17 UTC
Description of problem:
If I have a VIM window open for a while (days, weeks maybe) eventually I will get an error because VIM will be unable to write to a file in a directory in /tmp/ as such:

syntastic: error: exception running system('bash -n DaosTestMulti.sh'): Vim(let):E484: Can't open file /tmp/vL3FrhY/29
syntastic: error: exception running system('shellcheck -f gcc DaosTestMulti.sh'): Vim(let):E484: Can't open file /tmp/vL3FrhY/30

It seems that systemd-tmpfiles-clean.service is probably removing these dirs even though a VIM process still using them.

Version-Release number of selected component (if applicable):
vim-enhanced-8.1.351-1.fc28.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Open a file in VIM
2. Wait.  Not sure how long.  Probably at least a few days.
3. Do something in VIM that wants to write to the process's temporary dir
3a. vim-syntastic is one thing that will want to do this.

Actual results:
syntastic: error: exception running system('bash -n DaosTestMulti.sh'): Vim(let):E484: Can't open file /tmp/vL3FrhY/29
syntastic: error: exception running system('shellcheck -f gcc DaosTestMulti.sh'): Vim(let):E484: Can't open file /tmp/vL3FrhY/30

Expected results:
VIM should never experience errors because it's /tmp/ workspace has been nuked.

Comment 1 Ben Cotton 2019-05-02 20:51:54 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Brian J. Murrell 2019-05-02 21:43:36 UTC
Why hasn't this bug even been triaged?

Comment 3 Karsten Hopp 2019-05-06 15:47:07 UTC
Because the mail about it didn't trigger any of my mail filters und got removed, sorry.
I'll reassign to systemd as files that are still in use should never get deleted by cleanup scripts. 
That's not only vim, other programs might have problems with this as well.

Comment 4 Zbigniew Jędrzejewski-Szmek 2019-05-06 19:00:10 UTC
There's a couple of solutions possible, but they require some changes on vim side:
1. rename the file to something that forms an identifiable pattern, e.g.
   /tmp/.vim.syntastic.XXXXXXX/ and an exclude for this pattern. This
   is probably easiest, but not the best solution because those files might
   be left behind if the editor dies.
2. bump the atime of the file occasionally. This could be implemented as a 24h
    timer to touch the file.
3. take a BSD lock on the directory. This only works with systemd >= 242.
   See https://github.com/systemd/systemd/blob/v242/NEWS#L126.
   This would the best option imho. It'll be a while before this is implemented
   in vim anyway.
4. use a different directory than /tmp. This is not a good solution either,
   since /tmp seems the most appropriate for this type of temporary files.

Comment 5 Brian J. Murrell 2019-05-07 15:34:55 UTC
I like #3 also.

Since it's a change to vim whichever way you slice it, and given that 1, 2, 4 are all just workarounds and #3 is the solution that uses the correct systemd mechanism, it seems #3 is the ideal solution.

Comment 6 Ben Cotton 2019-10-31 19:14:26 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Ben Cotton 2020-04-30 20:29:34 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Brian J. Murrell 2020-04-30 20:30:26 UTC
Still exists, nothing has been done to address this.

Comment 10 Zdenek Dohnal 2020-05-04 10:29:58 UTC
Hi Brian,

are you able to test the issue if I present a possible patch? I don't have a machine which runs regularly over 10 days.

Zbyszek, thank you for advices, the third options seems doable!

Comment 11 Brian J. Murrell 2020-05-04 12:34:09 UTC
Hi Zdenek,

I might be able to.  The machine I have this problem on is F30, soon to be upgrade to F31 or F32 perhaps.  Post the patch and I will see what I can do.

But wouldn't testing be much more possible by simply reducing the time in /usr/lib/tmpfiles.d/tmp.conf to a ridiculously low value, like 1d (or less even, if possible)?

Comment 12 Zdenek Dohnal 2020-05-04 13:13:59 UTC
Yup, you're right, I gave up too soon when reading the man page... I'll check my solution tomorrow.

Comment 13 Zdenek Dohnal 2020-05-05 13:58:17 UTC
Presented upstream https://github.com/vim/vim/pull/6044

Comment 14 Zdenek Dohnal 2020-05-11 07:05:25 UTC
The patch was merged, it will arrive with the newest Vim update in Fedora.

Comment 15 Fedora Update System 2020-05-11 09:26:13 UTC
FEDORA-2020-5bc35d099f has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-5bc35d099f

Comment 16 Fedora Update System 2020-05-12 07:18:10 UTC
FEDORA-2020-5bc35d099f has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-5bc35d099f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-5bc35d099f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Brian J. Murrell 2020-05-12 07:29:37 UTC
Will an update be pushed for all supported versions of Fedora including 31 (at least)?

Comment 18 Zdenek Dohnal 2020-05-12 08:53:56 UTC
Vim had an earlier update for F31 in testing when I updated to the latest upstream, so the build and the update wasn't created on purpose (but the changes were pushed to F31 and F30).

If I do the next update to the latest upstream patchlevel (I do twice a week) and there will not be any Vim updates in testing in F31 or in newer Fedora version, F31 Vim update will be done too.

F30 is EOL in less than two weeks, I will stop pushing updates to its branch this week.

Comment 19 Zbigniew Jędrzejewski-Szmek 2020-05-12 09:15:38 UTC
Wow, great to see this implemented!

Comment 20 Fedora Update System 2020-05-13 02:55:13 UTC
FEDORA-2020-5bc35d099f has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.