unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 54126@debbugs.gnu.org
Subject: bug#54126: 29.0.50; C-x x g doesn't always correctly revert SSHFS files
Date: Thu, 10 Mar 2022 14:09:42 +0100	[thread overview]
Message-ID: <87a6dyuf6x.fsf@gmx.de> (raw)
In-Reply-To: <87v8x5mx7q.fsf@gmx.de> (Michael Albinus's message of "Wed, 23 Feb 2022 16:14:33 +0100")

[-- Attachment #1: Type: text/plain, Size: 1856 bytes --]

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Philipp,

>> At least on my system the following happens often, but not always:
>>
>> Create some file whose contents don't really matter.  In my case:
>>
>> $ cat /tmp/a.c
>> int main(void) {
>>   return 0;
>> }
>>
>> Visit the file over SSHFS:
>>
>> $ emacs -Q /sshfs:localhost:/tmp/a.c
>>
>> Now, outside of Emacs, append something to the file:
>>
>> $ echo aaaaa >> /tmp/a.c
>>
>> Immediately after that, back in Emacs, hit C-x x g.  The new content
>> isn't there.  Only after reverting the buffer a second time it appears.
>> First I thought this was a timing/cache coherency issue, but even
>> waiting for 10 seconds doesn't fix it in most cases.  Somewhat
>> surprisingly, switching to a different buffer in between appears to make
>> the problem go away (in some cases at least).
>
> Looks like you are plagued by caching. revert-buffer reverts a file
> only, if it is modified on disk. Tramps caches file attributes by
> default for 10 seconds (see remote-file-name-inhibit-cache). Set this
> value to t in order to test, whether it makes a difference. However, you
> have said you did wait for 10 seconds, so maybe this isn't the reason.
>
> Another cache might come from sshfs itself. Tramp calls sshfs like
> "sshfs localhost:/ /tmp/tramp.sshfs.localhost -C -o idmap=user,reconnect".
> See tramp-mount-args settings in tramp-sshfs.el, line 33-34. You might
> try to add other options, like "-o no_readahead" or "-o sync_readdir",
> see sshfs(1). Don't forget to unmount the sshfs mount point, before you
> start a new Emacs session with changed options.

The appended patch fixes the problem for me. Since it disables the
directory cache of sshfs, there might be performance penalties. Could
you, pls, check how it behaves for you? Shall we enable this by default?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 462 bytes --]

*** /tmp/ediffSUoOdM	2022-03-10 14:04:09.484978898 +0100
--- /home/albinus/src/tramp/lisp/tramp-sshfs.el	2022-03-10 14:01:22.869415240 +0100
***************
*** 51,56 ****
--- 51,57 ----
   (add-to-list 'tramp-methods
  	      `(,tramp-sshfs-method
  		(tramp-mount-args            (("-C") ("-p" "%p")
+ 					      ("-o" "dir_cache=no")
  					      ("-o" "transform_symlinks")
  					      ("-o" "idmap=user,reconnect")))
  		;; These are for remote processes.

  reply	other threads:[~2022-03-10 13:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 13:43 bug#54126: 29.0.50; C-x x g doesn't always correctly revert SSHFS files Philipp Stephani
2022-02-23 15:14 ` Michael Albinus
2022-03-10 13:09   ` Michael Albinus [this message]
2022-03-17  8:15     ` Michael Albinus
2022-03-18 16:21   ` Philipp Stephani
2022-03-18 17:53     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6dyuf6x.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=54126@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).