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 reports half of correct file sizes


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@cygwin.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/


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