Re: FW: Trash and hidden files
- From: Warren Young <tangent cyberport com>
- To: Gnome List <gnome-list gnome org>
- Subject: Re: FW: Trash and hidden files
- Date: Fri, 10 Dec 1999 07:59:22 -0700
Gerry Chu wrote:
>
> I was musing around while working on the summary and I thought, why doesn't
> GNOME have a trash can?
This is one big reply to all the concerns people have brought up: it's
easier to reply to all than make several disconnected replies.
I personally prefer moving files to a trash directory; each filesystem
will have its own trash directory. The whys:
1. Figuring out which trash folder to use is nowhere near "impossible".
Here's one cheap-and-dirty way to do it: given a list of all the trash
folders, call rename(doomed_file, trash_folder[i]) in a loop until
rename(2) stops returning EXDEV. How do you get the list of trash
folders? All you need to know is what filesystems are mounted; IIRC,
there's a single ioctl() to get that list.
2. I don't want to see trashed files every time I do an "ls -a". GNOME
is a GUI, but our goal isn't to kill the command line.
3. Some programs will want to treat trashed files as a special case.
"Hidden files everywhere" is a harder special case to handle than
"several identically-named hidden trash directories". Many programs I
have would care: my backup program, any find(1) commands I compose, GNU
locate, etc.
4. It's easier to keep things consistent this way: imagine, someone
trashes a file, then "rm -r"'s the directory it lived in. Then they
un-trash the file: it should be restored. If the files are just hidden
in the same directory, the trashed files will go away when the directory
does.
5. A "trash" system should have the option of deleting files when its
contents exceed some user-defined size limit. This is much easier if
all the deleted files are in one directory.
6. This method does not suffer from the "not enough space on partition"
issue.
One other concern: the trash folder should be in the root of each
filesystem, not in that filesystem's /tmp directory. Many Unixes out
there routinely clean out /tmp on a reboot, sometimes deleting
everything, and sometimes just files older than 5 days or so.
For those who don't like the trashcan idea in the first place: don't use
it then. We're not forcing you to use it. GMC might have an option to
use the trashcan for its delete operation, or like Windows Explorer
where you can choose on a file-by-file basis. Either turn the option
off, or use the "real delete" command instead of "trash file" command.
There is one slightly tricky point: the tool will have to have a way to
let J. Random User create a trash directory. This is easily seen in
this scenario: User sticks floppy in, mounts it, deletes a file, and
unmounts the disk. The file should be moved to /.gnome-trash on that
floppy, but /.gnome-trash wouldn't automatically exist, and the user
might not have permission to create it. (The mount point might only
allow read access.)
I think gnome-trash should have an auxilliary tool that is suid root,
whose only mission is to create trash folders with mode 1777, as someone
else proposed. Then gnome-trash itself just moves the files to that
directory, where they retain the user's original ownership and
permissions.
We may also want to allow the name _GTRASH as a trash folder, to make
FAT and other weak filesystems happy.
--
= Warren -- ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]