From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David De La Harpe Golden Newsgroups: gmane.emacs.bugs Subject: bug#5436: 23.1.91; Deleting directories causes unusable file layout in freedesktop trashcan Date: Mon, 25 Jan 2010 23:33:06 +0000 Message-ID: <4B5E2A32.6010306@harpegolden.net> References: <87ljfqkt6e.fsf@stupidchicken.com> <4B5BC912.3050409@harpegolden.net> <87my02au2h.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1264462818 8763 80.91.229.12 (25 Jan 2010 23:40:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2010 23:40:18 +0000 (UTC) Cc: Tassilo Horn , 5436@debbugs.gnu.org To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 26 00:40:10 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NZYXR-00043T-Mm for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Jan 2010 00:40:10 +0100 Original-Received: from localhost ([127.0.0.1]:53045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZYXS-0004BR-TJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jan 2010 18:40:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZYXC-00046l-SF for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2010 18:39:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZYX8-00045x-2s for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2010 18:39:54 -0500 Original-Received: from [199.232.76.173] (port=41545 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZYX7-00045u-T0 for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2010 18:39:49 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33889) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NZYX7-0006AC-9r for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2010 18:39:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NZYRV-0000q1-W3; Mon, 25 Jan 2010 18:34:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: David De La Harpe Golden Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Jan 2010 23:34:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5436 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5436-submit@debbugs.gnu.org id=B5436.12644624083198 (code B ref 5436); Mon, 25 Jan 2010 23:34:01 +0000 Original-Received: (at 5436) by debbugs.gnu.org; 25 Jan 2010 23:33:28 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZYQx-0000pX-9D for submit@debbugs.gnu.org; Mon, 25 Jan 2010 18:33:27 -0500 Original-Received: from harpegolden.net ([65.99.215.13]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZYQj-0000pL-5X for 5436@debbugs.gnu.org; Mon, 25 Jan 2010 18:33:25 -0500 Original-Received: from [87.198.54.86] (87-198-54-86.ptr.magnet.ie [87.198.54.86]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTP id 77AD08A53; Mon, 25 Jan 2010 23:33:08 +0000 (GMT) User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) In-Reply-To: <87my02au2h.fsf@stupidchicken.com> X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -2.6 (--) Resent-Date: Mon, 25 Jan 2010 18:34:01 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:34712 Archived-At: Chong Yidong wrote: > I don't think it's wise to make this drastic change to rename-file so > late in the release process. Is it necessary for fixing this particular > issue (Bug#5436)? If not, we should only apply the delete-directory > change. Hmm. I suppose strictly it is not necessary to fix the precise issue - partial or total failure to delete isn't the same as successfully deleting but with a bad layout in the trash. Just the delete-directory change _is_ a marked improvement, since it does mean that the subsequent failure mode when you try to delete from a different filesystem to your /home is less obnoxious: - Without the delete-directory change, the xdev behaviour is very bad indeed: Say you have /usr/local and /home on different filesystems, as is quite common, and you delete-directory a tree in /usr/local with delete-by-moving-to-trash on - first, a few leaf regular files from a dir of the tree may be moved to trash (flattened), and only a bit later the operation will fail, when the first directory rename is attempted. Leaving behind a (maybe large) tree that might look untouched to casual inspection following an apparently-failed deletion operation, but actually with a few files missing, moved to the trash. Eek. - With the delete-directory change but without the rename-file change (or something else*), deleting from /usr/local will still fail, just pretty much immediately instead of making such a mess. * There are also alternatives to expanding rename-file to handle xdev directory renames: 1. move-file-to-trash could just use a copy-directory and then a delete-directory itself in the case it is passed a directory, which would be obviously less efficient in the same-filesystem case, but wouldn't fail nearly as easily as the untouched situation. If it's easy to tell if directories are on the same filesystem from within elisp (which I haven't looked into yet), it could use rename-file where possible. +++ That approach might squeeze in? copy-directory and delete-directory in themselves aren't as new. 2. could introduce a separate function capable of renaming directories xdev? After all, copy-file and copy-directory and delete-file and delete-directory are separated. move-file-to-trash could easily call, say, a "rename-directory" for directories and rename-file for files. Of course rename-file does work _sometimes_ on directories, just not xdev (someone apparently hacked it to work xdev for files at some stage...) - I suppose a note could be added to the rename-file docstring saying that if you want directory renames that work xdev you should really use rename-directory. A separate rename-directory function might facilitate dealing with complex cases. (And/or there could be separate move-file-to-trash and move-directory-to-trash functions, or for naming regularity, move-file-to-trash could still handle both but be renamed move-to-trash...)