Subject: Re: 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: Mon, 16 Jun 2025 12:31:59 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

> So the problem is not with saving the edited buffer, the problem is
> that backup-file doesn't work for some reason in this case.  Does
> setting backup-by-copying non-nil solve the problem?

No.

> If not, then (as I don't have access to a system where I can do "sudo
> useradd"), would it be possible for you to step through the code in
> backup-buffer, and tell which part there fails and why, both with
> backup-by-copying set to nil and non-nil?

In both cases (backup-by-copying being nil or t), backup-buffer returns
almost immediately, because

--8<---------------cut here---------------start------------->8---
backup-inhibited is a variable defined in ‘files.el’.

Its value is t
Local in buffer xxx; global value is nil
--8<---------------cut here---------------end--------------->8---

I have tested both cases like this:

--8<---------------cut here---------------start------------->8---
# emacs -Q --eval '(setq backup-by-copying nil)' /tmp/xxx
# emacs -Q --eval '(setq backup-by-copying t)' /tmp/xxx
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.