[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rm -f semantics
From: |
Peter Eisentraut |
Subject: |
Re: rm -f semantics |
Date: |
Sat, 7 Apr 2001 23:04:20 +0200 (CEST) |
Gary V. Vaughan writes:
> On Sunday 11 March 2001 5:29 pm, Peter Eisentraut wrote:
> > 2001-03-11 Peter Eisentraut <address@hidden>
> >
> > * ltmain.in (clean,uninstall): Do not error if the file doesn't
> > exist and 'rm -f' was used. Exit with status 1 on error.
>
> Thanks. Applied.
Oops, I used an (unportable) test -e in there. I have this as an
alternative:
diff -u -r1.200.2.58 ltmain.in
--- ltmain.in 2001/04/07 00:32:39 1.200.2.58
+++ ltmain.in 2001/04/07 20:41:12
@@ -5104,7 +5104,13 @@
fi
# Don't error if the file doesn't exist and rm -f was used.
- if test ! -e "$file" && test "$rmforce" = yes; then
+ # Does not support device, pipe, or socket files.
+ if test -L "$file" || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
continue
fi
===snip
This also handles symlinks correctly, which the existing one doesn't.
(Note that 'rm' removes the symlink, not the underlying file, but any
'test' other than '-L' follows the symlink.) The problem is obviously
that test -L is most likely not portable either (especially to systems
that don't have symlinks), but that can be tested for. How about
something along the lines of
if test $LN_S != 'ln -s'; then
test_L='test -L'
else
test_L=false
endif
The other issue is whether or not it seems acceptable to not support the
deletion of special files through libtool. It seems unlikely that a build
system would deal with these in the first place.
Comments?
--
Peter Eisentraut address@hidden http://yi.org/peter-e/