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: Thu, 12 Jun 2025 14:42:44 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> --8<---------------cut here---------------start------------->8---
>>    • How to ignore errors when changing file attributes?
>> 
>>      Sometimes, for example while saving remote files, errors appear
>>      when changing file attributes like permissions, time stamps, or
>>      ownership.  If these errors can be ignored, set user option
>>      ‘tramp-inhibit-errors-if-setting-file-attributes-fail’ to a
>>      non-‘nil’ value.  This transforms the error into a warning.
>> --8<---------------cut here---------------end--------------->8---
>
> Yes, but why does chmod fail?  Can we see the error message from chmod
> in that case, instead of redirecting its stderr to /dev/null?

On a remote machine, I have mimicked the situation. There is a file

--8<---------------cut here---------------start------------->8---
# ls -al /tmp/xxx
-rw-rw-r-- 1 sigrid everyone 0 2025-06-12 14:15 /tmp/xxx
--8<---------------cut here---------------end--------------->8---

"sigrid" and "albinus" (me) are users on that machine:

--8<---------------cut here---------------start------------->8---
# id
uid=500(albinus) gid=100(everyone) groups=0(administrators),100(everyone)
# id sigrid
uid=506(sigrid) gid=100(everyone) groups=100(everyone)
--8<---------------cut here---------------end--------------->8---

But I ("albinus") cannot change the permissions of /tmp/xxx

--8<---------------cut here---------------start------------->8---
# chmod 775 /tmp/xxx
chmod: /tmp/xxx: Operation not permitted
--8<---------------cut here---------------end--------------->8---

Likely, this is due to missing permissions in the upper directory.

Michael, what do the following commands return on the remote machine:

--8<---------------cut here---------------start------------->8---
# getfacl -ac /var/paleobiodb/frontend/pbdb-app/collections                                                       
# ls -ld /var/paleobiodb/frontend/pbdb-app/collections
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.