public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: find / without traversing /proc
@ 2017-04-28 13:09 Ugly Leper
  0 siblings, 0 replies; 12+ messages in thread
From: Ugly Leper @ 2017-04-28 13:09 UTC (permalink / raw)
  To: cygwin

The directory /proc is a bit special. More generally:
What about "find /d0 without traversing /d0/d1 or /d0/d2"?
The syntax
$ find /d0 \( -wholename /d0/d1 -o -wholename /d0/d2 \) -prune -o -print
works but is tortured; and can qualifiers e.g. -type f  or -type d be
incorporated?

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-30 21:37         ` Greywolf
@ 2017-04-30 23:19           ` Greywolf
  0 siblings, 0 replies; 12+ messages in thread
From: Greywolf @ 2017-04-30 23:19 UTC (permalink / raw)
  To: cygwin

[oops; hit send when meant to hit cancel (while confirming what I was 
talking about before sending it...)]


On 2017-04-29 00:16, Greywolf wrote:
> -xdev was never a GNU extension; it was in Posix 1 (1990).
>
> On 2017-04-28 17:32, Andrey Repin wrote:
>> Greetings, Eric Blake!
>>
>>> On 04/27/2017 08:11 PM, Andrey Repin wrote:
>>
>>>>
>>>>> Doesn't the -xdev switch help with this?
>>>>
>>>> Just keep in mind that -xdev is an extension and different platform
>>>> may use a
>>>> different way to indicate that find should stick to the current device.
>>
>>> Huh?  find -xdev is specified by POSIX, so it's portable:
>>
>>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
>>
>> 2016 edition. It's new. But pleasant.
>> Last time I checked it was labeled as GNU extension.
>>
>>
>
> --
> 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

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-29 15:11       ` Andrey Repin
@ 2017-04-30 21:37         ` Greywolf
  2017-04-30 23:19           ` Greywolf
  0 siblings, 1 reply; 12+ messages in thread
From: Greywolf @ 2017-04-30 21:37 UTC (permalink / raw)
  To: cygwin

-xdev was never a GNU extension; it was in Posix 1 (1990).

On 2017-04-28 17:32, Andrey Repin wrote:
> Greetings, Eric Blake!
>
>> On 04/27/2017 08:11 PM, Andrey Repin wrote:
>
>>>
>>>> Doesn't the -xdev switch help with this?
>>>
>>> Just keep in mind that -xdev is an extension and different platform may use a
>>> different way to indicate that find should stick to the current device.
>
>> Huh?  find -xdev is specified by POSIX, so it's portable:
>
>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
>
> 2016 edition. It's new. But pleasant.
> Last time I checked it was labeled as GNU extension.
>
>

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-29  0:35     ` Eric Blake
@ 2017-04-29 15:11       ` Andrey Repin
  2017-04-30 21:37         ` Greywolf
  0 siblings, 1 reply; 12+ messages in thread
From: Andrey Repin @ 2017-04-29 15:11 UTC (permalink / raw)
  To: Eric Blake, cygwin

Greetings, Eric Blake!

> On 04/27/2017 08:11 PM, Andrey Repin wrote:

>> 
>>> Doesn't the -xdev switch help with this?
>> 
>> Just keep in mind that -xdev is an extension and different platform may use a
>> different way to indicate that find should stick to the current device.

> Huh?  find -xdev is specified by POSIX, so it's portable:

> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html

2016 edition. It's new. But pleasant.
Last time I checked it was labeled as GNU extension.


-- 
With best regards,
Andrey Repin
Saturday, April 29, 2017 03:31:01

Sorry for my terrible english...


--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-28 17:19   ` Andrey Repin
  2017-04-28 18:38     ` Eliot Moss
@ 2017-04-29  0:35     ` Eric Blake
  2017-04-29 15:11       ` Andrey Repin
  1 sibling, 1 reply; 12+ messages in thread
From: Eric Blake @ 2017-04-29  0:35 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 903 bytes --]

On 04/27/2017 08:11 PM, Andrey Repin wrote:

> 
>> Doesn't the -xdev switch help with this?
> 
> Just keep in mind that -xdev is an extension and different platform may use a
> different way to indicate that find should stick to the current device.

Huh?  find -xdev is specified by POSIX, so it's portable:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html

-xdev
    The primary shall always evaluate as true; it shall cause find not
to continue descending past directories that have a different device ID
(st_dev, see the stat() function defined in the System Interfaces volume
of POSIX.1-2008). If any -xdev primary is specified, it shall apply to
the entire expression even if the -xdev primary would not normally be
evaluated.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-28 17:19   ` Andrey Repin
@ 2017-04-28 18:38     ` Eliot Moss
  2017-04-29  0:35     ` Eric Blake
  1 sibling, 0 replies; 12+ messages in thread
From: Eliot Moss @ 2017-04-28 18:38 UTC (permalink / raw)
  To: cygwin

On 4/27/2017 9:11 PM, Andrey Repin wrote:
> Greetings, Václav Haisman!
> 
>> On 27 April 2017 at 10:49, wrote:
>>> The command "find /" takes forever, if it completes at all, because of the
>>> need to traverse the induced directory /proc. Is this directory often
>>> needed by users? Can it be skipped by setting up "export CYGWIN=something",
>>> or even by default, with the requirement on the user to induce it if needed?
>>> There seems to be no switch to the command find that would easily allow
>>> "but not this subdirectory": if there was, I wouldn't be asking. Quite a
>>> lot of surfing led me to
>>> $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
>>> which is really heavyweight syntax for a simple requirement. I am pretty
>>> certain it leads to the behaviour required "do not traverse" though various
>>> posters seem to think it just leads to "traverse but do not report" saving
>>> almost nothing.
>>> Assuming the syntax is correct, I have not been able to incorporate any
>>> qualifiers such as -type d or -type f or -type l. Any ideas where to slot
>>> these so that they work?

The -o options are high level "or" choices.  Other flags like -type generally
have "and" semantics, and "and" binds more tightly than "or".  The conclusion
is" put these after your last -o, the filter after the pruning.

Regards - Eliot Moss

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-27 17:16 ` Václav Haisman
  2017-04-27 19:15   ` Andrew Schulman
@ 2017-04-28 17:19   ` Andrey Repin
  2017-04-28 18:38     ` Eliot Moss
  2017-04-29  0:35     ` Eric Blake
  1 sibling, 2 replies; 12+ messages in thread
From: Andrey Repin @ 2017-04-28 17:19 UTC (permalink / raw)
  To: Václav Haisman, cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1613 bytes --]

Greetings, Václav Haisman!

> On 27 April 2017 at 10:49, wrote:
>> The command "find /" takes forever, if it completes at all, because of the
>> need to traverse the induced directory /proc. Is this directory often
>> needed by users? Can it be skipped by setting up "export CYGWIN=something",
>> or even by default, with the requirement on the user to induce it if needed?
>> There seems to be no switch to the command find that would easily allow
>> "but not this subdirectory": if there was, I wouldn't be asking. Quite a
>> lot of surfing led me to
>> $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
>> which is really heavyweight syntax for a simple requirement. I am pretty
>> certain it leads to the behaviour required "do not traverse" though various
>> posters seem to think it just leads to "traverse but do not report" saving
>> almost nothing.
>> Assuming the syntax is correct, I have not been able to incorporate any
>> qualifiers such as -type d or -type f or -type l. Any ideas where to slot
>> these so that they work?

> Doesn't the -xdev switch help with this?

Just keep in mind that -xdev is an extension and different platform may use a
different way to indicate that find should stick to the current device.


-- 
With best regards,
Andrey Repin
Friday, April 28, 2017 04:10:57

Sorry for my terrible english...\x03B‹KCB”\x1c›Ø›\x19[H\x1c™\^[ܝ\x1cΈ\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÜ\x1c›Ø›\x19[\Ëš\x1d^[[\x03B‘TNˆ\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘^[ØÝ[Y[\x18]\x1a[ÛŽˆ\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ^[ØÜËš\x1d^[[\x03B•[œÝXœØÜšX™H\x1a[™›Îˆ\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÛ[\vÈÝ[œÝXœØÜšX™K\Ú[\^[\x19CBƒB

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-28 10:05 ` Gary Johnson
@ 2017-04-28 14:07   ` Brian Inglis
  0 siblings, 0 replies; 12+ messages in thread
From: Brian Inglis @ 2017-04-28 14:07 UTC (permalink / raw)
  To: cygwin

On 2017-04-27 08:56, Gary Johnson wrote:
> On 2017-04-27, bonhard wrote:
>> The command "find /" takes forever, if it completes at all, because of the
>> need to traverse the induced directory /proc. Is this directory often
>> needed by users? Can it be skipped by setting up "export CYGWIN=something",
>> or even by default, with the requirement on the user to induce it if needed?
>> There seems to be no switch to the command find that would easily allow
>> "but not this subdirectory": if there was, I wouldn't be asking. Quite a
>> lot of surfing led me to
>> $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
>> which is really heavyweight syntax for a simple requirement. I am pretty
>> certain it leads to the behaviour required "do not traverse" though various
>> posters seem to think it just leads to "traverse but do not report" saving
>> almost nothing.
>> Assuming the syntax is correct, I have not been able to incorporate any
>> qualifiers such as -type d or -type f or -type l. Any ideas where to slot
>> these so that they work?
> 
> This isn't exactly what you're looking for because it expands to
> give find a list of places to look rather than just excluding some
> set of directories from one place to look, but it seems to work
> well. You'll need to have the extglob shopt set.
> 
>     $ find /!(dev|proc) ...

I've used find /??? /sbin to exclude /cygdrive, /home, /proc.
 
If I just want to find something I know is somewhere under ... 
I use ls .../**/*something* or .../**/*somedir*/, enabled with 
shopt globstar, and is quicker than find.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-27 16:31 bonhard
  2017-04-27 17:16 ` Václav Haisman
@ 2017-04-28 10:05 ` Gary Johnson
  2017-04-28 14:07   ` Brian Inglis
  1 sibling, 1 reply; 12+ messages in thread
From: Gary Johnson @ 2017-04-28 10:05 UTC (permalink / raw)
  To: cygwin

On 2017-04-27, bonhard wrote:
> The command "find /" takes forever, if it completes at all, because of the
> need to traverse the induced directory /proc. Is this directory often
> needed by users? Can it be skipped by setting up "export CYGWIN=something",
> or even by default, with the requirement on the user to induce it if needed?
> There seems to be no switch to the command find that would easily allow
> "but not this subdirectory": if there was, I wouldn't be asking. Quite a
> lot of surfing led me to
> $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
> which is really heavyweight syntax for a simple requirement. I am pretty
> certain it leads to the behaviour required "do not traverse" though various
> posters seem to think it just leads to "traverse but do not report" saving
> almost nothing.
> Assuming the syntax is correct, I have not been able to incorporate any
> qualifiers such as -type d or -type f or -type l. Any ideas where to slot
> these so that they work?

This isn't exactly what you're looking for because it expands to
give find a list of places to look rather than just excluding some
set of directories from one place to look, but it seems to work
well. You'll need to have the extglob shopt set.

    $ find /!(dev|proc) ...

HTH,
Gary


--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-27 17:16 ` Václav Haisman
@ 2017-04-27 19:15   ` Andrew Schulman
  2017-04-28 17:19   ` Andrey Repin
  1 sibling, 0 replies; 12+ messages in thread
From: Andrew Schulman @ 2017-04-27 19:15 UTC (permalink / raw)
  To: cygwin

> On 27 April 2017 at 10:49, wrote:
> > The command "find /" takes forever, if it completes at all, because of the
> > need to traverse the induced directory /proc. Is this directory often
> > needed by users? Can it be skipped by setting up "export CYGWIN=something",
> > or even by default, with the requirement on the user to induce it if needed?
> > There seems to be no switch to the command find that would easily allow
> > "but not this subdirectory": if there was, I wouldn't be asking. Quite a
> > lot of surfing led me to
> > $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
> > which is really heavyweight syntax for a simple requirement. I am pretty
> > certain it leads to the behaviour required "do not traverse" though various
> > posters seem to think it just leads to "traverse but do not report" saving
> > almost nothing.
> > Assuming the syntax is correct, I have not been able to incorporate any
> > qualifiers such as -type d or -type f or -type l. Any ideas where to slot
> > these so that they work?
> 
> Doesn't the -xdev switch help with this?

Right, 

find / -xdev ...

will do it, at the cost of excluding other mounted file systems too. So
depending on your search you might need e.g.

find / /cygdrive/c -xdev ...

Then again excluding /cygdrive/* might be what you want.


--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: find / without traversing /proc
  2017-04-27 16:31 bonhard
@ 2017-04-27 17:16 ` Václav Haisman
  2017-04-27 19:15   ` Andrew Schulman
  2017-04-28 17:19   ` Andrey Repin
  2017-04-28 10:05 ` Gary Johnson
  1 sibling, 2 replies; 12+ messages in thread
From: Václav Haisman @ 2017-04-27 17:16 UTC (permalink / raw)
  To: cygwin; +Cc: fergus

On 27 April 2017 at 10:49, wrote:
> The command "find /" takes forever, if it completes at all, because of the
> need to traverse the induced directory /proc. Is this directory often
> needed by users? Can it be skipped by setting up "export CYGWIN=something",
> or even by default, with the requirement on the user to induce it if needed?
> There seems to be no switch to the command find that would easily allow
> "but not this subdirectory": if there was, I wouldn't be asking. Quite a
> lot of surfing led me to
> $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
> which is really heavyweight syntax for a simple requirement. I am pretty
> certain it leads to the behaviour required "do not traverse" though various
> posters seem to think it just leads to "traverse but do not report" saving
> almost nothing.
> Assuming the syntax is correct, I have not been able to incorporate any
> qualifiers such as -type d or -type f or -type l. Any ideas where to slot
> these so that they work?

Doesn't the -xdev switch help with this?

--VH

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* find / without traversing /proc
@ 2017-04-27 16:31 bonhard
  2017-04-27 17:16 ` Václav Haisman
  2017-04-28 10:05 ` Gary Johnson
  0 siblings, 2 replies; 12+ messages in thread
From: bonhard @ 2017-04-27 16:31 UTC (permalink / raw)
  To: cygwin; +Cc: fergus

The command "find /" takes forever, if it completes at all, because of the
need to traverse the induced directory /proc. Is this directory often
needed by users? Can it be skipped by setting up "export CYGWIN=something",
or even by default, with the requirement on the user to induce it if needed?
There seems to be no switch to the command find that would easily allow
"but not this subdirectory": if there was, I wouldn't be asking. Quite a
lot of surfing led me to
$ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
which is really heavyweight syntax for a simple requirement. I am pretty
certain it leads to the behaviour required "do not traverse" though various
posters seem to think it just leads to "traverse but do not report" saving
almost nothing.
Assuming the syntax is correct, I have not been able to incorporate any
qualifiers such as -type d or -type f or -type l. Any ideas where to slot
these so that they work?


--------------------------------------------------------------------
mail2web - Check your email from the web at
https://link.mail2web.com/mail2web



--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-04-29  7:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28 13:09 find / without traversing /proc Ugly Leper
  -- strict thread matches above, loose matches on Subject: below --
2017-04-27 16:31 bonhard
2017-04-27 17:16 ` Václav Haisman
2017-04-27 19:15   ` Andrew Schulman
2017-04-28 17:19   ` Andrey Repin
2017-04-28 18:38     ` Eliot Moss
2017-04-29  0:35     ` Eric Blake
2017-04-29 15:11       ` Andrey Repin
2017-04-30 21:37         ` Greywolf
2017-04-30 23:19           ` Greywolf
2017-04-28 10:05 ` Gary Johnson
2017-04-28 14:07   ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).