From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#54016: 29.0.50; TRAMP + sshfs says constantly that file changed Date: Wed, 16 Feb 2022 16:26:08 +0100 Message-ID: <87ee42x27j.fsf@gmx.de> References: <877d9vrik7.fsf.ref@aol.com> <877d9vrik7.fsf@aol.com> <87iltfw6zm.fsf@gmx.de> <20220216110709.i6zt4557j22a3vly@Ergus> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15777"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 54016@debbugs.gnu.org To: Ergus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 16 16:27:35 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nKMDO-0003vr-If for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Feb 2022 16:27:34 +0100 Original-Received: from localhost ([::1]:56822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKMDN-0001PH-1Z for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Feb 2022 10:27:33 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKMCx-0001Oz-27 for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2022 10:27:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKMCs-000739-F2 for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2022 10:27:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKMCs-00014h-8G for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2022 10:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Feb 2022 15:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54016 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: "Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors" , 54016@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16450251914093 (code B ref -1); Wed, 16 Feb 2022 15:27:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Feb 2022 15:26:31 +0000 Original-Received: from localhost ([127.0.0.1]:49253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKMCN-00013x-GK for submit@debbugs.gnu.org; Wed, 16 Feb 2022 10:26:31 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:35858) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKMCL-00013p-M9 for submit@debbugs.gnu.org; Wed, 16 Feb 2022 10:26:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKMCJ-0001OR-6n for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2022 10:26:29 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:56715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKMCH-00071X-AV for bug-gnu-emacs@gnu.org; Wed, 16 Feb 2022 10:26:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645025175; bh=JVpDUqWpCuuGvgi1NZp0/EUR/Ycp6Fynae0Vaob1bhA=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=EMq39qrtiP4hJ7lJPFgWDhv/goXaP4y+91U8/HIJt/0Yjh0S/5vBhb/vNGCNN18D8 wee5K9TKuTDRHSEkUmCijuFe9R9EzaFa+lrJwatsJQDD+xpIf5mNKheQZ+Ha5qWLXg kodsfrbUdm9QotbYswDiUPP7O3FXhpih66cwwV3k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.158.128]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MQv8n-1nfZhZ10QJ-00O0H2; Wed, 16 Feb 2022 16:26:15 +0100 In-Reply-To: <20220216110709.i6zt4557j22a3vly@Ergus> (Ergus's message of "Wed, 16 Feb 2022 12:07:09 +0100") X-Provags-ID: V03:K1:JDLcvIzSAY2R0ZMOYTQ/g3S2EgV2ULuP0mDCfrn9EXgZmrS20y0 eunT8i7ZrE5PQEUElEabThmGd/bidZLQvMzRYoH78uJ6gTqwEG9DZ9l0/oq7ipv7mD65gD3 uXKqTbQysKQ2ty1IACdo83ZZgGtGOESKmPm3hKSpdW0KwfJXNy//4SktiLQbHLK0G7nYn+7 gd7wj5YOD4guc5newfaUg== X-UI-Out-Filterresults: notjunk:1;V03:K0:SvaVPb4siUA=:fziAUpQUoLsAzimWe11GZA b/P/vrpksDC6k1ZmLJ8rStVuypGrt8aIO9uo4Q6FD8FsKwVRGKtXOdPL16VR++2fbtkNWWebx qD5D38V0+4pqiqwXKjE3m0VAITMH9hxNEyishdDQ9IwmTsfw1UwGnN3HM9xzYhui117GfOIPN wlhQTkvcHUMYRSkby87U0NYRV/r/GWyUbFjfzuuv+oo1Nu6NFHy57F4w6ORrpqgv8J6zYkmym YU/Z7CYTiePs+6d0wq2WfuSiPGnfyJsJOF0JzGLolomRgl7toG6/mA+GbP46MiLJJt+RhWIDE iGB3a23i86TlsYFAQxdG6bJebsP1UhjMHxgLxD6bR1/aApzmVIeDVTHQr87hdThlmRJrQ/rhJ M1O62qtf9Chr3DoKsGcrgPlTTJnVxYlE6OC7XI9aJN1JrsPQhH4gcSh25qCpSi7Jk1+lJgTE/ gO9lEFUIYiXAOrn3bDZ0bnQtZBFQnhysNkRKRWb05pn2DHbJukEv+qxTmuJNTAuJIkQa0FSWu KUYBe3g/QS69XPp0wd7bFYxnjhYyeu6hBqNWvLYFX7I5jz9egOLsAZ20gkMVkS8nnx59xJK0z Dib/nDEjqSawglX7PtTdw79OG9nv056QcQYjeugjKGcxHTLRflSFFYvlPWZ3TivfIdQafTRN7 arpyD+aslXByqgmPlSXrsOnfZlyzOzZzt6gXNCTZ4AM8jSwA6VoyB3ZsPkihxhl6ku+9zek85 54WhF3p0WRQpyaVKdvB6KRy6tS5FFl8ZTp7RLbSV6bZI6ydGtvy5MXVDFDEdl5WFBB9LBH5t Received-SPF: pass client-ip=212.227.15.18; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:227039 Archived-At: --=-=-= Content-Type: text/plain Ergus writes: Hi, >>> Using tramp+sshfs it works pretty much fine at the beginning but after >>> some minutes it interrupts constantly saying that the file changed on >>> disk and asks for edit confirmation. >>> >>> By constantly I mean every time a new edit is attempt I get this (even >>> several times consecutive). >>> >>> ``` >>> Saving file /sshfs:XXX:XXXX >>> benchmarks_ompss.h has changed since visited or saved. Save anyway? (y or n) y >>> benchmarks_ompss.h changed on disk; really edit the buffer? (y, n, r or C-h) y >>> File on disk now will become a backup file if you save these changes. >>> Wrote /sshfs:XXX:XXXX >>> ``` >> >>Well, I would need a recipe to reproduce. Could you run it, when >>tramp-verbose is set to 10? And please tell me at which time the problem >>starts to appear, so I have a chance to find it in the debug buffer. >> >>I know that the debug buffer will be huge after a while, but there is no >>problem if you send it directly to me (or a URL where I could find it). >> > > 1) C-x C-f /sshfs:mn3:/home/ergus/cholesky_ompss2/cholesky_utils.c > 2) edit and save (C-x C-f) > > 3) Try to edit again: > > and get the message: > > ``` > cholesky_utils.c changed on disk; really edit the buffer? (y, n, r or C-h) y > File on disk now will become a backup file if you save these changes. > ``` > > While this is printed in the debug buffer. Thanks for the recipe and the traces. Finally, I could reproduce the problem locally, it was due to a missing update of the buffer's modification time. The appended patch fixes this for me, could you pls test? Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/tramp-sshfs.el b/lisp/tramp-sshfs.el index ca682466..710b55b1 100644 =2D-- a/lisp/tramp-sshfs.el +++ b/lisp/tramp-sshfs.el @@ -107,9 +107,9 @@ (file-name-nondirectory . tramp-handle-file-name-nondirectory) ;; `file-name-sans-versions' performed by default handler. (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) - (file-notify-add-watch . ignore) - (file-notify-rm-watch . ignore) - (file-notify-valid-p . ignore) + (file-notify-add-watch . tramp-handle-file-notify-add-watch) + (file-notify-rm-watch . tramp-handle-file-notify-rm-watch) + (file-notify-valid-p . tramp-handle-file-notify-valid-p) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) @@ -389,6 +389,13 @@ arguments to pass to the OPERATION." start end (tramp-fuse-local-file-name filename) append 'nomessage) (tramp-flush-file-properties v localname)) + ;; Set file modification time. + (when (or (eq visit t) (stringp visit)) + (set-visited-file-modtime + (or (file-attribute-modification-time + (file-attributes filename)) + (current-time)))) + ;; Unlock file. (when file-locked ;; `unlock-file' exists since Emacs 28.1. --=-=-=--