GNU bug report logs - #31981
26.1; flymake: removes temporary file before finishing check

Previous Next

Package: emacs;

Reported by: Enrico Scholz <enrico.scholz <at> sigma-chemnitz.de>

Date: Tue, 26 Jun 2018 17:28:01 UTC

Severity: normal

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 31981 <at> debbugs.gnu.org (full text, mbox):

From: Joel Rosdahl <joel <at> rosdahl.net>
To: 31981 <at> debbugs.gnu.org
Subject: Fix 'flymake-proc-legacy-flymake' temporary file deletion bug
Date: Tue, 27 Aug 2019 22:35:04 +0200
[Message part 1 (text/plain, inline)]
I can reproduce this bug on latest master.

The problem is that if a check command takes a long time, the
following can happen:

1. The user modifies the buffer, making flymake-proc start a process A
which reads from a temporary file T containing the buffer content.
2. Before process A has finished, the user modifies the buffer again,
making flymake-proc start a new process B reading from the same
temporary file T.
3. A is marked as obsolete.
4. When A's sentinel detects that A has died, it runs A's cleanup
function which deletes T.
5. B may fail since T is gone.

Attached is a patch which solves the issue, at least for me: simply
don't run the cleanup function for an obsolete process. This should
work well for checks that use flymake-proc-simple-cleanup or one of
the other cleanup functions defined in flymake-proc.el.

I'm not sure if the fix is appropriate for the general case with a
user-supplied custom cleanup function, though. But I see no other
quick fix for the issue since the name of the temporary file is kept
in a single buffer-local variable and there is no way for the cleanup
function to know that it's being called for an obsolete process.

-- Joel
[0001-Fix-flymake-proc-temporary-file-deletion-bug.patch (text/x-patch, attachment)]

This bug report was last modified 5 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.