This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]