delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/26/07:00:26

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Sun, 26 Dec 2004 13:00:07 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: du reports half of correct file sizes
Message-ID: <20041226120007.GA20048@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <00ca01c4eb05$4db3f660$6400000a AT RossLap> <41CE5B39 DOT 1D284FC3 AT dessent DOT net>
Mime-Version: 1.0
In-Reply-To: <41CE5B39.1D284FC3@dessent.net>
User-Agent: Mutt/1.4.2i

On Dec 25 22:33, Brian Dessent wrote:
> --- du.c.orig   2004-12-25 22:08:55.138687500 -0800
> +++ du.c        2004-12-25 22:09:16.966812500 -0800
> @@ -382,7 +382,7 @@ process_file (FTS *fts, FTSENT *ent)
>      {
>        size = (apparent_size
>               ? sb->st_size
> -             : ST_NBLOCKS (*sb) * ST_NBLOCKSIZE);
> +             : ST_NBLOCKS (*sb) * ST_BLKSIZE(*sb));
>      }
>  
>    if (first_call)
> 
> Perhaps a better way would be to modify system.h such that ST_NBLOCKSIZE
> is set to 1024 for Cygwin, since there could very well be other places
> where ST_NBLOCKSIZE is used in relation to file lengths, in which case
> other coreutils
> programs might have issues as well.  

Thanks, Brian.  The right fix was actually present in system.h of
fileutils, but for some reason it's missing in coreutils:

Index: system.h
===================================================================
RCS file: /home/cvs/cvsroot/coreutils-5.2.1/src/system.h,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 system.h
--- system.h    20 Dec 2004 14:42:05 -0000      1.1.1.1
+++ system.h    26 Dec 2004 11:51:53 -0000
@@ -320,7 +320,11 @@ initialize_exit_failure (int status)
 #endif
 
 #ifndef ST_NBLOCKSIZE
-# define ST_NBLOCKSIZE 512
+# ifdef S_BLKSIZE
+#  define ST_NBLOCKSIZE S_BLKSIZE
+# else
+#  define ST_NBLOCKSIZE 512
+# endif
 #endif
 
 /* Redirection and wildcarding when done by the utility itself.

I'll upload a new version of coreutils in the next couple of days.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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