URL:
<http://savannah.gnu.org/bugs/?46305>
Summary: Doing "find -L . -type d -delete" fails on symlinks
to directories.
Project: findutils
Submitted by: pfudd
Submitted on: Tue 27 Oct 2015 01:23:12 AM GMT
Category: find
Severity: 3 - Normal
Item Group: Wrong result
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.2
Fixed Release: None
_______________________________________________________
Details:
The '-L' option makes '-type d' detect symlinks to directories, but '-delete'
doesn't treat them as such.
$ mkdir /tmp/foo
$ cd /tmp/foo
$ mkdir baz
$ ln -s baz bar
$ find -L . -type d
bar
baz
$ find -L . -type d -delete
./bar
find: cannot delete `./bar': Not a directory
./baz
$ ls -l
total 0
lrwxrwxrwx 1 root root 3 Oct 26 18:12 bar -> baz
I'd expect --delete to delete whatever it found.
Note: if 'bar' is the directory and 'baz' is the symlink, then no error
message is generated, but baz remains as a broken symlink, since the directory
was deleted before the symlink was found (assuming sorted directory
traversal).
Also, http://ftp.gnu.org/gnu/findutils/ indicates that 4.4.2 is the latest
version (from 2009), but this bug-reporting page indicates that 4.5.14 is the
latest version. Please link to the new download page on
https://savannah.gnu.org/projects/findutils/, or expect bug reports about
ancient versions of the code. :-)
Thanks!
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46305>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/