From david@harpegolden.net Fri May 22 16:11:04 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 22 May 2009 23:11:05 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.6 required=4.0 tests=AWL,SPF_HELO_PASS autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from harpegolden.net (harpegolden.net [65.99.215.13]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4MNAxgO002944 for ; Fri, 22 May 2009 16:11:00 -0700 Received: from [87.198.54.59] (87-198-54-59.ptr.magnet.ie [87.198.54.59]) (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 D4AE88274 for ; Sat, 23 May 2009 00:10:58 +0100 (IST) Message-ID: <4A1730F8.7060708@harpegolden.net> Date: Sat, 23 May 2009 00:10:48 +0100 From: David De La Harpe Golden User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: submit@debbugs.gnu.org Subject: rename-file being called on directories for cross-device rename, mostly during trashing... Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sorry about timing, first time I had to investigate - not sure this is release-critical - haven't proved it can really cause data loss, but it's at least surprising. I don't really use trashing myself, but noticed something was acting funny a while back: On a gnu+linux or other unix-like system: To replicate, you'll need two distinct mounted filesystems - I'll assume /home and /tmp as they're often separate filesystems Set delete-by-moving-to-trash non-nil Now both delete-file and delete-directory will call move-file-to-trash to do their deletion. Point your trash-directory to a subdir on one filesystem - the default ~/.Trash/ may well be fine. Make a directory on another filesystem, say mkdir /tmp/uhoh/ Now try to M-x delete-directory /tmp/uhoh/ Get an error: Non-regular file: is a directory, /tmp/uhoh ... But of course you know it's a directory, and you are now puzzled as to why it didn't delete. Do the same with delete-by-moving-to-trash turned off, and the directory will be deleted as one would expect. This is happening because move-file-to-trash is calling rename-file with the directory name, and then rename-file is blindly trying to copy-file the directory if the C-level rename() fails with EXDEV (around line 2269 in fileio.c) as it tries to emulate a rename for the regular file case. Some possible paths to addressing this issue (non-exhaustive...): 1. have move-file-to-trash check if the file is a directory before trying to rename-file it. The issue here is rename-file actually works fine on directories as-is so long as you don't try to rename them across filesystems. 2. make rename-file not blindly copy-file directories but throw an error about renaming directories cross-device not being supported on the platform. That might be "good enough" as a placeholder for the 23.1 release, would at least be less confusing than the "Non-regular file: is a directory" error. 3. make rename-file not blindly copy-file directories but work more like shell "mv". Right now it acts a bit like mv for regular files (emulates move with the problematic copy and delete), but like C-level rename() for directories (bombs out...) (3a. Or make a separate rename-directory that move-file-to-trash can call for directories...) 4. make copy-file do something for directories other than simply noticing it's a directory and giving up, like shell "cp -r". (4a. Or make a separate copy-directory that rename-file (or 3a's rename-directory) could call underneath) From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 26 23:10:59 2010 Received: (at 3353) by debbugs.gnu.org; 27 Jan 2010 04:11:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZzF5-0004oX-4r for submit@debbugs.gnu.org; Tue, 26 Jan 2010 23:10:59 -0500 Received: from pantheon-po29.its.yale.edu ([130.132.50.124]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZzF2-0004oN-Lb; Tue, 26 Jan 2010 23:10:57 -0500 Received: from furry (adsl-99-58-201-143.dsl.wlfrct.sbcglobal.net [99.58.201.143]) (authenticated bits=0) by pantheon-po29.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o0R4Aqdw002844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 26 Jan 2010 23:10:53 -0500 Received: by furry (Postfix, from userid 1000) id 79ECCC05D; Tue, 26 Jan 2010 21:10:52 -0700 (MST) From: Chong Yidong To: David De La Harpe Golden Subject: Re: bug#5436: 23.1.91; Deleting directories causes unusable file layout in freedesktop trashcan References: <87ljfqkt6e.fsf@stupidchicken.com> <4B5BC912.3050409@harpegolden.net> <87my02au2h.fsf@stupidchicken.com> <4B5E2A32.6010306@harpegolden.net> <87ockghmy6.fsf@stupidchicken.com> <4B5F8373.7080004@harpegolden.net> Date: Tue, 26 Jan 2010 23:10:52 -0500 In-Reply-To: <4B5F8373.7080004@harpegolden.net> (David De La Harpe Golden's message of "Wed, 27 Jan 2010 00:06:11 +0000") Message-ID: <87y6jkfar7.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 3353 Cc: Tassilo Horn , 3353@debbugs.gnu.org, 5436@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) David De La Harpe Golden writes: > Chong Yidong wrote: > >> I understand what you are saying. How about conditioning the >> delete-directory change on delete-by-moving-to-trash? > > Unless I'm misunderstanding you (or did you mean the rename-file > change?*): Sorry, I meant the rename-file change. However, after looking carefully at the change, I think it is OK. I've commited it to the respository. Thank you for your work on this. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 26 23:12:09 2010 Received: (at control) by debbugs.gnu.org; 27 Jan 2010 04:12:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZzGD-0004pa-Ao for submit@debbugs.gnu.org; Tue, 26 Jan 2010 23:12:09 -0500 Received: from pantheon-po33.its.yale.edu ([130.132.50.94]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZzGB-0004pS-Ko for control@debbugs.gnu.org; Tue, 26 Jan 2010 23:12:08 -0500 Received: from furry (adsl-99-58-201-143.dsl.wlfrct.sbcglobal.net [99.58.201.143]) (authenticated bits=0) by pantheon-po33.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o0R4C3P4000901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 26 Jan 2010 23:12:04 -0500 Received: by furry (Postfix, from userid 1000) id E2CB2C05D; Tue, 26 Jan 2010 21:12:03 -0700 (MST) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 3353 Date: Tue, 26 Jan 2010 23:12:03 -0500 Message-ID: <87vdeo2nl8.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.0 (----) close 3353 close 5436 thanks From unknown Sat Aug 09 15:53:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 24 Feb 2010 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator