Package: emacs Version: 23.0.60 Severity: normal Tags: patch Steps to reproduce: Turn on delete-by-moving-to-trash on gnu+linux. Make a file on a different filesystem to your home dir. Try to delete-file the file in emacs once. Look inside ~/.Trash, full of hundreds of redundant copies of the file. Reason: When delete-by-moving-to-trash is on, delete-file calls move-file-to-trash. move-file-to-trash, when using its fallback emacs trashcan implementation* (i.e. when there's no system-move-file-to-trash) picks a name for the trashed file, and calls rename-file. rename-file tries a C rename(), but that doesn't work cross-device on gnu+linux (and several other OSes), so rename-file falls back to copying the file to the new name, and then calls delete-file to get rid of the old one (~line 2247 of fileio.c) move-file-to-trash decides the existing filename under .Trash is taken, seeing as a file exists with that name, picks a new name, and calls rename-file again... ... Lather, rinse, repeat, until emacs gets bored with a "Variable binding depth exceeds max-specpdl-size" Fix?: (i) Well, binding delete-by-moving-to-trash to nil around the rename-file in move-file-to-trash might be adequate, fixes immediate issue? trivial patch attached. Though another strikes me: (ii) As it stands, won't an actual rename-file will sometimes move a copy of "renamed" files to trash (i.e. when they're on a different device) if delete-by-moving-to-trash is on? Not sure that's very nice - maybe should bind delete-by-moving-to-trash to nil around its call to delete-file, or maybe just use C unlink()? * which really isn't suitable for gnu+linux/freedesktop.org desktops, it seems to be something very like (if not identical to) the macosx convention, but that's a matter for a different bug.