delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/24/01:06:28

From: jqb AT netcom DOT com (Jim Balter)
Subject: Re: bug in find
24 Jan 1997 01:06:28 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <32E80DFA.6C8.cygnus.gnu-win32@netcom.com>
References: <199701232039 DOT KAA08546 AT haleakala DOT aloha DOT net>
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Tim Newsham <newsham AT aloha DOT net>
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Tim Newsham wrote:
> 
> > In this case it's not find that is trying to create the file 'out',
> > but rather the shell.
> 
> The problem is not creating the file.  Perhaps the description
> was misleading:
> 
>     % find . -name '*.c' >& out
> 
> That command runs to completion.  The file 'out' is created.
> Now if you look in the file out you see:
> 
>     % cat out
>     find: out: Permission denied
> 
> (may not be exact, this is from memory).
> The file out contains the output from the find command.  The
> find command was for some reason unable to perform an operation
> on the file out.  (Perhaps because 'out' is an open file
> held open by the shell?).  At any rate, the bug
> is definitely find, not the shell.

find uses the lstat system call, and the cygwin implementation
opens the file and actually reads it in order to see whether it is a
symlink (now you know why find takes so long).  symlink_check dies
opening a file opened for writing (a piece of Miscrosoft brilliance
that helps unix weenies win the advocacy wars).  Note that
find -follow doesn't get the error; it uses stat, which silently
assumes that, if it can't open the file, it isn't a symlink.
I think the two cases ought to be consistent; i.e., lstat should
report an open symlink as a regular file (the alternative, of
stat returning an error on any open file, is unpleasant).
Or, somehow tell the OS to allow files open for writing to be open
for reading.

--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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