bin/90687: [patch] side effect of -delete option of find(1)

Parv parv at pair.com
Tue Dec 20 15:30:10 PST 2005


The following reply was made to PR bin/90687; it has been noted by GNATS.

From: Parv <parv at pair.com>
To: Anatoli Klassen <anatoli at aksoft.net>
Cc: FreeBSD-gnats-submit at FreeBSD.org
Subject: Re: bin/90687: [patch] side effect of -delete option of find(1)
Date: Tue, 20 Dec 2005 18:29:42 -0500

 in message <20051220145417.1B52D1DA14 at 26th.net>,
 wrote Anatoli Klassen thusly...
 >
 > 
 > >Environment:
 > System: FreeBSD mercury.26th.net 5.4-RELEASE-p6 FreeBSD 5.4-RELEASE-p6 #0: Wed Jul 27 12:58:07 CEST 2005 root at mercury.26th.net:/usr/obj/usr/src/sys/MERCURY i386
 > 
 > >Description:
 > If -delete option is used it cancel -L option silently.  So find does
 > something different as it does with just -print option.  The result could be
 > deleting of all symbolic links instead of broken ones only even if user has
 > already validated this with previous -print run.
 > 
 > >How-To-Repeat:
 > Create a file, symbolic link to it and a broken symbolic link:
 > touch a && ln -s a b && ln -s c d
 > 
 > Now detect all broken links:
 > find -L . -type l
 > - works fine, shows that "d" is broken.
 > 
 > Then try to delete the broken links
 > find -L . -type l -delete
 > - all links are deleted, not only broken ones.
 
 In your example above ...
 
   - "b" & "d" are found due to "-type l" criteria,
   - information about "a" is returned, instead of "b", due to "-L"
     option
   - file information about "a" is suppressed as it is not a link,
   - information about "d" is returned as it is a link and and the
     linked file does not exist.
   - in the end, all you have is "d" in the output.
 
 
 Refer to "-L" option description ...
 
   -L      Cause the file information and file type (see stat(2))
           returned for each symbolic link to be those of the file
           referenced by the link, not the link itself.  If the
           referenced file does not exist, the file information and
           type will be for the link itself.
 
 
   - Parv
 
 -- 
 


More information about the freebsd-bugs mailing list