delorie.com/archives/browse.cgi | search |
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: | <3CDE8B30.95496DFA@cistron.nl> |
Date: | Sun, 12 May 2002 17:33:04 +0200 |
From: | Ton van Overbeek <tvoverbe AT cistron DOT nl> |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
To: | cygwin-patches AT cygwin DOT com, cygwin AT cygwin DOT com |
Subject: | [PATCH] Get recursive grep to work on Win9x |
--------------E06305C056C3C2E5B8672FAE Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit There have been various reports over time that recursive grep is not working on Win9x. For every directory you get a 'Permission denied' error. Also there have been reports that using open(2) to open a directory readonly on Win9x fails. Both have the same cause. open(2) calls _open in the cygwin1.dll (See source file syscalls.cc). When you open a file (or directory) it creates a file_handler and calls fhandler_base::open (See source file fhandler.cc). fhandler_base::open adds the FILE_FLAG_BACKUP_SEMANTICS to the file_attributes for the Win32 CreateFile call in case you open a directory. This way of opening a directory is only supported on WinNT and not on Win9x. See MSDN. Hence the reports that grep -R works on NT and not on 9x. To get grep to work on 9x, the fix is simple: get fhandler_base::open to set the error EISDIR when you try to open a directory. This is *not* strictly POSIX. According to POSIX open should only return EISDIR when you try to open a directory read/write or writeonly. However it fixes the problem for grep. The patch is simple. It makes use of the wincap.can_open_directories() capability, which seems to be foreseen for exactly this type of problems. However I could not find an other place where this capability is used in the cygwin.dll. Patch attached: fhandler.diff --------------E06305C056C3C2E5B8672FAE Content-Type: application/x-unknown-content-type-diff_auto_file; name="fhandler.diff" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="fhandler.diff" LS0tIGZoYW5kbGVyLmNjCVN1biBNYXkgMTIgMTY6MzQ6MjIgMjAwMgorKysgZmhhbmRsZXIu Y2Mub3JpZwlUaHUgTWF5ICAyIDA2OjEzOjQ2IDIwMDIKQEAgLTM2OSwxNSArMzY5LDcgQEAK IAogICBmaWxlX2F0dHJpYnV0ZXMgPSBGSUxFX0FUVFJJQlVURV9OT1JNQUw7CiAgIGlmIChm bGFncyAmIE9fRElST1BFTikKLSAgICB7Ci0gICAgICBpZiAod2luY2FwLmNhbl9vcGVuX2Rp cmVjdG9yaWVzICgpKQotICAgICAgICBmaWxlX2F0dHJpYnV0ZXMgfD0gRklMRV9GTEFHX0JB Q0tVUF9TRU1BTlRJQ1M7Ci0gICAgICBlbHNlCi0gICAgICAgIHsKLSAgICAgICAgICBzZXRf ZXJybm8gKEVJU0RJUik7Ci0gICAgICAgICAgZ290byBkb25lOwotICAgICAgICB9Ci0gICAg fQorICAgIGZpbGVfYXR0cmlidXRlcyB8PSBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUzsK ICAgaWYgKGdldF9kZXZpY2UgKCkgPT0gRkhfU0VSSUFMKQogICAgIGZpbGVfYXR0cmlidXRl cyB8PSBGSUxFX0ZMQUdfT1ZFUkxBUFBFRDsKIAo= --------------E06305C056C3C2E5B8672FAE Content-Type: text/plain; charset=us-ascii -- 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/ --------------E06305C056C3C2E5B8672FAE--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |