Subject: Re: bug#54130: 29.0.50; TRAMP SSHFS can't visit remote files using absolute symlinks

From: Michael Albinus <[email-masked]>
Date: Thu, 24 Feb 2022 16:19:15 +0100

Version: 28.2

Philipp Stephani <[email-masked]> writes:

Hi Philipp,

> On a remote host REMOTE, create an arbitrary file and an absolute
> symlink to it:
>
> REMOTE$ echo hi > /tmp/a.txt
> REMOTE$ ln -svi /tmp/{a,b}.txt
>
> Visiting the symlink from another host using SSH works as expected:
>
> emacs -Q /ssh:REMOTE:/tmp/b.txt
>
> But the same fails with SSHFS:
>
> emacs -Q /sshfs:REMOTE:/tmp/b.txt
>
> TRAMP prints a message "File exists, but cannot be read", and the buffer
> stays empty.

SSHFS interprets symbolic links on the local host. An absolute file name
cannot work, therefore.

I've added ("-o" "transform_symlinks") to the tramp-mount-args of the
sshfs Tramp method. This shall fix it. Pls unmount any sshfs mounts
prior testing, otherwise it wouldn't work.

An alternative would be to use ("-o" "follow_symlinks"). But this has
the disadvantage that symbolic links look like regular files then, so I
haven't used it.

Pushed to the repositories. You'll find it on the master branch, and in
the upcoming GNU ELPA Tramp 2.5.2.2. Closing the bug.

Best regards, Michael.