X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 19 Feb 2010 12:47:02 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: 1.7.1(0.218/5/3): ls -R bug (Windows XP) Message-ID: <20100219114702.GZ5683@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <000401cab10d$84b7ce10$8e276a30$@com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000401cab10d$84b7ce10$8e276a30$@com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 Feb 19 11:44, Jeff Wilcox wrote: > In Cygwin 1.7.x if I ls -R the root of a drive which contains only > directories (i.e. no files at the root level), whatever directory comes > first is omitted from the listing and the following error is thrown: > > ls: ./: not listing already-listed directory Thanks for the report. I can reproduce it, even with files in the root directory. I'm wondering that this has never been found before. I see what's going on but not why. Eric? Ping? I need your help. This only occurs on NTFS drives. AFAICS, what happens is this: - ls calls opendir. This opens the directory with very limited permissions, SYNCHRONIZE | FILE_LIST_DIRECTORY. Note especially the lack of FILE_READ_ATTRIBUTES. - Apparently ls fetches the directory descriptor from the DIR structure calling dirfd(). Then it calls fstat(dirfd()). - Cygwin enters the fhandler_base::fstat_by_handle function and the call to NtQueryInformationFile fails with STAUS_ACCESS_DENIED. - Cygwin tries the alternative call fhandler_base::fstat_by_name which succeeds. - For some unknown reason ls claims "ls: ./: not listing already-listed directory". What I did for testing was to change fhandler_disk_file::opendir to open the directory with FILE_READ_ATTRIBUTES | READ_CONTROL rights. The change here is that fstat_by_handle now works. And the end result is that ls does *not* complain. However, that's quite puzzeling. The stat entries are identical. There's something going on I don't see, and that makes me wary. I don't want to change fhandler_disk_file::opendir - even though it's the right thing to do - unless we are sure about the cause for the above problem. 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