This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: du returns inconsistent results


On Feb 11 02:44, Paul Shabash wrote:
> Hello,
> 
> When I run "du -b dir" several times with the same directory as input, sometimes I get a smaller size the first time I run it than the subsequent times I run it. ?I.e. the second, third, fourth, etc. try will all return identical sizes, but the first is smaller.
> The difference in size is always a multiple of 4096.
> Doesn't happen if the input is a file.? Only if it's a directory.  The more subdirectories it has, the larger the difference.
> 
> Does anyone know what might be causing this?
> 
> The error appears using either cygwin 1.7.1-1 or 1.5, on both Windows Vista & on Windows 7.
> It does NOT happen on Windows XP with cygwin 1.5, though.

Many directories on NTFS report a size of 0.  Following a pattern I
never understood, some directories report a size of 4K, 8K, etc.  It's
definitely not as simple as a dependency to the number of entries in the
directory.

What you observed, and which I can reproduce on W7, is that some
directories report a size of 0 if they have been stat(2)ed for the first
time.  Subsequent calls return a size of 4K.  This is not some weirdness
in Cygwin, the size of 4K is actually returned by the underlying Windows
OS call.  Looks like some strange property of the newer NTFS implementation.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]