This is the homepage of libtrash, the shared library which, when preloaded, implements a trash can under GNU/Linux. Through the interception of function calls which might lead to accidental data loss libtrash effectively ensures that your data remains protected from your own mistakes.
libtrash was written by Manuel Arriaga and is available as free software: it is distributed under the terms of the GPL.
Version 3.2 can be downloaded from here.
To ask questions, suggest modifications or report bugs just email me (email address found at the bottom of the page).
IMPORTANT NOTE ON FIREFOX: On some systems, due to some mysterious interaction, Firefox segfaults or fails to start when libtrash is enabled. A recently closed Debian bug report for the Mozilla xulrunner component (used by Firefox) suggests this might be on its way to be fixed. The simple way around this problem is to disable libtrash for Firefox. Do so by starting Firefox with the command "LD_PRELOAD= firefox". You can bind this command (if necessary by placing it in a one-line bash script file by itself) to whatever GUI icon or hotkey combination you use to start Firefox.
Updated the get_symbol_versions.py configuration script so that users are notified if a more recent version of Python needs to be installed (rather than producing a cryptic error message). There is NO reason for existing users to upgrade to this version.
Updated the get_symbol_versions.py so that the symbol version used for each wrapped GNU libc function is that identified with "@@" in the output of 'readelf -s [path to lib]'.
Fixed several bugs; changed the way we get pointers to GNU libc functions (now it should work for everyone); support for the "ATFILE" family of functions is now decided automatically at compile-time (rather than having the user experiment with the setting); added a compile-time check for a working /proc filesystem. Also, now Python is required to install (not to run) libtrash.
Fixed a minor bug (only present when compiled in DEBUG mode) and removed an earlier 'fix' which was proving problematic for some.
If you were using libtrash before, please notice that there has been a small change to the default configuration: '/media' is now included in the default list of removable media mount points (together with '/mnt'), and therefore any files residing underneath it will not be saved by libtrash (unless you edit the config file!).
Released version 2.8! Fixed a small bug introduced in the last version; I had forgotten to replace a call to log10() although we no longer link against the math library.
Released version 2.7! This version includes a performance fix by Jacek Sliwerski which keeps libtrash from significantly slowing down as you repeatedly remove the same file.
Released version 2.6! Only users of GNU libc 2.5 need to upgrade, nobody else needs this. ('This' refers to wrappers for a set of new functions only available in the most recent GNU libc: unlinkat(), renameat(), openat() and their 64-bit variants.)
Released version 2.5! Reimplemented build_absolute_path() so that it correctly handles paths to inexistent file system objects.
Released version 2.4! Implements a work-around needed to avoid trouble due to a undocumented "feature" of GNU libc.
Released version 2.3, which fixes a bug in handling function calls with a NULL pointer.
Released version 2.2, which fixes a bug in the string handling code.
Released version 2.1, which fixes a bug in the path handling code.
Released version 2.0. libtrash now has an "ignore regular expression" (IGNORE_RE) feature, which allows the user to provide a regular expression describing file names which will be ignored.
Released version 1.9. This new version fixes a serious bug which made libtrash enter an infinite loop when asked to remove files with names starting with multiple dots.
Just released version 1.8. This version adds a simple check which prevents libtrash from saving files with a null byte count. This will reduce the number of worthless lock files in the user's trash can.
Just released version 1.7, which includes two small fixes to the cleanTrash script and the Makefile contributed by Frederic Connes.
Just released version 1.6. It adds a new feature, USER_TEMPORARY_DIRS, which can be used by system administrators to define a list of temporary dirs relative to the users' home directories. See documentation for more details. No bug fixes.
Version 1.5 has been released. It fixes two bugs: one memory leak and a bug which kept libtrash from completely reading personal configuration files if they contained blank lines.
Version 1.4 has been released. It fixes a bug in the creation of replacement files when open() and open64() are being intercepted so that those files always have the same permissions as the original ones they are replacing.
Version 1.3 has been released, featuring an alternative cleanTrash script.
Just released version 1.2. Changed a part of the code so that the new feature, UNCOVER_DIRS, works perfectly: typing "UNCOVER_DIRS=/usr/" now produces the same effect as "UNCOVER_DIRS=/usr". This is handy because shell auto-completion will add that trailing slash for you if you just type "UNCOVER_DIRS=/u[Tab]". More importantly, there is now an EXCEPTIONS variable which allows you to list files which, although residing in one of the UNREMOVABLE_DIRS, shouldn't be protected by libtrash. This allows mount/umount to correctly handle their lock file (/etc/mtab~) while libtrash is running and /etc is listed in UNREMOVABLE_DIRS.
Just released version 1.1, which allows to you to temporarily "uncover" your trash can by simply listing it in UNCOVER_DIRS at the command line.
A few days ago I released version 1.0. After doing so, I installed KDE 3.0.1 and found out that the GNU libc bug I mentioned below also causes KMail to crash if you are using libtrash. To overcome that, you'll need to recompile GNU libc with the patch included in the tarball.
It has been confirmed: mutt crashed under libtrash due to a GNU libc bug. You can download a patch against glibc-2.2.5 from here.
Apparently, the problem I describe below might be caused by GNU libc itself.
libtrash-0.9 makes any recent version of mutt crash when you try to sync your mailbox. The segmentation fault occurs inside GNU libc, after mutt calls ftell(). I am unable to trace down this bug, and would welcome any help.
Manuel Arriaga - Email me at marriaga followed by @ stern . nyu . edu