X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 27 Apr 2011 16:08:51 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: False positive from access("/proc/registry/...", F_OK) Message-ID: <20110427140851.GU3324@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1QF1xL-1RJrwe0 AT fwd09 DOT aul DOT t-online DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1QF1xL-1RJrwe0@fwd09.aul.t-online.de> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Apr 27 12:26, Christian Franke wrote: > 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). I don't remember anymore why I did that and naturally I also didn't write a comment. But what you say sounds right to me. Please create a patch. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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