delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/04/27/06:27:51

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE,TW_YG,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Wed, 27 Apr 2011 12:26:51 +0200
Reply-To: "Christian Franke" <Christian DOT Franke AT t-online DOT de>
To: "Cygwin" <cygwin AT cygwin DOT com>
Subject: False positive from access("/proc/registry/...", F_OK)
From: "Christian Franke" <Christian DOT Franke AT t-online DOT de>
Message-ID: <1QF1xL-1RJrwe0@fwd09.aul.t-online.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

access("/proc/registry/...", F_OK) returns 0 for all (including
nonexistent) entries below a registry key which cannot be opened:

Testcase (run with admin rights):

# cygcheck -f /bin/cygwin1.dll
cygwin-1.7.9-1

# cd /proc/registry/HKEY_LOCAL_MACHINE

# ls SECURITY
Cache  Policy  RXACT  SAM

# cygdrop -- ls SECURITY
ls: reading directory SECURITY: Permission denied

# test -e SECURITY/NoSuchFile && echo yes

# cygdrop -- test -e SECURITY/NoSuchFile && echo yes
yes


Problem was likely introduced by fhandler_registry.cc change 1.52:

 fhandler_registry::exists ()
 ...
   if (!val_only)
     hKey = open_key (path, KEY_READ, wow64, false);
 - if (hKey != (HKEY) INVALID_HANDLE_VALUE)
 + if (hKey != (HKEY) INVALID_HANDLE_VALUE || get_errno () == EACCES)
     file_type = 1;
   else

open_key() returns INVALID_HANDLE_VALUE and EACCESS also if an upper
level key cannot be opened. The exists() function returns 1
(virt_directory) then, it should return 0 (virt_none).

Christian




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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