GNU bug report logs - #76678
31.0.50; Can't trash broken links

Previous Next

Package: emacs;

Reported by: the_wurfkreuz <the_wurfkreuz <at> proton.me>

Date: Sun, 2 Mar 2025 09:36:01 UTC

Severity: normal

Found in version 31.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 76678 <at> debbugs.gnu.org, the_wurfkreuz <the_wurfkreuz <at> proton.me>
Subject: bug#76678: 31.0.50; Can't trash broken links
Date: Tue, 04 Mar 2025 08:42:13 +0100
Stefan Kangas <stefankangas <at> gmail.com> writes:

Hi Stefan,

>> 3. Create a file and symlink it to /usr/local/bin.
>> 4. Delete the file, but not the symlink.
>> 5. Go to /usr/local/bin using find-file command.
>> 6. Execute 'tramp-revert-buffer-with-sudo'.
>> 7. Execute 'dired-do-delete' on the broken symlink.
>
> Michael, could you please take a look at this?

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.

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.

Best regards, Michael.




This bug report was last modified 67 days ago.

Previous Next


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