delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/09/16:13:00

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
Message-ID: <3CDAD4F4.BC86A5BA@cistron.nl>
Date: Thu, 09 May 2002 21:58:44 +0200
From: Ton van Overbeek <tvoverbe AT cistron DOT nl>
X-Accept-Language: en
MIME-Version: 1.0
To: marklist AT rivendell DOT fangorn DOT ca, cygwin AT cygwin DOT com
Subject: RE: EISDIR EACCES and open in grep

I have been trying to chase the same problem (grep -R does not
work on W9x) during the last few days.
On WNT/W2K/XP the code works because CreateFile is called with
the FILE_FLAG_BACKUP_SEMANTICS bit set in file_attributes
(lines 371,372 in fhandler.cc).
On W9x you just get Permission Denied (EACCESS).
MSDN documents that opening directories this way is only supported
on WNT/W2K/XP.

The branch taken in the code is *not* the
'if (GetLastError () == ERROR_INVALID_HANDLE)'
but the 'else __seterrno ();', which sets EACCESS.
Found that by tracing with gdb through a debug version
of cygwin1.dll while running 'grep -R'.
So I believe your fix is applied to the wrong branch
of the if statement.
Probably the fix should also be guarded with a check for W9x.

Related to this:
What is the precise semantics for open(2), read(2) on directories
in POSIX?
Or in other words, if open(2) on a dir succeeds what should read(2) 
on a directory do ?

Regards,

Ton van Overbeek

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