bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44217: bug#44216: 28.0.50; Incorret during delete in Tramp: Trashing


From: Michael Albinus
Subject: bug#44217: bug#44216: 28.0.50; Incorret during delete in Tramp: Trashing...done
Date: Mon, 26 Oct 2020 14:11:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

Hi Lars,

>> I have the variable trash-directory set and files go to ~/tmp/Trash
>>
>> During Tramp ssh://example.com:~/ session I have delete a file and I can
>> see the message: Trashing...done which should not be during Tramp
>> session, as it gave me impression that file will be now transferred in
>> background to my local Trash directory which not the case. Not that I
>> have seen the file in Trash.

The message "Trashing...done" comes from dired, just because of the
rguments it calls delete-file with. This has nothing to do with what
Tramp does.

> Please try to give more detailed bug reports with recipes starting from
> "emacs -Q".
>
> I reproduced this bug by setting:
>
> (setq delete-by-moving-to-trash t
>       trash-directory "~/Trash/")
>
> and then going to "/ssh:other-host:/tmp/" and deleting a file.  As you
> say, the file isn't moved to ~/Trash.

How did you delete the file? You must give the optional argument TRASH a
non-nil value, as in

(delete-file "/ssh:other-host:/tmp/file" t)

> This is because:
>
> (defun tramp-get-remote-trash (vec)
>   "Determine remote `trash' command.
> This command is returned only if `delete-by-moving-to-trash' is non-nil."
>   (and delete-by-moving-to-trash
>        (with-tramp-connection-property vec "trash"
>        (tramp-message vec 5 "Finding a suitable `trash' command")
>        (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))))
>
> Tramp is looking for an executable on the remote host called "trash"?
> Which doesn't exist.

Yep. Btw, the "trash" command is part of the trash-cli package, which
exists for example for Ubuntu and Fedora.

> Shouldn't Tramp then move the file to `trash-directory' instead of
> giving up and just deleting the file?

Why that? `trash-directory' is defined as target for
`move_file_to_trash'; it has nothing to do with deleting of remote
files. And it would be a security flaw, if remote files would be moved
to the local "~/Trash" directory.

> If this is working as designed, it should at least be mentioned in the
> doc string(s) and the manual.

I believe it is mentioned. See the docstrings of `trash-directory' and
`move-file-to-trash'. Well, the latter might explicitly state that it is
not intended for remote files, but this is another game.

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]