chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-janitors] [Chicken-bugs] #348: Chicken should use proper C


From: Elf
Subject: Re: [Chicken-janitors] [Chicken-bugs] #348: Chicken should use proper C types for struct stat members
Date: Thu, 1 Nov 2007 01:30:58 -0700 (PDT)


perhaps a #define SIZEOF_STAT_ST_SIZE with corresponding typedef uint<n> would solve some of the problem? this could be autogenerated as part of the
chicken-config.h...

-elf

On Thu, 1 Nov 2007, Chicken Scheme wrote:

#348: Chicken should use proper C types for struct stat members
--------------------+-------------------------------------------------------
Reporter:  sjamaan  |       Owner:  felix
   Type:  defect   |      Status:  new
Priority:  major    |   Component:  core libraries
Version:  2.7      |    Keywords:  typing, C interface, posix
--------------------+-------------------------------------------------------
See the thread "[http://lists.gnu.org/archive/html/chicken-hackers/2007-
10/msg00017.html file-size not reporting correct size on big files]" on
chicken-hackers.

The problem is that chicken uses {{{unsigned-int}}} as the type of
{{{stat}}} structure members (and probably in other places, too!), which
causes problems on 32-bit architectures.  The {{{stat.st_size}}} is of
type {{{off_t}}}, which ''can'' be 64-bit on some systems, if compiled the
right way.  When using an {{{unsigned-int}}}, huge file sizes (bigger than
1Gb) overflow/get truncated.  Simply using an int64 is not the solution
either, as you don't know what size {{{off_t}}} is actually.  If it ''is''
32-bits you would be getting file sizes that are corrupted even more.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]