December 14

kernel level trash bin

This article discusses adding the `trashcan' functionality we see on most desktops, but at a kernel level.
The patch works like this: whenever the last link is removed from a file, the undeletable and secure deletion flags are checked. Should either one be set, the file will be moved over to the .trash/<uid>/ directory in the root of the filesystem. Each per-uid directory has restrictive permissions, keeping users from perusing each others' deleted files. There are no subdirectories, so the path information is lost; preserving paths might be added in a future version. A number is appended to the file name when collisions with files already in the trash happen.
Seems like a good idea. I have rm aliased to rm -i but have conditioned my self now to expect the confirmation question and not pay attention to it as much as I should. I regularly do backups with rsync and feel a bit safer knowing that I could at most lose an hour or so of work.

What might be better would be for the kernel to recognize a major and disastrous delete command. The infamous `rm -rf /' comes to mind, and would be easy enough to detect I imagine, so would wiping out /usr or /bin, but where would you stop interfering with the superusers judgement?

zsh is nice to ask if I am sure when I do something like rm -rf ~/tmp/foo/*. I am sure this a shell option I can turn off but still, it's quite often I use the `*' wildcard to delete files without first checking to see what the `*' actually expands to, so I let zsh give me pause for thought in those cases.

My desktop, Xfce4, also has a trash can similar to the windows recycle bin. (what exactly is being recycled? your not putting glass and plastic in there and ftp'ing it off to MS.) I only delete files via a GUI when they contain lots of invalid characters that I am too lazy to learn how to escape in zsh.

Posted by æc♥ | Permanent Link