delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/21/17:59:00

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,TW_YG,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av0EAAVOak+cKEcW/2dsb2JhbABEtwuBB4IQEihRAQgNJwIvEyYBBAEaGodonC2bb5AeYwSNJ4RUiXOKGIMDgUA
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>,
leoslists <leoslists AT letterboxes DOT org>
Date: Wed, 21 Mar 2012 17:57:58 -0400
Subject: RE: find: File system loop detected problem in find and locate
Message-ID: <0105D5C1E0353146B1B222348B0411A20A6536C1DD@NIHMLBX02.nih.gov>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q2LLwtCw002827

leoslists sent the following at Tuesday, March 20, 2012 1:15 AM
>I'm trying to use locate and find.  When I issue
>    find / -xdev -name "*hallo*"
>
>I get the warning
>    find: File system loop detected; `/c/cygwin' is part of the same file
>system loop as `/'.
>
>It is important to note, that I have mounted the C: drive at /c.  After
>reading some Cygwin posts I hoped that `-xdev' would solve this, but it
>didn't...
>
>The next thing I tried was pruning the Cygwin dir:
>    find / -wholename /c/cygwin -prune -o -name "*hallo*"
>
>But I still get the error message.
>
>Any ideas how I can prevent the loop, but still do the find from root?
>(I want to do the find from root, because inside locate, this determines
>the paths written to the locate database.)

Does this do what you want?

find /c -name "*hallo*" | sed -e 's,/c/cygwin,,' | sort

Although it is not totally cygwin*, my experience is that cmd's dir is
faster than find.  (I tried it on my C: (W&) and dir took 70% the time of
find and did not give "access denied" messages.)

"$(cygpath -u "${COMSPEC}")" /c dir /s /b /a: /o:n c:\\ | \
    tr -s '\r\n' '\n' | \
    cygpath -u -f - | \
    sed -e '/^$/d' \
        -e '/\/RECYCLER\//d' \
        -e '/\/$Recycle.Bin\//d' \
        -e 's,/\+,/,g' \
        -e 's,^/usr/bin,/bin,i' \
        -e 's,^/usr/lib,/lib,i' \
        -e 's,^/sbin,/usr/sbin,i' | \
    sort -u | \
    grep -e 'hallo[^/]*$'

(Whether you use the last 3 sed patterns depends on whether you want things
listed in /bin or /usr/bin.  I prefer the former.)

* I debated with myself whether to include this.  As I understand the rules,
we're not supposed to have discussions of the use of native programs on this
list, but I thought that it was relevant and connected enough to include.
Should I have sent a separate email to cygwin-talk?

Best wishes,

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019