GNU bug report logs - #5436
23.1.91; Deleting directories causes unusable file layout in freedesktop trashcan

Previous Next

Package: emacs;

Reported by: Tassilo Horn <tassilo <at> member.fsf.org>

Date: Thu, 21 Jan 2010 12:55:01 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: David De La Harpe Golden <david <at> harpegolden.net>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Tassilo Horn <tassilo <at> member.fsf.org>, 5436 <at> debbugs.gnu.org
Subject: bug#5436: 23.1.91; Deleting directories causes unusable file layout in freedesktop trashcan
Date: Mon, 25 Jan 2010 23:33:06 +0000
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...)
















This bug report was last modified 15 years and 119 days ago.

Previous Next


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