delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/11/04:15:52

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 11 Feb 2010 10:15:29 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: du returns inconsistent results
Message-ID: <20100211091529.GI28659@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <7232A3A7C53F634B8E91E65BC7833C5112D3963FC5 AT TR-EXCH07 DOT prog DOT altair DOT com>
MIME-Version: 1.0
In-Reply-To: <7232A3A7C53F634B8E91E65BC7833C5112D3963FC5@TR-EXCH07.prog.altair.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

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

- Raw text -


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