all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David De La Harpe Golden <david@harpegolden.net>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: Tassilo Horn <tassilo@member.fsf.org>, 5436@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	[thread overview]
Message-ID: <4B5E2A32.6010306@harpegolden.net> (raw)
In-Reply-To: <87my02au2h.fsf@stupidchicken.com>

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...)


















  reply	other threads:[~2010-01-25 23:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 12:50 bug#5436: 23.1.91; Deleting directories causes unusable file layout in freedesktop trashcan Tassilo Horn
2010-01-22 16:20 ` Chong Yidong
2010-01-22 22:58   ` David De La Harpe Golden
2010-01-24  4:14   ` David De La Harpe Golden
2010-01-24  9:46     ` Tassilo Horn
2010-01-24 18:24     ` Eli Zaretskii
2010-01-24 20:19       ` David De La Harpe Golden
2010-01-24 20:25         ` David De La Harpe Golden
2010-01-25 19:00     ` Chong Yidong
2010-01-25 23:33       ` David De La Harpe Golden [this message]
2010-01-26 16:04         ` Chong Yidong
2010-01-27  0:06           ` David De La Harpe Golden
2010-01-27  4:10             ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B5E2A32.6010306@harpegolden.net \
    --to=david@harpegolden.net \
    --cc=5436@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.