From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Joel Rosdahl Newsgroups: gmane.emacs.bugs Subject: bug#31981: Fix 'flymake-proc-legacy-flymake' temporary file deletion bug Date: Tue, 27 Aug 2019 22:35:04 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000001004ee05911f36b2" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="111081"; mail-complaints-to="usenet@blaine.gmane.org" To: 31981@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 27 22:36:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i2iCJ-000SlJ-AF for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Aug 2019 22:36:11 +0200 Original-Received: from localhost ([::1]:58390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2iCH-00063C-PS for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Aug 2019 16:36:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54657) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2iCC-000636-Bc for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 16:36:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2iCB-0000jb-83 for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 16:36:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2iCA-0000jN-Py for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 16:36:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i2iCA-0008AW-DL for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2019 16:36:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Joel Rosdahl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Aug 2019 20:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31981 X-GNU-PR-Package: emacs Original-Received: via spool by 31981-submit@debbugs.gnu.org id=B31981.156693812831338 (code B ref 31981); Tue, 27 Aug 2019 20:36:02 +0000 Original-Received: (at 31981) by debbugs.gnu.org; 27 Aug 2019 20:35:28 +0000 Original-Received: from localhost ([127.0.0.1]:49464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2iBc-00089N-1J for submit@debbugs.gnu.org; Tue, 27 Aug 2019 16:35:28 -0400 Original-Received: from mupp.mupps.se ([213.50.164.166]:57592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2iBZ-000899-8N for 31981@debbugs.gnu.org; Tue, 27 Aug 2019 16:35:26 -0400 Original-Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by mupp.mupps.se (Postfix) with ESMTPSA id C4C6ABDC05 for <31981@debbugs.gnu.org>; Tue, 27 Aug 2019 22:35:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rosdahl.net; s=mupp-20190208; t=1566938120; bh=a1FyAfRPOfQH/fsgpRCKhc4DEGdsR9u7CuI3ATN4LR4=; h=From:Date:Subject:To:From; b=edq0JqD87im5Drsji9kzUIOsuAb/vU617HAbnKxZFjb4YDfrlgBScY0AlbnUjuYSK rW4HQ0orvsFWlNmgHTE/Vb8XS/FhlMFuGzY/4T/ErYYs0QDuFq22sZSF8/FsA0+nRC tjX8kKx//6DiY5wl7F88L9r946Hz6wCTCzvcTfWywGplclNaQq5hRey/g9FQVByeg0 WofVi9C0HkQD++GB9pyM5Quf8Nfv8Ky19q/dQQrcf0rs16SCvZ3lmeT01SDe0iYtBI 3dDy6oA/7Cyh2IkVKZKa66VU8LkEU7toISN9L/tmxTuGW1ecw/br6MS+OLK9F8Bzzk D1XGAb7+HjSpw== Original-Received: by mail-lj1-f178.google.com with SMTP id x18so530018ljh.1 for <31981@debbugs.gnu.org>; Tue, 27 Aug 2019 13:35:20 -0700 (PDT) X-Gm-Message-State: APjAAAUsDCemgtfn6nhSqS+mJyOZWp7XJkOQH8sCCCMErZQUFDMc/e6K hRVq9lgu9RXtEEgJp1hX8UB8ihsW3uK2GQasl+M= X-Google-Smtp-Source: APXvYqzDYkN3xdhubdC6otrcHRmywqqeVkpHVWOf1oQVDgmqQGlnJVbNjNsNIlEDQPneu7jbTWNHD/DOFVW3QKgqvGk= X-Received: by 2002:a2e:b042:: with SMTP id d2mr92927ljl.202.1566938120570; Tue, 27 Aug 2019 13:35:20 -0700 (PDT) X-Gmail-Original-Message-ID: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165981 Archived-At: --0000000000001004ee05911f36b2 Content-Type: text/plain; charset="UTF-8" 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 --0000000000001004ee05911f36b2 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-flymake-proc-temporary-file-deletion-bug.patch" Content-Disposition: attachment; filename="0001-Fix-flymake-proc-temporary-file-deletion-bug.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jzuagqef0 RnJvbSBmZWYwZmU1ZWQ2Y2VjNzhlODdmMjk0NDRhZjhkNDAwYmNiZDAxZTcyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKb2VsIFJvc2RhaGwgPGpvZWxAcm9zZGFobC5uZXQ+CkRhdGU6 IFR1ZSwgMjcgQXVnIDIwMTkgMjI6MDA6NDUgKzAyMDAKU3ViamVjdDogW1BBVENIXSBGaXggZmx5 bWFrZS1wcm9jIHRlbXBvcmFyeSBmaWxlIGRlbGV0aW9uIGJ1ZwoKKiBsaXN0L3Byb2dtb2Rlcy9m bHltYWtlLXByb2MuZWwgKGZseW1ha2UtcHJvYy0tcHJvY2Vzcy1zZW50aW5lbCk6CkRvbid0IHJ1 biBjbGVhbnVwIGlmIHRoaXMgaXMgYW4gb2Jzb2xldGUgcHJvY2VzcyAtLSBkZWxldGluZyB0aGUK dGVtcG9yYXJ5IGZpbGUgd2lsbCBtYWtlIHRoZSB0aGUgYWN0aXZlIHByb2Nlc3MgZmFpbCBzaW5j ZSBpdCB1c2VzIHRoZQpzYW1lIGZpbGUuIChCdWcjMzE5ODEpCi0tLQ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VzZXMgdGhlIHNhbWUgZmlsZSAoYnVnIzMxOTgxKToKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgKG5vdCAocHJvY2Vzcy1nZXQgcHJvYyAnZmx5bWFrZS1wcm9jLS1v YnNvbGV0ZSkpKQogICAgICAgICAgICAgICAgICAod2l0aC1jdXJyZW50LWJ1ZmZlciBzb3VyY2Ut YnVmZmVyCiAgICAgICAgICAgICAgICAgICAgKGxldCAoKGNsZWFudXAtZiAoZmx5bWFrZS1wcm9j LS1nZXQtY2xlYW51cC1mdW5jdGlvbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIChidWZmZXItZmlsZS1uYW1lKSkpKQotLSAKMi4yMC4xCgo= --0000000000001004ee05911f36b2--