Subject: Re: bug#76678: 31.0.50; Can't trash broken links

From: Michael Albinus <[email-masked]>
Date: Sun, 16 Mar 2025 14:23:57 +0100

Vesion: 30.2

Hi,

>> I'm working already on this for two days. It is simple to reproduce, and
>> I have already extended tramp-tests.el for this case. This helps me also
>> debugging.
>>
>> However, the fix isn't easy. Finally, the problem is a subtle behavior
>> of file-exists-p. If it is called with a symlinked file, valid target,
>> it returns t. If the target doesn't exist, it returns nil.
>>
>> The Tramp implementation returns always t, whether the target exists
>> or not. Wrong.
>
> Subtle behaviour, indeed.
>
>> I've fixed tramp-sh-handle-file-exists-p accordingly. But now, since
>> file-exists-p is used everywhere in Tramp, I must test everything.
>> Sometimes the changed implementation results in new errors, and I must
>> change code to '(or (file-exists-p filename) (file-symlinkp
>> filename))' at places, which have used a simple '(file-exists-p
>> filename)' before.
>>
>> This will take time.
>
> Thanks for looking into this.

Finally, I've applied needed changes to all Tramp backends. Tests pass,
so I have pushed it to master.

Will also be available with next Tramp 2.7.2.3 later this month on GNU
ELPA. This is also planned for merge with the emacs-30 branch.

Closing the bug.

Best regards, Michael.