Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/