GNU bug report logs - #74674
30.0.91; Can't delete an empty symlink when trashing is enabled for root

Previous Next

Package: emacs;

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

Date: Tue, 3 Dec 2024 19:54:02 UTC

Severity: normal

Found in version 30.0.91

To reply to this bug, email your comments to 74674 AT debbugs.gnu.org.

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#74674; Package emacs. (Tue, 03 Dec 2024 19:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to the_wurfkreuz <the_wurfkreuz <at> proton.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 Dec 2024 19:54:02 GMT) Full text and rfc822 format available.

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

From: the_wurfkreuz <the_wurfkreuz <at> proton.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 30.0.91;
 Can't delete an empty symlink when trashing is enabled for root
Date: Tue, 03 Dec 2024 19:51:35 +0000
[Message part 1 (text/plain, inline)]
If I evaluate the code to enable trashing for root and try to delete an empty symbolic link from Eshell, I get:
File is missing: /path/to/link

Steps to reproduce:

1. emacs -Q
2. M-: (connection-local-set-profile-variables 'remote-trash-directory '((trash-directory . "/sudo::~/.local/share/trash/")))
3. M-: (connection-local-set-profiles `(:application tramp :protocol "sudo" :machine ,(system-name)) 'remote-trash-directory)
4. M-x eshell
5. (require 'em-tramp)
6. (setq delete-by-moving-to-trash t)
7. sudo touch /usr/local/bin/test-file
8. ln -s /sudo::/usr/local/bin/test-file /sudo::/usr/local/bin/test-file-line
9. sudo rm /usr/local/bin/test-file
10. sudo rm /usr/local/bin/test-file-line

"File is missing: /usr/local/bin/test-file-link".

Expected behavior:

I'm able to delete it.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74674; Package emacs. (Wed, 04 Dec 2024 20:48:02 GMT) Full text and rfc822 format available.

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

From: the_wurfkreuz <the_wurfkreuz <at> proton.me>
To: "74674 <at> debbugs.gnu.org" <74674 <at> debbugs.gnu.org>
Subject: (No Subject)
Date: Wed, 04 Dec 2024 20:47:26 +0000
[Message part 1 (text/plain, inline)]
The problem got even more complicated. Now i'm trying to just delete any file, and i can't do that whether i have trashing enabled or not:

~/.emacs.d $ (require 'em-tramp)
em-tramp
~/.emacs.d [1] $ eshell/sudo touch /usr/local/bin/test-file
~/.emacs.d $ eshell/sudo rm /usr/local/bin/test-fileRemoving old name: Permission denied, /usr/local/bin/test-file
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74674; Package emacs. (Fri, 06 Dec 2024 17:36:02 GMT) Full text and rfc822 format available.

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

From: the_wurfkreuz <the_wurfkreuz <at> proton.me>
To: "74674 <at> debbugs.gnu.org" <74674 <at> debbugs.gnu.org>
Subject: (No Subject)
Date: Fri, 06 Dec 2024 17:35:00 +0000
[Message part 1 (text/plain, inline)]
I can delete the file if i just use /usr/bin/rm instead.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74674; Package emacs. (Mon, 09 Dec 2024 01:51:03 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: the_wurfkreuz <the_wurfkreuz <at> proton.me>, 74674 <at> debbugs.gnu.org
Cc: Jim Porter <jporterbugs <at> gmail.com>
Subject: Re: bug#74674: 30.0.91; Can't delete an empty symlink when trashing
 is enabled for root
Date: Sun, 8 Dec 2024 20:49:01 -0500
the_wurfkreuz via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> If I evaluate the code to enable trashing for root and try to delete an empty symbolic link from Eshell, I get:
> File is missing: /path/to/link
>
> Steps to reproduce:
>
> 1. emacs -Q
> 2. M-: (connection-local-set-profile-variables 'remote-trash-directory '((trash-directory . "/sudo::~/.local/share/trash/")))
> 3. M-: (connection-local-set-profiles `(:application tramp :protocol "sudo" :machine ,(system-name)) 'remote-trash-directory)
> 4. M-x eshell
> 5. (require 'em-tramp)
> 6. (setq delete-by-moving-to-trash t)
> 7. sudo touch /usr/local/bin/test-file
> 8. ln -s /sudo::/usr/local/bin/test-file /sudo::/usr/local/bin/test-file-line
> 9. sudo rm /usr/local/bin/test-file
> 10. sudo rm /usr/local/bin/test-file-line
>
> "File is missing: /usr/local/bin/test-file-link".
>
> Expected behavior:
>
> I'm able to delete it.

I'm copying in Jim Porter.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74674; Package emacs. (Mon, 09 Dec 2024 02:06:02 GMT) Full text and rfc822 format available.

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

From: Jim Porter <jporterbugs <at> gmail.com>
To: the_wurfkreuz <the_wurfkreuz <at> proton.me>,
 "74674 <at> debbugs.gnu.org" <74674 <at> debbugs.gnu.org>
Subject: Re: bug#74674: (No Subject)
Date: Sun, 8 Dec 2024 18:04:08 -0800
On 12/4/2024 12:47 PM, the_wurfkreuz via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> The problem got even more complicated. Now i'm trying to just delete any 
> file, and i can't do that whether i have trashing enabled or not:
> 
> ~/.emacs.d $ (require 'em-tramp)
> em-tramp
> ~/.emacs.d [1] $ eshell/sudo touch /usr/local/bin/test-file
> ~/.emacs.d $ eshell/sudo rm /usr/local/bin/test-file
> Removing old name: Permission denied, /usr/local/bin/test-file

This is the correct behavior; you shouldn't be able to delete the file 
using this method. In short, "/usr/local/bin/test-file" refers to a 
*local* file name, so it's not going through Tramp's "sudo" method, and 
thus it's correct to report that you don't have permission.

Some more detail: Eshell built-in commands like "rm" (which the built-in 
"eshell/sudo" will call) treat absolute file names as ordinary, local 
files, just like the rest of Emacs would. Specifically, it won't 
automatically prepend the "/sudo::" method to it. Doing that is 
bug#70792, which I have a patch for but haven't finished yet.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74674; Package emacs. (Thu, 02 Jan 2025 01:55:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: "74674 <at> debbugs.gnu.org" <74674 <at> debbugs.gnu.org>,
 the_wurfkreuz <the_wurfkreuz <at> proton.me>
Subject: Re: bug#74674: 30.0.91; Can't delete an empty symlink when trashing
 is enabled for root
Date: Wed, 1 Jan 2025 19:53:58 -0600
Jim Porter <jporterbugs <at> gmail.com> writes:

> On 12/4/2024 12:47 PM, the_wurfkreuz via Bug reports for GNU Emacs, the Swiss
> army knife of text editors wrote:
>> The problem got even more complicated. Now i'm trying to just delete any file,
>> and i can't do that whether i have trashing enabled or not:
>> ~/.emacs.d $ (require 'em-tramp)
>> em-tramp
>> ~/.emacs.d [1] $ eshell/sudo touch /usr/local/bin/test-file
>> ~/.emacs.d $ eshell/sudo rm /usr/local/bin/test-file
>> Removing old name: Permission denied, /usr/local/bin/test-file
>
> This is the correct behavior; you shouldn't be able to delete the file using
> this method. In short, "/usr/local/bin/test-file" refers to a *local* file name,
> so it's not going through Tramp's "sudo" method, and thus it's correct to report
> that you don't have permission.
>
> Some more detail: Eshell built-in commands like "rm" (which the built-in
> "eshell/sudo" will call) treat absolute file names as ordinary, local files,
> just like the rest of Emacs would. Specifically, it won't automatically prepend
> the "/sudo::" method to it. Doing that is bug#70792, which I have a patch for
> but haven't finished yet.

Should the bugs be merged perhaps?




This bug report was last modified 164 days ago.

Previous Next


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