X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:to:subject:date:message-id:references
	:in-reply-to:content-type:content-transfer-encoding
	:mime-version; q=dns; s=default; b=meaj18b6P/ssIQ+r/RZXHQBV5AJrV
	KjaS6ju3VTy1IkDldzVjt13/BD9s7Gfq9iQR/ohkI/4CsoAjBmB3J3p48seNubRP
	1xWVlhM5UBP/OAt4chWSEQrAE9BGuB76n2fr/rOpWc6zesLyxdyJzOdpPrrJLAmq
	akgTzCz+2BVq2w=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:to:subject:date:message-id:references
	:in-reply-to:content-type:content-transfer-encoding
	:mime-version; s=default; bh=vJEkI9rZ8WKM3FMObqRbZ4FLv9w=; b=Gfa
	qfVdpHAEg1cLI8YD98QJ/8vbBNiQMNZlg/lwxT8tInx33zlGEwP8i8AxClleDQ77
	bpkSzQhFpXXp4LOAjdk9fUpBmXCp9j+4fdINtRv1hHqNUqEuvG76QCGGS1WFWAgh
	8ZYEOmNW1MzslLEC5DkGnNCsQgLTIGpnwLeDZTb4=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: At8EAH07lFGcKEep/2dsb2JhbABRCsEzgmiBF20Hgh8BAQEDARIVE0QLAgEIIhQQHxMlAQEEGxqHZAahLptujWKBCziCdGEDjiGaUIMQgic
From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr@ncbi.nlm.nih.gov>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: Strange problem with find and directories
Date: Thu, 16 May 2013 01:56:23 +0000
Message-ID: <5F8AAC04F9616747BC4CC0E803D5907D0AF7ACA6@MLBXv04.nih.gov>
References: <5F8AAC04F9616747BC4CC0E803D5907D0AF7ABC6@MLBXv04.nih.gov> <5F8AAC04F9616747BC4CC0E803D5907D0AF7ABE9@MLBXv04.nih.gov>
In-Reply-To: <5F8AAC04F9616747BC4CC0E803D5907D0AF7ABE9@MLBXv04.nih.gov>
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r4G1ujW6016985

> I meant /cygdrive/c/...

... and I was trying to identify the problem myself but got into another thing,
now with strace:

when trying to use the "-f" flag that I used to use on Linux to trace
child processes, the entire command just hanged:

$ strace -f -o find.strace find . -name dir -type d -exec rm {} \;

it turned out that strace was waiting on a child to exit:

   35   35094 [main] find 7872 time: 1368668019 = time(0)
11696   46790 [main] find 7872 frok::parent: forked pid 7568
   61   46851 [main] find 7872 child_info::sync: n 2, waiting for subproc_ready(0x25C) and child process(0x280)

I figured I was doing something wrong, so I tried to see the version of strace:

$ man strace
...
       -v, --version
              output version information and exit
...

That did not work, either:

$ strace -v
C:\Cygwin\bin\strace.exe: unknown option -- v
Try `strace --help' for more information.

$ strace --help
...
  -V, --version                output version information and exit
...

So man page needs to be more *case-sensitive*.  Also, it looks like -f
actually turns off the child tracing (and that obviously does not work
with the never-ending wait).  What's more, the interrupted (Ctrl-C) strace
left the find process still running (it showed up in Task Manager, but
not with Cygwin's "ps" run from bash/minny window) -- I discovered that
by the fact that when I tried to remove the file "strace.find", I got this:

rm: cannot remove `find.strace': Device or resource busy

Finally, I had strace running without the -f switch, and it finished
successfully, showing the following sequence in the trace file leading
to errno 20 (ENOTDIR):

   27   86111 [main] find 5420 mount_info::conv_to_win32_path: src_path /home/lavr/test/dir, dst C:\Cygwin\home\lavr\test\dir, flags 0x3000
A, rc 0
   58   86169 [main] find 5420 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\Cygwin\home\lavr\test\dir)
   29   86198 [main] find 5420 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\Cygwin\home\lavr\test\dir)
   49   86247 [main] find 5420 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\Cygwin\home\lavr\test\dir.exe)
   32   86279 [main] find 5420 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\Cygwin\home\lavr\test\dir.exe)
   45   86324 [main] find 5420 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\Cygwin\home\lavr\test\dir.lnk)
   27   86351 [main] find 5420 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\Cygwin\home\lavr\test\dir.lnk)
   46   86397 [main] find 5420 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\Cygwin\home\lavr\test\dir.exe.lnk)
   26   86423 [main] find 5420 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\Cygwin\home\lavr\test\dir.exe.lnk)
   27   86450 [main] find 5420 symlink_info::check: 0 = symlink.check(C:\Cygwin\home\lavr\test\dir, 0x289450) (0x3000A)
   30   86480 [main] find 5420 mount_info::conv_to_win32_path: conv_to_win32_path (/home/lavr/test)
   28   86508 [main] find 5420 set_flags: flags: binary (0x2)
   25   86533 [main] find 5420 mount_info::conv_to_win32_path: src_path /home/lavr/test, dst C:\Cygwin\home\lavr\test, flags 0x3000A, rc 0
   55   86588 [main] find 5420 symlink_info::check: 0x0 = NtCreateFile (\??\C:\Cygwin\home\lavr\test)
   35   86623 [main] find 5420 symlink_info::check: not a symlink
   42   86665 [main] find 5420 symlink_info::check: 0 = symlink.check(C:\Cygwin\home\lavr\test, 0x289450) (0x3000A)
   26   86691 [main] find 5420 path_conv::check: this->path(C:\Cygwin\home\lavr\test\dir), has_acls(1)
   32   86723 [main] find 5420 build_fh_pc: fh 0x61275D10, dev 0xC3
   30   86753 [main] find 5420 __set_errno: int open(const char*, int, ...):1369 setting errno 20
   28   86781 [main] find 5420 open: -1 = open(/home/lavr/test/dir, 0x30C000), errno 20

Clearly, find would be happy to see ENOENT there (and it's actually what should have
been flagged in the absence of the directory after its removal, as ENOTDIR is
not applicable in such case).

Thanks,

Anton Lavrentiev
Contractor NIH/NLM/NCBI


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


