GNU bug report logs - #55247
[29.0.50; TRAMP] Tramp Always Thinks Buffer Changed On Disk After Edit -> Save

Previous Next

Package: emacs;

Reported by: Jacob Faibussowitsch <jacob.fai <at> gmail.com>

Date: Tue, 3 May 2022 16:56:01 UTC

Severity: normal

Tags: moreinfo

Fixed in version 29.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55247 in the body.
You can then email your comments to 55247 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Tue, 03 May 2022 16:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jacob Faibussowitsch <jacob.fai <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 May 2022 16:56:01 GMT) Full text and rfc822 format available.

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

From: Jacob Faibussowitsch <jacob.fai <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed On Disk After
 Edit -> Save
Date: Tue, 3 May 2022 11:55:40 -0500
[Message part 1 (text/plain, inline)]
Hello,

Note: anything between angled brackets “< >” is not literal, but rather a description.

Problem:

Any time I edit and save a remote buffer over tramp, I get

```
<file name> changed on disk; really edit the buffer? (y, n, r or C-h)
```

The next time I try to edit the file. I know for a fact that the file has not changed, as I have compared copies of the file:

1. 
```
$ cp remote/file.c remote/file_tmp.c
```
2. Make a change in `file.c`, save, revert it, and save again (prompted each time with “buffer changed on disk”).
3. 
```
$ diff file.c file_tmp.c
```

And they are identical.

Reproduce:

1. 
```
$ emacs -Q /ssh:<ssh alias>:path/to/file
```
2. Change something
3. C-x C-s
4. Try to change something else
5.
```
<file name> changed on disk; really edit the buffer? (y, n, r or C-h)
```

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
[emacs_state.log (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Thu, 05 May 2022 11:17:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Cc: 55247 <at> debbugs.gnu.org
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Thu, 05 May 2022 13:16:40 +0200
Jacob Faibussowitsch <jacob.fai <at> gmail.com> writes:

> The next time I try to edit the file. I know for a fact that the file
> has not changed, as I have compared copies of the file:

[...]

> $ diff file.c file_tmp.c

Changing the timestamp may also trigger the "really edit the buffer"
message.  Have you checked that something isn't altering the timestamp
of the file on the remote system?

> $ emacs -Q /ssh:<ssh alias>:path/to/file
> ```
> 2. Change something
> 3. C-x C-s
> 4. Try to change something else
> 5.
> ```
> <file name> changed on disk; really edit the buffer? (y, n, r or C-h)

I'm unable to reproduce this problem in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 05 May 2022 11:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Thu, 05 May 2022 14:33:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55247 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Thu, 05 May 2022 16:32:52 +0200
Hi all,

I'm also affected by this rather annoying bug when editing a file over
TRAMP. FWIW, I've just bisected it to this patch 47fe7a5983.

Best regards,
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Thu, 05 May 2022 14:43:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 55247 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Thu, 05 May 2022 16:42:36 +0200
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

> I'm also affected by this rather annoying bug when editing a file over
> TRAMP. FWIW, I've just bisected it to this patch 47fe7a5983.

Sorry; I was testing with an Emacs that was a couple days old.  With the
current trunk, I can indeed reproduce the problem.  I'm also getting
further errors:

Debugger entered--Lisp error: (wrong-type-argument "number-or-marker-p nil")
  signal(wrong-type-argument ("number-or-marker-p nil"))
  tramp-error((tramp-file-name "ssh" nil nil "stories" nil "/tmp/foo" nil) wrong-type-argument "number-or-marker-p nil")
  tramp-signal-hook-function(wrong-type-argument (number-or-marker-p nil))
  tramp-sh-handle-write-region(nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil)
  apply(tramp-sh-handle-write-region (nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil))
  tramp-sh-file-name-handler(write-region nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil)
  apply(tramp-sh-file-name-handler write-region (nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil))
  tramp-file-name-handler(write-region nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil)
  write-region(nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo")
  basic-save-buffer-2()
  basic-save-buffer-1()
  basic-save-buffer(t)
  save-buffer(1)

This is on Debian/bookworm writing to a different Debian/bookworm
machine, if that makes a difference.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Thu, 05 May 2022 14:51:02 GMT) Full text and rfc822 format available.

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

From: Jacob Faibussowitsch <jacob.fai <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55247 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed On
 Disk After Edit -> Save
Date: Thu, 5 May 2022 09:50:46 -0500
> I'm also getting further errors:

Yes I was just about to mail with the same problems :). FWIW here are the log messages I get

```
Tramp: Checking ‘vc-registered’ for /ssh:<ssh login>:/home/jacob/tmp.c...done
Tramp: Encoding local file ‘/var/folders/9w/7dlszmmn6q1gd5yf3r9n79bc0000gn/T/tramp.luvXdR.c’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/ssh:<ssh login>:/home/jacob/tmp.c’ using ‘base64 -d -i >%s’...done
Wrong type argument: "Wrong type argument", "number-or-marker-p nil"
tramp-error: Wrong type argument: "number-or-marker-p nil”
```

Perhaps related but I also get this rather strange message on C-g:

```
Quit: “"
```

I have not been able to reliably reproduce it unfortunately, but I believe it occurs if you hit C-g after saving the remote buffer.

>> I'm also affected by this rather annoying bug when editing a file over
>> TRAMP. FWIW, I've just bisected it to this patch 47fe7a5983.


Glad someone else took the time to bisect, I was not looking forward to it...

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)

> On May 5, 2022, at 09:42, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> Manuel Giraud <manuel <at> ledu-giraud.fr> writes:
> 
>> I'm also affected by this rather annoying bug when editing a file over
>> TRAMP. FWIW, I've just bisected it to this patch 47fe7a5983.
> 
> Sorry; I was testing with an Emacs that was a couple days old.  With the
> current trunk, I can indeed reproduce the problem.  I'm also getting
> further errors:
> 
> Debugger entered--Lisp error: (wrong-type-argument "number-or-marker-p nil")
>  signal(wrong-type-argument ("number-or-marker-p nil"))
>  tramp-error((tramp-file-name "ssh" nil nil "stories" nil "/tmp/foo" nil) wrong-type-argument "number-or-marker-p nil")
>  tramp-signal-hook-function(wrong-type-argument (number-or-marker-p nil))
>  tramp-sh-handle-write-region(nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil)
>  apply(tramp-sh-handle-write-region (nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil))
>  tramp-sh-file-name-handler(write-region nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil)
>  apply(tramp-sh-file-name-handler write-region (nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil))
>  tramp-file-name-handler(write-region nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo" nil)
>  write-region(nil nil "/ssh:stories:/tmp/foo" nil t "/ssh:stories:/tmp/foo")
>  basic-save-buffer-2()
>  basic-save-buffer-1()
>  basic-save-buffer(t)
>  save-buffer(1)
> 
> This is on Debian/bookworm writing to a different Debian/bookworm
> machine, if that makes a difference.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Thu, 05 May 2022 15:06:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55247 <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Thu, 05 May 2022 17:05:17 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

Hi,

> Manuel Giraud <manuel <at> ledu-giraud.fr> writes:
>
>> I'm also affected by this rather annoying bug when editing a file over
>> TRAMP. FWIW, I've just bisected it to this patch 47fe7a5983.
>
> Sorry; I was testing with an Emacs that was a couple days old.  With the
> current trunk, I can indeed reproduce the problem.  I'm also getting
> further errors:

I've seen this report, and it is already on my TODO. Just a matter of
available time to work on this.

Shall be fixed latest tomorrow, I hope.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Fri, 06 May 2022 08:45:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Cc: 55247 <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 10:43:54 +0200
Jacob Faibussowitsch <jacob.fai <at> gmail.com> writes:

> Hello,

Hi,

> Reproduce:
>
> 1.
> ```
> $ emacs -Q /ssh:<ssh alias>:path/to/file
> ```
> 2. Change something
> 3. C-x C-s
> 4. Try to change something else
> 5.
> ```
> <file name> changed on disk; really edit the buffer? (y, n, r or C-h)
> ```

Should be fixed now in master, there was a race condition in clearing
the cache.

Since this is fixed in a macro, all files this macro is used must be
recompiled. So please run

rm lisp/net/tramp*.elc; make

> Best regards,
>
> Jacob Faibussowitsch

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Fri, 06 May 2022 09:40:01 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 55247 <at> debbugs.gnu.org, Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 11:39:34 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

[...]

> Should be fixed now in master, there was a race condition in clearing
> the cache.
>
> Since this is fixed in a macro, all files this macro is used must be
> recompiled. So please run
>
> rm lisp/net/tramp*.elc; make

Hi Michael,

I've just rebuild emacs on current HEAD (with your fix) but I'm still
facing this issue. Would you need tramp trace for this?
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Fri, 06 May 2022 09:54:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 55247 <at> debbugs.gnu.org, Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 11:53:35 +0200
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

> Hi Michael,

Hi Manuel,

> I've just rebuild emacs on current HEAD (with your fix) but I'm still
> facing this issue. Would you need tramp trace for this?

Yes, pls do. Running "emacs -Q --eval '(setq tramp-verbose 10)'".
I need the cached properties.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Fri, 06 May 2022 10:10:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 55247 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 12:08:57 +0200
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

>> rm lisp/net/tramp*.elc; make
>
> Hi Michael,
>
> I've just rebuild emacs on current HEAD (with your fix) but I'm still
> facing this issue. Would you need tramp trace for this?

Is this after deleting the .elc files?  (Or a "make bootstrap" to make
sure.)

I'm not able to reproduce the problem any longer after Michael's fixes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Fri, 06 May 2022 11:18:01 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55247 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 13:17:25 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Manuel Giraud <manuel <at> ledu-giraud.fr> writes:
>
>>> rm lisp/net/tramp*.elc; make
>>
>> Hi Michael,
>>
>> I've just rebuild emacs on current HEAD (with your fix) but I'm still
>> facing this issue. Would you need tramp trace for this?
>
> Is this after deleting the .elc files?  (Or a "make bootstrap" to make
> sure.)

Sorry my bad. It works after a "make bootstrap". Thanks Michael!

But how come emacs does not install the new .elc for a freshly patch .el
with a classical "make && make install"?
-- 
Manuel Giraud




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Fri, 06 May 2022 11:23:01 GMT) Full text and rfc822 format available.

Notification sent to Jacob Faibussowitsch <jacob.fai <at> gmail.com>:
bug acknowledged by developer. (Fri, 06 May 2022 11:23:01 GMT) Full text and rfc822 format available.

Message #42 received at 55247-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: 55247-done <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 13:22:50 +0200
Version: 29.1

Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

Hi Manuel,

> Sorry my bad. It works after a "make bootstrap". Thanks Michael!

Thanks for confirmation, I'm closing the bug.

> But how come emacs does not install the new .elc for a freshly patch .el
> with a classical "make && make install"?

I've patched tramp-skeleton-write-region, a macro in tramp.el. This file
has been recompiled.

However, in your use case the function tramp-sh-handle-write-region of
file tramp-sh.el is called, which uses that macro. Since tramp-sh.el
hasn't been recompiled, the old (erroneous) macro definition was still
used.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55247; Package emacs. (Fri, 06 May 2022 11:55:02 GMT) Full text and rfc822 format available.

Message #45 received at 55247-done <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 55247-done <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Jacob Faibussowitsch <jacob.fai <at> gmail.com>
Subject: Re: bug#55247: [29.0.50; TRAMP] Tramp Always Thinks Buffer Changed
 On Disk After Edit -> Save
Date: Fri, 06 May 2022 13:54:38 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

[...]

> I've patched tramp-skeleton-write-region, a macro in tramp.el. This file
> has been recompiled.
>
> However, in your use case the function tramp-sh-handle-write-region of
> file tramp-sh.el is called, which uses that macro. Since tramp-sh.el
> hasn't been recompiled, the old (erroneous) macro definition was still
> used.

(haha I'm dumb). Thanks for the fix *and* this explanation.
Best regards,
-- 
Manuel Giraud




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 04 Jun 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 320 days ago.

Previous Next


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