File: README.Debian

package info (click to toggle)
libtrash 2.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 372 kB
  • ctags: 140
  • sloc: ansic: 1,910; perl: 346; makefile: 82
file content (50 lines) | stat: -rw-r--r-- 1,613 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
libtrash for Debian
-------------------

To use libtrash, you need to get ld to pre-load the library before your
application is run. This can be done by setting the LD_PRELOAD environment
variable:

$ LD_PRELOAD=/usr/lib/libtrash/libtrash.so
$ export LD_PRELOAD

This will mean that all applications that are started from the shell after
LD_PRELOAD was set will use libtrash. The only issue with this solution is that
the shell you originally set the LD_PRELOAD variable from will not be using
libtrash, ie:

$ export LD_PRELOAD=/usr/lib/libtrash/libtrash.so
$ rm my_file

will be OK, but:

$ export LD_PRELOAD=/usr/lib/libtrash/libtrash.so
$ echo "asdf" > my_file

will overwrite "my_file" with "asdf", as the shell (which isn't using libtrash)
handles the ">" redirect. One method which could be used to fix this is set the
LD_PRELOAD variable before the shell is started. You could do this by
re-starting the shell in your ~/.bash_profile with something like the
following (this could be dangerous, however):

LIBTRASH=/usr/lib/libtrash/libtrash.so
LIBTRASH_dest=$LIBTRASH
if test -L $LIBTRASH ; then
   LIBTRASH_dest="$(dirname $LIBTRASH)/$(ls -l "$LIBTRASH" | \
                                         sed -e 's/^.\+ -> //')"
fi

if test x${LD_PRELOAD+set} = x -a -f "$LIBTRASH_dest" ; then
   LD_PRELOAD="$LIBTRASH"
   export LD_PRELOAD
   if test x$0 = x-bash ; then
      exec bash ${1+"$@"}
   else
      exec $0 ${1+"$@"}
   fi
fi

Any other ideas on how to set this up would be appreciated. Please email such
suggestions to me.

 -- Timshel Knoll <timshel@debian.org>  Mon, 18 Mar 2002 02:26:15 +1100