GNU bug report logs - #77402
31.0.50; Tramp: file-writable-p broken

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Mon, 31 Mar 2025 08:22:02 UTC

Severity: normal

Found in version 31.0.50

Fixed in version 30.2

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77402 in the body.
You can then email your comments to 77402 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 08:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gerd Möllmann <gerd.moellmann <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 31 Mar 2025 08:22:02 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 10:21:25 +0200
In current master, Magit over Tramp/ssh stopped working. The first thing
I noticed in the log with tramp-verbose == 6 is

  08:33:37.401799 tramp-get-remote-tmpdir (1) # File error: Directory /ssh:mini:/tmp not accessible

This is caused by file-writable-p returning nil for the remote /tmp dir;
/tmp is a symlink to private/tmp on macOS.

I could bisect this to

  b8104dadbf285d12c356d4cddd28ac3eaf05f263 is the first bad commit
  commit b8104dadbf285d12c356d4cddd28ac3eaf05f263 (HEAD)
  Author: Michael Albinus <michael.albinus <at> gmx.de>
  Date:   Sun Mar 16 14:17:38 2025 +0100
      Tramp: Handle symlinks to non-existing targets better

Before this change

  (tramp-autoload-file-name-handler 'file-writable-p "/ssh:mini:/tmp")
  => t

After the change, it returns nil.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 08:56:03 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 10:55:14 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

> In current master, Magit over Tramp/ssh stopped working. The first thing
> I noticed in the log with tramp-verbose == 6 is
>
>   08:33:37.401799 tramp-get-remote-tmpdir (1) # File error: Directory /ssh:mini:/tmp not accessible
>
> This is caused by file-writable-p returning nil for the remote /tmp dir;
> /tmp is a symlink to private/tmp on macOS.
>
> I could bisect this to
>
>   b8104dadbf285d12c356d4cddd28ac3eaf05f263 is the first bad commit
>   commit b8104dadbf285d12c356d4cddd28ac3eaf05f263 (HEAD)
>   Author: Michael Albinus <michael.albinus <at> gmx.de>
>   Date:   Sun Mar 16 14:17:38 2025 +0100
>       Tramp: Handle symlinks to non-existing targets better
>
> Before this change
>
>   (tramp-autoload-file-name-handler 'file-writable-p "/ssh:mini:/tmp")
>   => t
>
> After the change, it returns nil.

Could you pls tell, what's the system-type of your local machine, and
what's the OS of the remote machine?

Thanks, and best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 09:01:04 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 11:00:21 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
> Hi Gerd,
>
>> In current master, Magit over Tramp/ssh stopped working. The first thing
>> I noticed in the log with tramp-verbose == 6 is
>>
>>   08:33:37.401799 tramp-get-remote-tmpdir (1) # File error: Directory /ssh:mini:/tmp not accessible
>>
>> This is caused by file-writable-p returning nil for the remote /tmp dir;
>> /tmp is a symlink to private/tmp on macOS.
>>
>> I could bisect this to
>>
>>   b8104dadbf285d12c356d4cddd28ac3eaf05f263 is the first bad commit
>>   commit b8104dadbf285d12c356d4cddd28ac3eaf05f263 (HEAD)
>>   Author: Michael Albinus <michael.albinus <at> gmx.de>
>>   Date:   Sun Mar 16 14:17:38 2025 +0100
>>       Tramp: Handle symlinks to non-existing targets better
>>
>> Before this change
>>
>>   (tramp-autoload-file-name-handler 'file-writable-p "/ssh:mini:/tmp")
>>   => t
>>
>> After the change, it returns nil.
>
> Could you pls tell, what's the system-type of your local machine, and
> what's the OS of the remote machine?
>
> Thanks, and best regards, Michael.

Soory, forgot to mention. Both are macOS 15.3.2 machines

.../emacs/github/cl-packages % uname -a
Darwin pro2 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 09:14:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 11:13:18 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

> Soory, forgot to mention. Both are macOS 15.3.2 machines
>
> .../emacs/github/cl-packages % uname -a
> Darwin pro2 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64

Hmm, I cannot reproduce the problem. Recipe:

--8<---------------cut here---------------start------------->8---
(make-directory "/ssh:ford:/tmp/yyy")
=> nil

(make-symbolic-link "/tmp/yyy" "/ssh:ford:/tmp/xxx")
=> t

(let ((default-directory "/ssh:ford:/tmp/"))
  (shell-command-to-string "ls -al"))
=> "...
lrwxrwxrwx   1 admin    administrators       8 2025-03-31 11:03 xxx -> /tmp/yyy
drwxr-xr-x   2 admin    administrators      40 2025-03-31 11:02 yyy
"

(file-writable-p "/ssh:ford:/tmp/xxx")
=> t
--8<---------------cut here---------------end--------------->8---

My local and the remote machine are running GNU/Linux.

Could you, pls, send the whole Tramp debug buffer with tramp-verbose 6,
after starting a new Emacs session?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 09:35:03 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 11:34:21 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
> Hi Gerd,
>
>> Soory, forgot to mention. Both are macOS 15.3.2 machines
>>
>> .../emacs/github/cl-packages % uname -a
>> Darwin pro2 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16
>> PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
>
> Hmm, I cannot reproduce the problem. Recipe:
>
> (make-directory "/ssh:ford:/tmp/yyy")
> => nil
>
> (make-symbolic-link "/tmp/yyy" "/ssh:ford:/tmp/xxx")
> => t
>
> (let ((default-directory "/ssh:ford:/tmp/"))
>   (shell-command-to-string "ls -al"))
> => "...
> lrwxrwxrwx   1 admin    administrators       8 2025-03-31 11:03 xxx -> /tmp/yyy
> drwxr-xr-x   2 admin    administrators      40 2025-03-31 11:02 yyy
> "
>
> (file-writable-p "/ssh:ford:/tmp/xxx")
> => t
>
> My local and the remote machine are running GNU/Linux.
>
> Could you, pls, send the whole Tramp debug buffer with tramp-verbose 6,
> after starting a new Emacs session?
>
> Best regards, Michael.

This is with master 1ed1cc83491311517ba46dff73fdc4383ffd4102. I started
Emacs without -Q to get Magit, hope that doesn't matter. Settings
related to Tramp in my init.el:

  (use-package tramp
    :defer t
    :custom
    (auto-revert-remote-files t)

    :config
    ;; Define profile for a remote zsh connection.
    (connection-local-set-profile-variables
     'remote-zsh-arm
     '((explicit-shell-file-name . "/opt/homebrew/bin/zsh")
       (explicit-zsh-args . ("-i"))))

    ;; Define which profile to use depending on a connection protocol
    ;; and machine. No longer really used since the x86 machine died.
    (connection-local-set-profiles '(:protocol "ssh" :machine "pro2") 'remote-zsh-arm)
    (connection-local-set-profiles '(:protocol "ssh" :machine "mini") 'remote-zsh-arm)

    ;; Let me use my own PATH.
    (add-to-list 'tramp-remote-path 'tramp-own-remote-path))

Started a fresh Emacs, then

  (setq tramp-verbose 6)
  M-x magit-status RET /ssh:mini:emacs/github/master RET

Status buffer is displayed. Then pulled with "P p" which gives the error
"... /tmp.not accessible". Please find the debug buffer contents
attached.

[tramp-denug.log (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 09:43:02 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 11:42:06 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

B> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
>> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>>
>> Hi Gerd,
>>
>>> Soory, forgot to mention. Both are macOS 15.3.2 machines
>>>
>>> .../emacs/github/cl-packages % uname -a
>>> Darwin pro2 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16
>>> PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
>>
>> Hmm, I cannot reproduce the problem. Recipe:
>>
>> (make-directory "/ssh:ford:/tmp/yyy")
>> => nil
>>
>> (make-symbolic-link "/tmp/yyy" "/ssh:ford:/tmp/xxx")
>> => t
>>
>> (let ((default-directory "/ssh:ford:/tmp/"))
>>   (shell-command-to-string "ls -al"))
>> => "...
>> lrwxrwxrwx   1 admin    administrators       8 2025-03-31 11:03 xxx -> /tmp/yyy
>> drwxr-xr-x   2 admin    administrators      40 2025-03-31 11:02 yyy
>> "
>>
>> (file-writable-p "/ssh:ford:/tmp/xxx")
>> => t
>>
>> My local and the remote machine are running GNU/Linux.
>>
>> Could you, pls, send the whole Tramp debug buffer with tramp-verbose 6,
>> after starting a new Emacs session?
>>
>> Best regards, Michael.
>
> This is with master 1ed1cc83491311517ba46dff73fdc4383ffd4102. I started
> Emacs without -Q to get Magit, hope that doesn't matter. Settings
> related to Tramp in my init.el:
>
>   (use-package tramp
>     :defer t
>     :custom
>     (auto-revert-remote-files t)
>
>     :config
>     ;; Define profile for a remote zsh connection.
>     (connection-local-set-profile-variables
>      'remote-zsh-arm
>      '((explicit-shell-file-name . "/opt/homebrew/bin/zsh")
>        (explicit-zsh-args . ("-i"))))
>
>     ;; Define which profile to use depending on a connection protocol
>     ;; and machine. No longer really used since the x86 machine died.
>     (connection-local-set-profiles '(:protocol "ssh" :machine "pro2") 'remote-zsh-arm)
>     (connection-local-set-profiles '(:protocol "ssh" :machine "mini") 'remote-zsh-arm)
>
>     ;; Let me use my own PATH.
>     (add-to-list 'tramp-remote-path 'tramp-own-remote-path))
>
> Started a fresh Emacs, then
>
>   (setq tramp-verbose 6)
>   M-x magit-status RET /ssh:mini:emacs/github/master RET
>
> Status buffer is displayed. Then pulled with "P p" which gives the error
> "... /tmp.not accessible". Please find the debug buffer contents
> attached.

Perhaps let me add how it looks in the file system

 gerd <at> mini 2025-03-31 11:39 
~ % ls -ld /tmp
lrwxr-xr-x@ 1 root  wheel  11 Mar  6 11:06 /tmp -> private/tmp
 gerd <at> mini 2025-03-31 11:39 
~ % ls -ld /private/tmp
drwxrwxrwt  6 root  wheel  192 Mar 31 06:55 /private/tmp
 gerd <at> mini 2025-03-31 11:40 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 11:18:04 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 13:17:39 +0200
[Message part 1 (text/plain, inline)]
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

>>> Hmm, I cannot reproduce the problem. Recipe:
>>>
>>> (make-directory "/ssh:ford:/tmp/yyy")
>>> => nil
>>>
>>> (make-symbolic-link "/tmp/yyy" "/ssh:ford:/tmp/xxx")
>>> => t
>>>
>>> (let ((default-directory "/ssh:ford:/tmp/"))
>>>   (shell-command-to-string "ls -al"))
>>> => "...
>>> lrwxrwxrwx   1 admin    administrators       8 2025-03-31 11:03 xxx -> /tmp/yyy
>>> drwxr-xr-x   2 admin    administrators      40 2025-03-31 11:02 yyy
>>> "
>>>
>>> (file-writable-p "/ssh:ford:/tmp/xxx")
>>> => t
>>>
>>> My local and the remote machine are running GNU/Linux.
>>>
>>> Could you, pls, send the whole Tramp debug buffer with tramp-verbose 6,
>>> after starting a new Emacs session?
>>>
>>> Best regards, Michael.
>>
>> This is with master 1ed1cc83491311517ba46dff73fdc4383ffd4102. I started
>> Emacs without -Q to get Magit, hope that doesn't matter. Settings
>> related to Tramp in my init.el:
>>
>>   (use-package tramp
>>     :defer t
>>     :custom
>>     (auto-revert-remote-files t)
>>
>>     :config
>>     ;; Define profile for a remote zsh connection.
>>     (connection-local-set-profile-variables
>>      'remote-zsh-arm
>>      '((explicit-shell-file-name . "/opt/homebrew/bin/zsh")
>>        (explicit-zsh-args . ("-i"))))
>>
>>     ;; Define which profile to use depending on a connection protocol
>>     ;; and machine. No longer really used since the x86 machine died.
>>     (connection-local-set-profiles '(:protocol "ssh" :machine "pro2") 'remote-zsh-arm)
>>     (connection-local-set-profiles '(:protocol "ssh" :machine "mini") 'remote-zsh-arm)
>>
>>     ;; Let me use my own PATH.
>>     (add-to-list 'tramp-remote-path 'tramp-own-remote-path))
>>
>> Started a fresh Emacs, then
>>
>>   (setq tramp-verbose 6)
>>   M-x magit-status RET /ssh:mini:emacs/github/master RET
>>
>> Status buffer is displayed. Then pulled with "P p" which gives the error
>> "... /tmp.not accessible". Please find the debug buffer contents
>> attached.
>
> Perhaps let me add how it looks in the file system
>
>  gerd <at> mini 2025-03-31 11:39 
> ~ % ls -ld /tmp
> lrwxr-xr-x@ 1 root  wheel  11 Mar  6 11:06 /tmp -> private/tmp
>  gerd <at> mini 2025-03-31 11:39 
> ~ % ls -ld /private/tmp
> drwxrwxrwt  6 root  wheel  192 Mar 31 06:55 /private/tmp
>  gerd <at> mini 2025-03-31 11:40 

Thanks. I went through the debug buffer, and perhaps I found the guilty
place. Could you, please try the attached patch?

If that doesn't work, I need more traces. Higher debug level, and
everything from the beginning. So could you pls call a fresh Emacs like

--8<---------------cut here---------------start------------->8---
# emacs -l tramp --eval '(setq tramp-verbose 10)'
--8<---------------cut here---------------end--------------->8---

Then you can continue with your recipe.

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 12:01:02 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 14:00:25 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Thanks. I went through the debug buffer, and perhaps I found the guilty
> place. Could you, please try the attached patch?

I'm afraid that didn't fix it yet. 

>
> If that doesn't work, I need more traces. Higher debug level, and
> everything from the beginning. So could you pls call a fresh Emacs like
>
> # emacs -l tramp --eval '(setq tramp-verbose 10)'
>
> Then you can continue with your recipe.

Please find attached. There were 3 ldebuug buffers

Buffer "*debug tramp/cache nil*"

;; Emacs: 31.0.50 Tramp: 2.8.0-pre -*- mode: outline; coding: utf-8; -*-
;; Location: /Users/gerd/emacs/github/master/lisp/net/tramp.elc Git: master/1ed1cc83491311517ba46dff73fdc4383ffd4102
13:49:08.592619 tramp-get-connection-property (7) # tramp-version 2.8.0-pre; cache used: t
13:49:08.592694 tramp-set-connection-property (7) # tramp-version 2.8.0-pre

Buffer "*debug tramp/local gerd <at> pro2"

;; Emacs: 31.0.50 Tramp: 2.8.0-pre -*- mode: outline; coding: utf-8; -*-
;; Location: /Users/gerd/emacs/github/master/lisp/net/tramp.elc Git: master/1ed1cc83491311517ba46dff73fdc4383ffd4102
13:49:08.623158 tramp-get-connection-property (7) # last-cmd-time 0; cache used: nil
13:49:08.623240 tramp-get-connection-property (7) # locale undef; cache used: nil
13:49:08.630336 tramp-set-connection-property (7) # locale en_US.UTF-8
13:49:08.630497 tramp-get-connection-property (7) # ControlMaster=auto undef; cache used: nil
13:49:08.635978 tramp-set-connection-property (7) # ControlMaster=auto t
13:49:08.636005 tramp-get-connection-property (7) # ControlPath=tramp.%C undef; cache used: nil
13:49:08.640488 tramp-set-connection-property (7) # ControlPath=tramp.%C t
13:49:08.640516 tramp-get-connection-property (7) # ControlPersist=no undef; cache used: nil
13:49:08.644492 tramp-set-connection-property (7) # ControlPersist=no t
13:49:22.265830 tramp-get-connection-property (7) # last-cmd-time 0; cache used: nil
13:49:22.265885 tramp-get-connection-property (7) # locale en_US.UTF-8; cache used: t
13:49:22.266035 tramp-get-connection-property (7) # ControlMaster=auto t; cache used: t
13:49:22.266056 tramp-get-connection-property (7) # ControlPath=tramp.%C t; cache used: t
13:49:22.266077 tramp-get-connection-property (7) # ControlPersist=no t;
;; cache used: t

And this one for ssh to mini

[debug-tramp-ssh-mini.log.gz (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 13:47:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 15:46:25 +0200
[Message part 1 (text/plain, inline)]
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

>> Thanks. I went through the debug buffer, and perhaps I found the guilty
>> place. Could you, please try the attached patch?
>
> I'm afraid that didn't fix it yet. 

Hmm. I have the impression the problem is due to the sticky bit set in
/private/tmp. Could you, please, check the modified patch?

If it still doesn't work, I need the full traces again, from the
beginning.

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 14:14:02 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 16:13:10 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
> Hi Gerd,
>
>>> Thanks. I went through the debug buffer, and perhaps I found the guilty
>>> place. Could you, please try the attached patch?
>>
>> I'm afraid that didn't fix it yet. 
>
> Hmm. I have the impression the problem is due to the sticky bit set in
> /private/tmp. Could you, please, check the modified patch?
>
> If it still doesn't work, I need the full traces again, from the
> beginning.
>
> Best regards, Michael.

--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1831,7 +1831,8 @@ tramp-sh-handle-file-writable-p
 	  ;; Examine `file-attributes' cache to see if request can be
 	  ;; satisfied without remote operation.
 	  (if (tramp-use-file-attributes v)
-	      (tramp-check-cached-permissions v ?w)
+	      (or (tramp-check-cached-permissions v ?w)
+                  (tramp-check-cached-permissions v ?t)))
                                                        ^^^
 	    (tramp-run-test v "-w" localname))
 	;; If file doesn't exist, check if directory is writable.
 	(and

That had a ')' too much which I deleted. Hope that's TRT.

With that, the error is still there. Same procedure with tramp-verbose
== 10 gives this log

[tramp3.log.gz (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 14:18:03 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 16:17:24 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

> That had a ')' too much which I deleted. Hope that's TRT.

Of course.

> With that, the error is still there. Same procedure with tramp-verbose
> == 10 gives this log

Then I'm lost. We could try it with tramp-verbose 11, which gives
additional call traces.

Or you could give me temporary access to the remote machine, that I can
debug.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 14:43:04 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 16:42:28 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi Gerd,

> Then I'm lost. We could try it with tramp-verbose 11, which gives
> additional call traces.
>
> Or you could give me temporary access to the remote machine, that I can
> debug.

Just wait! There's another nuisance worth to fix. Could you, pls, check?

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 15:33:01 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 17:32:03 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
> Hi Gerd,
>
>> Then I'm lost. We could try it with tramp-verbose 11, which gives
>> additional call traces.
>>
>> Or you could give me temporary access to the remote machine, that I can
>> debug.
>
> Just wait! There's another nuisance worth to fix. Could you, pls, check?
>
> Best regards, Michael.

I'm afraid that's also not it. I can now boil it down to the following
test with emacs -Q (I'm always building without window system FWIW):

  (file-writable-p "/ssh:mini:/tmp")
   => nil
  (file-writable-p (file-truename "/ssh:mini:/tmp"))
   => t

where

  (file-truename "/ssh:mini:/tmp")
   => "/ssh:mini:/private/tmp"
 
Weird. With

  (trace-function 'tramp-sh-handle-file-writable-p)

I can see that this comes out of that function.

Giving you access to "mini" is not an easy option, I'm afraid. It means
fighting with macOS network security, an area that I have virtually 0
experience with :-(.

Anyway, maybe I can debug this. Or, I just change /tmp to not be
symlink, or maybe I can just set TMPDIR or something. Or, I just ssh and
run Emacs on the remote machine, with 0 work :-).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 15:44:03 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 17:43:22 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

>> Just wait! There's another nuisance worth to fix. Could you, pls, check?
>
> I'm afraid that's also not it. I can now boil it down to the following
> test with emacs -Q (I'm always building without window system FWIW):
>
>   (file-writable-p "/ssh:mini:/tmp")
>    => nil
>   (file-writable-p (file-truename "/ssh:mini:/tmp"))
>    => t
>
> where
>
>   (file-truename "/ssh:mini:/tmp")
>    => "/ssh:mini:/private/tmp"

Yes, this is the area I'm looking at. "/ssh:mini:/tmp" has file
permissions lrwxr-xr-x, and "/ssh:mini:/private/tmp" has file
permissions drwxrwxrwt. (file-writable-p "/ssh:mini:/tmp") should look
at the permissions of the target, but it doesn't. It looks at the
permissions of the symlink itself.

And everything is mixed happily with cached values, for performance
speedup ...

> Weird. With
>
>   (trace-function 'tramp-sh-handle-file-writable-p)
>
> I can see that this comes out of that function.
>
> Giving you access to "mini" is not an easy option, I'm afraid. It means
> fighting with macOS network security, an area that I have virtually 0
> experience with :-(.
>
> Anyway, maybe I can debug this. Or, I just change /tmp to not be
> symlink, or maybe I can just set TMPDIR or something. Or, I just ssh and
> run Emacs on the remote machine, with 0 work :-).

OK, I'll continue to understand what happens. In the meantime, you might
be better with setting tramp-use-file-attributes to nil, globally. At
least it doesn't use the caches then.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 16:17:03 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 18:15:58 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
> Hi Gerd,
>
>>> Just wait! There's another nuisance worth to fix. Could you, pls, check?
>>
>> I'm afraid that's also not it. I can now boil it down to the following
>> test with emacs -Q (I'm always building without window system FWIW):
>>
>>   (file-writable-p "/ssh:mini:/tmp")
>>    => nil
>>   (file-writable-p (file-truename "/ssh:mini:/tmp"))
>>    => t
>>
>> where
>>
>>   (file-truename "/ssh:mini:/tmp")
>>    => "/ssh:mini:/private/tmp"
>
> Yes, this is the area I'm looking at. "/ssh:mini:/tmp" has file
> permissions lrwxr-xr-x, and "/ssh:mini:/private/tmp" has file
> permissions drwxrwxrwt. (file-writable-p "/ssh:mini:/tmp") should look
> at the permissions of the target, but it doesn't. It looks at the
> permissions of the symlink itself.

That's what I suspected..

> And everything is mixed happily with cached values, for performance
> speedup ...

...and there I got stuck :-)

>
>> Weird. With
>>
>>   (trace-function 'tramp-sh-handle-file-writable-p)
>>
>> I can see that this comes out of that function.
>>
>> Giving you access to "mini" is not an easy option, I'm afraid. It means
>> fighting with macOS network security, an area that I have virtually 0
>> experience with :-(.
>>
>> Anyway, maybe I can debug this. Or, I just change /tmp to not be
>> symlink, or maybe I can just set TMPDIR or something. Or, I just ssh and
>> run Emacs on the remote machine, with 0 work :-).
>
> OK, I'll continue to understand what happens. In the meantime, you might
> be better with setting tramp-use-file-attributes to nil, globally. At
> least it doesn't use the caches then.

Yeah, (setq tramp-use-file-attributes nil) makes it work. Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 16:55:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 18:53:55 +0200
[Message part 1 (text/plain, inline)]
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

>>> I'm afraid that's also not it. I can now boil it down to the following
>>> test with emacs -Q (I'm always building without window system FWIW):
>>>
>>>   (file-writable-p "/ssh:mini:/tmp")
>>>    => nil
>>>   (file-writable-p (file-truename "/ssh:mini:/tmp"))
>>>    => t
>>>
>>> where
>>>
>>>   (file-truename "/ssh:mini:/tmp")
>>>    => "/ssh:mini:/private/tmp"
>>
>> Yes, this is the area I'm looking at. "/ssh:mini:/tmp" has file
>> permissions lrwxr-xr-x, and "/ssh:mini:/private/tmp" has file
>> permissions drwxrwxrwt. (file-writable-p "/ssh:mini:/tmp") should look
>> at the permissions of the target, but it doesn't. It looks at the
>> permissions of the symlink itself.
>
> That's what I suspected..
>
>> And everything is mixed happily with cached values, for performance
>> speedup ...
>
> ...and there I got stuck :-)

Finally., I could reproduce the problem. There was the weirdness, that on
GNU/Linux I couldn't give a symlink the permissions 555 (your "/tmp"
symlink has it), and so I couldn't test. Fortunately, I remembered my
FreeBSD 14 VM, and there I could reproduce the problem.

The appended patch ought to fix it. Could you, pls, test?

>> OK, I'll continue to understand what happens. In the meantime, you might
>> be better with setting tramp-use-file-attributes to nil, globally. At
>> least it doesn't use the caches then.
>
> Yeah, (setq tramp-use-file-attributes nil) makes it work. Thanks!

Don't forget to revert this, testing may patch.

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 17:09:01 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 19:08:22 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
> Hi Gerd,
>
>>>> I'm afraid that's also not it. I can now boil it down to the following
>>>> test with emacs -Q (I'm always building without window system FWIW):
>>>>
>>>>   (file-writable-p "/ssh:mini:/tmp")
>>>>    => nil
>>>>   (file-writable-p (file-truename "/ssh:mini:/tmp"))
>>>>    => t
>>>>
>>>> where
>>>>
>>>>   (file-truename "/ssh:mini:/tmp")
>>>>    => "/ssh:mini:/private/tmp"
>>>
>>> Yes, this is the area I'm looking at. "/ssh:mini:/tmp" has file
>>> permissions lrwxr-xr-x, and "/ssh:mini:/private/tmp" has file
>>> permissions drwxrwxrwt. (file-writable-p "/ssh:mini:/tmp") should look
>>> at the permissions of the target, but it doesn't. It looks at the
>>> permissions of the symlink itself.
>>
>> That's what I suspected..
>>
>>> And everything is mixed happily with cached values, for performance
>>> speedup ...
>>
>> ...and there I got stuck :-)
>
> Finally., I could reproduce the problem. There was the weirdness, that on
> GNU/Linux I couldn't give a symlink the permissions 555 (your "/tmp"
> symlink has it), and so I couldn't test. Fortunately, I remembered my
> FreeBSD 14 VM, and there I could reproduce the problem.

Ah, interesting! Didn't know about that difference.

>
> The appended patch ought to fix it. Could you, pls, test?

Thanks, that works!

  (file-writable-p "/ssh:mini:/tmp")
   => t

and the Magit status buffer for the remote repository is shown without
the error. I'll test further with Magit in the next days. If I find
something, I'll submit new bugs for that.

I think this one can be considered fixed. Thanks!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 17:26:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 19:25:42 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

>> The appended patch ought to fix it. Could you, pls, test?
>
> Thanks, that works!
>
>   (file-writable-p "/ssh:mini:/tmp")
>    => t
>
> and the Magit status buffer for the remote repository is shown without
> the error. I'll test further with Magit in the next days. If I find
> something, I'll submit new bugs for that.
>
> I think this one can be considered fixed. Thanks!

Thanks for the feedback. Since it is a very low-level change, I'll run
my regression tests first. If everything goes fine, I'll push.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77402; Package emacs. (Mon, 31 Mar 2025 18:09:01 GMT) Full text and rfc822 format available.

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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 77402 <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Mon, 31 Mar 2025 20:07:51 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Thanks for the feedback. Since it is a very low-level change, I'll run
> my regression tests first. If everything goes fine, I'll push.

Fine with me, I'm not in a hurry. I'll just wait until the fix appears.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Tue, 01 Apr 2025 13:58:11 GMT) Full text and rfc822 format available.

Notification sent to Gerd Möllmann <gerd.moellmann <at> gmail.com>:
bug acknowledged by developer. (Tue, 01 Apr 2025 13:58:15 GMT) Full text and rfc822 format available.

Message #64 received at 77402-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77402-done <at> debbugs.gnu.org
Subject: Re: bug#77402: 31.0.50; Tramp: file-writable-p broken
Date: Tue, 01 Apr 2025 15:57:12 +0200
Version: 30.2

Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

Hi Gerd,

>> Thanks for the feedback. Since it is a very low-level change, I'll run
>> my regression tests first. If everything goes fine, I'll push.
>
> Fine with me, I'm not in a hurry. I'll just wait until the fix appears.

Done. I've extended the patch for the other Tramp backends. Pushed to
the emacs-30 branch, will appear in master after the next sync.

Closing the bug.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Apr 2025 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 52 days ago.

Previous Next


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