Subject: bug#78638: 30.1; When editing a remote file owned by another user, Tramp signals an error because it cannot change the file mode

From: Michael McClennen <[email-masked]>
Date: Wed, 11 Jun 2025 23:24:32 +0000

Hello Michael,

I have done as you asked. Here are the steps I took, in detail:

1. Run emacs with the arguments listed below.
2. Hit c-x c-f.
3. Opened the file “/scp:taphonomy:/var/paleobiodb/frontend/pbdb-app/collections/collections.html”. The file is owned by somebody else, but its mode bits allow me to edit it.
4. Made a single change to the file.
5. Hit c-x c-s.
6. Heard a beep
7. The minibuffer displays the error message "File error: Error while changing file’s mode /scp:taphonomy:/var/paleobiodb/frontend/pbdb-app/collections/collections.html”
8. Hit c-x c-s again.
9. The minibuffer displays the message "collections.html has changed since visited or saved.  Save anyway? (yes or no) “. This is erroneous, since the file has not in fact changed on disk since I saved it a moment ago.
10. Hit c-x c-f
11. Opened the same file again. Verified that the single change I made was saved to disk, and no other changes were made to the file.

I have attached the contents of the buffer *debug tramp/scp taphonomy*

I hope this helps. Thank you for responding to this issue!

  — Michael McClennen

> On Jun 1, 2025, at 11:42 AM, Michael Albinus <[email-masked]> wrote:
>
> Eli Zaretskii <[email-masked]> writes:
>
> Hi,
>
>>> I set the value of ‘backup-by-copying-when-privileged-mismatched’ to
>>> 10000, and the error still occurs. I then set ‘backup-by-copying’ to
>>> t, and the error still occurs. I checked the *Messages* buffer, and
>>> it reports that Emacs is using copying for this file. This is
>>> definitely an error in Tramp, not the result of proper Emacs
>>> behavior.
>>
>> Thanks, I agree with your conclusion.
>>
>> Michael, could you please look into this?
>
> Will do.
>
> Michael: as a first step, I'd like to gather more information. Michael,
> could you pls start a new Emacs session like this:
>
> --8<---------------cut here---------------start------------->8---
> # emacs -Q -l tramp --eval '(setq tramp-verbose 6 backup-by-copying t)'
> --8<---------------cut here---------------end--------------->8---
>
> Provoke the error on a remote host. Describe in detail, which steps you
> have performed in order to see the error.
>
> There will be a Tramp debug buffer. Pls send it as attachment here.
>
> Best regards, Michael.