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 Albinus <[email-masked]>
Date: Sun, 15 Jun 2025 15:50:54 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> Line 6309 in files.el:
>> 
>> --8<---------------cut here---------------start------------->8---
>>                 (write-region nil nil
>>                               buffer-file-name nil t buffer-file-truename)
>> --8<---------------cut here---------------end--------------->8---
>> 
>> And the error is raised in line 5536 of fileio.c:
>> 
>> --8<---------------cut here---------------start------------->8---
>> (gdb) n
>> 5536		  report_file_errno ("Opening output file", filename, open_errno);
>
> Thanks.  Is this with backup-by-copying = t or nil?  Also, does the
> file /tmp/xxx exist at this point with the original owner and modes
> before you edited and saved it?

I've started 'emacs -Q', so it is the default: nil

And yes, it is still the file owned by another user:

--8<---------------cut here---------------start------------->8---
# ll /tmp/xxx
-rw-rw----. 1 testuser1 albinus 0 Jun 15 09:17 /tmp/xxx
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.