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

Previous Next

Package: emacs;

Reported by: Michael McClennen <mmcclenn <at> geology.wisc.edu>

Date: Thu, 29 May 2025 21:10:02 UTC

Severity: normal

Found in version 30.1

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: mmcclenn <at> geology.wisc.edu, 78638 <at> debbugs.gnu.org
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
Date: Thu, 12 Jun 2025 14:14:32 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  "78638 <at> debbugs.gnu.org"
>  <78638 <at> debbugs.gnu.org>
> Date: Thu, 12 Jun 2025 12:24:48 +0200
> 
> So indeed, the group id "pbdb" should be sufficient for editing. After
> saving your edits, the used local temporary file is copied to remote:
> 
> --8<---------------cut here---------------start------------->8---
> 18:07:40.213573 tramp-do-copy-or-rename-file-out-of-band (6) # scp -T -q -r -o ControlMaster=auto -o ControlPath=tramp.%C -o ControlPersist=no /var/folders/rd/94y9m04x2v1cttshz_mprjdr0000gp/T/tramp.NtIfrx.html taphonomy:/var/paleobiodb/frontend/pbdb-app/collections/collections.html
> --8<---------------cut here---------------end--------------->8---
> 
> This succeeds. However, the next step, changing the file mode of the
> copied file fails. And this is reported as error:
> 
> --8<---------------cut here---------------start------------->8---
> 18:07:40.559966 tramp-send-command (6) # chmod  664 /var/paleobiodb/frontend/pbdb-app/collections/collections.html 2>/dev/null; echo tramp_exit_status $?
> 18:07:40.626488 tramp-wait-for-regexp (6) #
> tramp_exit_status 1
> 18:07:40.627115 tramp-barf-unless-okay (1) # File error: Error while changing file’s mode /scp:taphonomy:/var/paleobiodb/frontend/pbdb-app/collections/collections.html
> --8<---------------cut here---------------end--------------->8---
> 
> But the file has a changed modification time (1749683260) and size
> (84009), which is proper:
> 
> --8<---------------cut here---------------start------------->8---
> 18:08:45.246430 tramp-send-command (6) # tramp_stat_file_attributes /var/paleobiodb/frontend/pbdb-app/collections/collections.html 2>/dev/null; echo tramp_exit_status $?
> 18:08:45.307161 tramp-wait-for-regexp (6) #
> (("‘/var/paleobiodb/frontend/pbdb-app/collections/collections.html’") 1 ("bnoushin7" . 29012) ("pbdb" . 1000) 1749680914 1749683260 1749683260 84009 "-rw-rw-r--" t 1847394 -1)
> --8<---------------cut here---------------end--------------->8---
> 
> So the chmod command fails.
> 
> Since Emacs 30.1, there is the user option
> tramp-inhibit-errors-if-setting-file-attributes-fail. See (info "(tramp)
> Frequently Asked Questions")
> 
> --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?




This bug report was last modified 31 days ago.

Previous Next


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