delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/03/10:22:35

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Wed, 3 Jul 2002 16:20:46 +0200
From: Thomas Baker <thomas DOT baker AT bi DOT fhg DOT de>
To: Cygwin <cygwin AT cygwin DOT com>
Cc: Conrad Scott <Conrad DOT Scott AT dsl DOT pipex DOT com>
Subject: Cygwin "find" stopping before done...?
Message-ID: <20020703162045.A2116@mail.gmd.de>
Mail-Followup-To: Thomas Baker <thomas DOT baker AT bi DOT fhg DOT de>,
Cygwin <cygwin AT cygwin DOT com>,
Conrad Scott <Conrad DOT Scott AT dsl DOT pipex DOT com>
References: <20020626125840 DOT A576 AT mail DOT gmd DOT de> <0dde01c21d05$d11a7810$6132bc3e AT BABEL>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <0dde01c21d05$d11a7810$6132bc3e@BABEL>; from Conrad.Scott@dsl.pipex.com on Wed, Jun 26, 2002 at 12:37:10PM +0100

To generate a list of all files on my e: partition:

	find e:/ -type f >c:/backups/filenames/edrive-files

However, this "find" command consistently stops before even
starting to read the final directory (462 MB large, with
19,000 files).  When I use the MKS version of the find command
it reads this directory along with the others with no problem.

I had earlier had a problem with "grep foobar *" under
Cygwin (but again, not with MKS) and it turned out to be an
understandable and known limitation easily resolvable by using
"xargs" (see below).  And in the case of grep, I was warned by
an error message of the problem with grep.

In the case of "find", the command line itself is not (I
should think) expanding into something too big to process,
but I was assuming that find was in fact designed to plow
through long directory trees.  Even if this is not the case,
it's not clear to me how xargs could provide a workaround here.

This problem with "find" seems particularly insidious because
it executes and exits with no error message so I naturally
assume it has completed its work successfully -- even when
this is not the case.  Since in other contexts I rely on
"find" to help back up my data files, the consequences of
an undetected error such as the one described above could be
disastrously disruptive to my work.

Has anyone else had this problem?

Tom

On Wed, Jun 26, 2002 at 12:37:10PM +0100, Conrad Scott wrote:
> "Thomas Baker" <thomas DOT baker AT bi DOT fhg DOT de> wrote:
> > One difficulty I have found, however, is limitations (or so
> > it would seem) on the number of arguments that the command
> > "grep" can take.
> 
> You can't (portably) rely on anything much more than a few thousand
> characters in a single command line. The minimum requirement for a
> Posix system is 4096 (see <limits.h>). The usual technique is to use
> `xargs', as:
> 
>     ls | xargs grep pattern
> 
> (or even `ls | xargs grep pattern /dev/null' to catch the case with
> only one argument being given to grep and it changing behaviour).
> 
> This splits up the incoming arguments and invokes grep repeatedly, a
> batch of the arguments at a time. It's particularly useful with `find'
> and it's got lots of lovely options to play with too :-)
> 
> It would be nice to allow arbitrary command lines, but I've never
> (knowingly) used a system that did so.
> 
> // Conrad
> 
> 
> 

-- 
Dr. Thomas Baker                                Thomas DOT Baker AT bi DOT fhg DOT de
Institutszentrum Schloss Birlinghoven          mobile +49-171-408-5784
Fraunhofer-Gesellschaft                          work +49-30-8109-9027
53754 Sankt Augustin, Germany                    fax +49-2241-144-1408

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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