GNU bug report logs -
#14967
24.3.50; package-delete deletes by trashing?
Previous Next
Reported by: Sebastian Wiesner <lunaryorn <at> gmail.com>
Date: Sat, 27 Jul 2013 11:36:02 UTC
Severity: wishlist
Tags: notabug
Found in version 24.3.50
Fixed in version 26.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14967 in the body.
You can then email your comments to 14967 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Sat, 27 Jul 2013 11:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sebastian Wiesner <lunaryorn <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 27 Jul 2013 11:36:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Currently "package-delete" from package.el is implemented as follows:
(defun package-delete (pkg-desc)
(let ((dir (package-desc-dir pkg-desc)))
(if (not (string-prefix-p (file-name-as-directory
(expand-file-name package-user-dir))
(expand-file-name dir)))
;; Don't delete "system" packages.
(error "Package `%s' is a system package, not deleting"
(package-desc-full-name pkg-desc))
(delete-directory dir t t)
;; Update package-alist.
(let* ((name (package-desc-name pkg-desc)))
(delete pkg-desc (assq name package-alist)))
(message "Package `%s' deleted." (package-desc-full-name
pkg-desc)))))
Note that the call to "delete-directory" gives t as the 3rd argument,
thus allowing for deletion by moving to trash depending on
"delete-by-moving-to-trash".
Is that intended behavior? If so, what is the rationale behind it?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 29 Jul 2013 22:03:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Sebastian Wiesner wrote:
> Note that the call to "delete-directory" gives t as the 3rd argument,
> thus allowing for deletion by moving to trash depending on
> "delete-by-moving-to-trash".
>
> Is that intended behavior? If so, what is the rationale behind it?
I guess. Don't know. Maybe so you can undo a delete?
What's the bug?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Tue, 30 Jul 2013 10:52:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 14967 <at> debbugs.gnu.org (full text, mbox):
2013/7/30 Glenn Morris <rgm <at> gnu.org>:
> Sebastian Wiesner wrote:
>
>> Note that the call to "delete-directory" gives t as the 3rd argument,
>> thus allowing for deletion by moving to trash depending on
>> "delete-by-moving-to-trash".
>>
>> Is that intended behavior? If so, what is the rationale behind it?
>
> I guess. Don't know. Maybe so you can undo a delete?
>
> What's the bug?
Well, obviously I consider this behavior a bug. Trash is no place for
deleted packages. I mean, does apt-get remove use the Trash?!
Undoing package removal by simply restoring from Trash does not work
reliably anyway, so what's the point of this, despite cluttering the
user's trash can?
PS: Please excuse the duplicate mail. I had accidentally only mailed
you directly, and forgot to CC debbugs. Sorry for any inconvenience.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Tue, 30 Jul 2013 14:22:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 14967 <at> debbugs.gnu.org (full text, mbox):
> Well, obviously I consider this behavior a bug. Trash is no place for
> deleted packages. I mean, does apt-get remove use the Trash?!
I think the reasoning goes as follows:
Emacs uses "trash" when deleting a file upon the user's request (as
opposed to things like temp files used internally).
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Tue, 30 Jul 2013 14:42:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 14967 <at> debbugs.gnu.org (full text, mbox):
2013/7/30 Stefan Monnier <monnier <at> iro.umontreal.ca>:
>> Well, obviously I consider this behavior a bug. Trash is no place for
>> deleted packages. I mean, does apt-get remove use the Trash?!
>
> I think the reasoning goes as follows:
> Emacs uses "trash" when deleting a file upon the user's request (as
> opposed to things like temp files used internally).
Emacs doesn't delete “files” here, it deletes “packages”. Yes,
packages are just a bunch of files in the end, but conceptually a
package is not just a plain bunch of files. It is a complex opaque
data structure providing Emacs Lisp code, with some complex
management/activation logic behind.
For this reason, a package can't be treated as a plain directory with
files. For instance, restoring a package from trash doesn't restore
the package for any running Emacs session, simply because "package.el"
doesn't know about it.
Also, "package-delete" may be called in situations other than an
explicit user request.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Tue, 30 Jul 2013 15:25:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 14967 <at> debbugs.gnu.org (full text, mbox):
> For this reason, a package can't be treated as a plain directory with
> files.
It's pretty close, tho.
> For instance, restoring a package from trash doesn't restore
> the package for any running Emacs session,
I'm not sure what you mean. Let's say you have a running
Emacs session. What's the difference between:
- restore the package from trash.
and
- start a new Emacs session, (re)install the package, exit.
AFAIK, the running Emacs session will be affected in exactly the
same way.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Fri, 05 Aug 2016 23:41:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 14967 <at> debbugs.gnu.org (full text, mbox):
tags 14967 notabug
quit
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> For this reason, a package can't be treated as a plain directory with
>> files.
>
> It's pretty close, tho.
>
>> For instance, restoring a package from trash doesn't restore
>> the package for any running Emacs session,
>
> I'm not sure what you mean. Let's say you have a running
> Emacs session. What's the difference between:
> - restore the package from trash.
> and
> - start a new Emacs session, (re)install the package, exit.
> AFAIK, the running Emacs session will be affected in exactly the
> same way.
Hence notabug, I guess?
Added tag(s) notabug.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Fri, 05 Aug 2016 23:41:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Sat, 03 Sep 2016 04:07:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> Well, obviously I consider this behavior a bug. Trash is no place for
>> deleted packages. I mean, does apt-get remove use the Trash?!
>
> I think the reasoning goes as follows:
> Emacs uses "trash" when deleting a file upon the user's request (as
> opposed to things like temp files used internally).
>
>
> Stefan
Could there perhaps be a separate configuration option for deleting
packages versus trashing them? I usually like Emacs using the trash, but
I don't see a reason why packages should go there myself.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Sun, 11 Jun 2017 23:57:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 14967 <at> debbugs.gnu.org (full text, mbox):
severity 14967 wishlist
quit
Alex <agrambot <at> gmail.com> writes:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>>> Well, obviously I consider this behavior a bug. Trash is no place for
>>> deleted packages. I mean, does apt-get remove use the Trash?!
>>
>> I think the reasoning goes as follows:
>> Emacs uses "trash" when deleting a file upon the user's request (as
>> opposed to things like temp files used internally).
>
> Could there perhaps be a separate configuration option for deleting
> packages versus trashing them? I usually like Emacs using the trash, but
> I don't see a reason why packages should go there myself.
Seems reasonable.
Severity set to 'wishlist' from 'minor'
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 11 Jun 2017 23:57:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 03:27:01 GMT)
Full text and
rfc822 format available.
Message #36 received at 14967 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
npostavs <at> users.sourceforge.net writes:
> severity 14967 wishlist
> quit
>
> Alex <agrambot <at> gmail.com> writes:
>
>> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>
>>>> Well, obviously I consider this behavior a bug. Trash is no place for
>>>> deleted packages. I mean, does apt-get remove use the Trash?!
>>>
>>> I think the reasoning goes as follows:
>>> Emacs uses "trash" when deleting a file upon the user's request (as
>>> opposed to things like temp files used internally).
>>
>> Could there perhaps be a separate configuration option for deleting
>> packages versus trashing them? I usually like Emacs using the trash, but
>> I don't see a reason why packages should go there myself.
>
> Seems reasonable.
Here's a patch for it.
[0001-Make-package-delete-conditionally-not-use-the-trash.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 14:29:01 GMT)
Full text and
rfc822 format available.
Message #39 received at 14967 <at> debbugs.gnu.org (full text, mbox):
> From: Alex <agrambot <at> gmail.com>
> Date: Sun, 11 Jun 2017 21:26:20 -0600
> Cc: Sebastian Wiesner <lunaryorn <at> gmail.com>,
> Stefan Monnier <monnier <at> iro.umontreal.ca>, 14967 <at> debbugs.gnu.org
>
> Here's a patch for it.
Thanks.
> +*** The new variable 'package-trash-old-packages' has been added to
> +control whether or not 'package-delete' trashes old packages files.
This should say something about the default behavior.
> +(defvar package-trash-old-packages t
> + "If non-nil, `package-delete' may trash packages.
Why "may"?
> +`delete-by-moving-to-trash' must be non-nil for this variable to
> +have an effect.")
I think it would be better to make this defcustom.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 16:04:01 GMT)
Full text and
rfc822 format available.
Message #42 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Does anyone actually want deleted packages to go to trash?
Yours-concerned-about-yet-another-option-ly,
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 16:34:02 GMT)
Full text and
rfc822 format available.
Message #45 received at 14967 <at> debbugs.gnu.org (full text, mbox):
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: Alex <agrambot <at> gmail.com>, lunaryorn <at> gmail.com, monnier <at> iro.umontreal.ca, 14967 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
> Date: Mon, 12 Jun 2017 12:03:05 -0400
>
>
> Does anyone actually want deleted packages to go to trash?
Do you or did you ever use the trash facility? Because there are
people who never ever actually delete files, only move them to trash.
(No, I'm not one of them, but I hardly matter in this case.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 16:57:02 GMT)
Full text and
rfc822 format available.
Message #48 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
> Do you or did you ever use the trash facility?
No. But the people who do and commented in this report don't want it to
apply to packages. So I think it's worth thinking, before adding a new
option, if anyone actually wants the current behaviour.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 17:03:02 GMT)
Full text and
rfc822 format available.
Message #51 received at 14967 <at> debbugs.gnu.org (full text, mbox):
>> Do you or did you ever use the trash facility?
> No. But the people who do and commented in this report don't want it to
> apply to packages. So I think it's worth thinking, before adding a new
> option, if anyone actually wants the current behaviour.
I'm the kind of user who'd rather alias "rm" to "rm -f" than to "rm -i"
and then rely on automated backups. And since the "trash" system is not
an automated backup in my view, I indeed have no idea if there are users
who'd want package.el to use the trash.
And I agree it's worth asking.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 17:06:01 GMT)
Full text and
rfc822 format available.
Message #54 received at 14967 <at> debbugs.gnu.org (full text, mbox):
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: agrambot <at> gmail.com, lunaryorn <at> gmail.com, monnier <at> iro.umontreal.ca, 14967 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
> Date: Mon, 12 Jun 2017 12:56:08 -0400
>
> Eli Zaretskii wrote:
>
> > Do you or did you ever use the trash facility?
>
> No. But the people who do and commented in this report don't want it to
> apply to packages. So I think it's worth thinking, before adding a new
> option, if anyone actually wants the current behaviour.
Fine with me. All I said was that if we do add a variable, it should
be a defcustom; defvar makes little sense to me.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 17:18:02 GMT)
Full text and
rfc822 format available.
Message #57 received at 14967 <at> debbugs.gnu.org (full text, mbox):
>> No. But the people who do and commented in this report don't want it to
>> apply to packages. So I think it's worth thinking, before adding a new
>> option, if anyone actually wants the current behaviour.
> Fine with me. All I said was that if we do add a variable, it should
> be a defcustom; defvar makes little sense to me.
Maybe the most effective way to "ask" users is to just change the code
so it doesn't use the trash system (mentioning it in NEWS, of course).
And then wait to see if someone complains.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 19:39:01 GMT)
Full text and
rfc822 format available.
Message #60 received at 14967 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> +(defvar package-trash-old-packages t
>> + "If non-nil, `package-delete' may trash packages.
>
> Why "may"?
Since after this patch, `package-delete' may trash packages, or may not,
depending on the value of `delete-by-moving-to-trash'.
>> +`delete-by-moving-to-trash' must be non-nil for this variable to
>> +have an effect.")
>
> I think it would be better to make this defcustom.
Right, I forgot to do that. I updated and attached a new patch.
[0001-Make-package-delete-conditionally-not-use-the-trash.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 19:47:01 GMT)
Full text and
rfc822 format available.
Message #63 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
>>> No. But the people who do and commented in this report don't want it to
>>> apply to packages. So I think it's worth thinking, before adding a new
>>> option, if anyone actually wants the current behaviour.
>> Fine with me. All I said was that if we do add a variable, it should
>> be a defcustom; defvar makes little sense to me.
>
> Maybe the most effective way to "ask" users is to just change the code
> so it doesn't use the trash system (mentioning it in NEWS, of course).
> And then wait to see if someone complains.
>
>
> Stefan
Is that a good idea for new behaviour that results in potential data
loss (from the view of a user that expects `package-delete' to trash
files rather than outright deleting them)? It might be easy to gloss
over an entry in NEWS, after all.
I don't like the default behaviour myself, so I don't personally care
either way.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 12 Jun 2017 20:33:01 GMT)
Full text and
rfc822 format available.
Message #66 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Alex wrote:
> Is that a good idea for new behaviour that results in potential data
> loss (from the view of a user that expects `package-delete' to trash
> files rather than outright deleting them)? It might be easy to gloss
> over an entry in NEWS, after all.
IMO there's no real potential for data loss, since you can just
reinstall the package from its source. (I assume this is what people do
in practice, rather than un-trashing.) Although "source is no longer
available" is in theory possible, in practice I don't think it's a real
concern.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Tue, 13 Jun 2017 03:51:01 GMT)
Full text and
rfc822 format available.
Message #69 received at 14967 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> gnu.org> writes:
> Alex wrote:
>
>> Is that a good idea for new behaviour that results in potential data
>> loss (from the view of a user that expects `package-delete' to trash
>> files rather than outright deleting them)? It might be easy to gloss
>> over an entry in NEWS, after all.
>
> IMO there's no real potential for data loss, since you can just
> reinstall the package from its source. (I assume this is what people do
> in practice, rather than un-trashing.) Although "source is no longer
> available" is in theory possible, in practice I don't think it's a real
> concern.
Usually, though someone might have edited packages inside
package-user-dir and might be saved from an accidental deletion by the
trash can (this happened to me once or twice). If this is deemed to be
too uncommon (it probably is), then it probably won't be too bad to just
make package-delete always delete.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Wed, 14 Jun 2017 02:55:01 GMT)
Full text and
rfc822 format available.
Message #72 received at 14967 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> And since the "trash" system is not
> an automated backup in my view, I indeed have no idea if there are users
> who'd want package.el to use the trash.
Poll the users?
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14967
; Package
emacs
.
(Mon, 19 Jun 2017 18:49:01 GMT)
Full text and
rfc822 format available.
Message #75 received at 14967 <at> debbugs.gnu.org (full text, mbox):
I've applied the following.
IMO if Emacs wants to behave like system package managers (eg yum, apt),
it should (optionally) cache the _source_ when it downloads a package.
Then use that (if appropriate) if asked to (re)install.
commit 65b323e (HEAD, master)
Date: Mon Jun 19 14:39:25 2017 -0400
Don't put deleted packages in the trash (bug#14967)
* lisp/emacs-lisp/package.el (package-delete):
Don't pay attention to delete-by-moving-to-trash.
; * etc/NEWS: Mention this.
diff --git a/etc/NEWS b/etc/NEWS
index 85d1273..78d37484 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -755,6 +755,9 @@ header's value.
where the GnuPG home directory (used for signature verification) is
located and whether GnuPG's option "--homedir" is used or not.
+---
+*** Deleting a package no longer respects 'delete-by-moving-to-trash'.
+
** Tramp
+++
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index bebfd18..4245294 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2127,7 +2127,7 @@ If NOSAVE is non-nil, the package is not removed from
(package-desc-name pkg-used-elsewhere-by)))
(t
(add-hook 'post-command-hook #'package-menu--post-refresh)
- (delete-directory dir t t)
+ (delete-directory dir t)
;; Remove NAME-VERSION.signed and NAME-readme.txt files.
(dolist (suffix '(".signed" "readme.txt"))
(let* ((version (package-version-join (package-desc-version pkg-desc)))
bug marked as fixed in version 26.1, send any further explanations to
14967 <at> debbugs.gnu.org and Sebastian Wiesner <lunaryorn <at> gmail.com>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 19 Jun 2017 18:49:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 18 Jul 2017 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 29 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.