This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: 1.7.1(0.218/5/3): ls -R bug (Windows XP)
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 19 Feb 2010 12:47:02 +0100
- Subject: Re: 1.7.1(0.218/5/3): ls -R bug (Windows XP)
- References: <000401cab10d$84b7ce10$8e276a30$@com>
- Reply-to: 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: ./<DIR NAME>: 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: ./<DIR NAME>: 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