> Looks like it. doko, can you please look at this? This is in both
> 2.3 and 2.4. I'm surprised that Python would have such a bug that's
> still not fixed but maybe it's just not compiled with the right
> options or something?
It looks like a 64-bit issue indeed: 4912214227121058 in hex is
0x1173A2001173A2L, so the real value apparently should be 0x1173A2.
I tried reproducing this on the SF compile farm (Debian 3.0),
with stock Python 2.3.5, but I couldn't: it just works correctly
there. So there must be something wrong with the build process,
the C library, or the kernel.
It would be helpful to get the preprocessor output for posixmodule.i.
I'll include the relevant fragments from SF below; on the real build
environment, you should see the same (somewhat differently formatted).
One cause for these results would be if a 64-bit struct statvfs
would be used to call the 32-bit statvfs(2).
Regards,
Martin
struct statvfs
{
unsigned long int f_bsize;
unsigned long int f_frsize;
__fsblkcnt64_t f_blocks;
__fsblkcnt64_t f_bfree;
__fsblkcnt64_t f_bavail;
__fsfilcnt64_t f_files;
__fsfilcnt64_t f_ffree;
__fsfilcnt64_t f_favail;
unsigned long int f_fsid;
unsigned long int f_flag;
unsigned long int f_namemax;
int __f_spare[6];
};
extern int statvfs(__const char *__restrict __file,
struct statvfs *__restrict __buf)
__asm__ ("" "statvfs64" ) ;
static PyObject*
_pystatvfs_fromstructstatvfs(struct statvfs st) {
PyObject *v = PyStructSequence_New(&StatVFSResultType);
if (v == ((void *)0) )
return ((void *)0) ;
(((PyStructSequence *)( v ))->ob_item[ 0 ] =
PyInt_FromLong((long) st.f_bsize) ) ;
(((PyStructSequence *)( v ))->ob_item[ 1 ] =
PyInt_FromLong((long) st.f_frsize) ) ;
(((PyStructSequence *)( v ))->ob_item[ 2 ] =
PyInt_FromLong((long) st.f_blocks) ) ;
(((PyStructSequence *)( v ))->ob_item[ 3 ] =
PyInt_FromLong((long) st.f_bfree) ) ;
(((PyStructSequence *)( v ))->ob_item[ 4 ] =
PyInt_FromLong((long) st.f_bavail) ) ;
(((PyStructSequence *)( v ))->ob_item[ 5 ] =
PyInt_FromLong((long) st.f_files) ) ;
(((PyStructSequence *)( v ))->ob_item[ 6 ] =
PyInt_FromLong((long) st.f_ffree) ) ;
(((PyStructSequence *)( v ))->ob_item[ 7 ] =
PyInt_FromLong((long) st.f_favail) ) ;
(((PyStructSequence *)( v ))->ob_item[ 8 ] =
PyInt_FromLong((long) st.f_flag) ) ;
(((PyStructSequence *)( v ))->ob_item[ 9 ] =
PyInt_FromLong((long) st.f_namemax) ) ;
return v;
}
static PyObject *
posix_statvfs(PyObject *self, PyObject *args)
{
char *path;
int res;
struct statvfs st;
if (!PyArg_ParseTuple(args, "s:statvfs", &path))
return ((void *)0) ;
{ PyThreadState *_save; _save = PyEval_SaveThread();
res = statvfs(path, &st);
PyEval_RestoreThread(_save); }
if (res != 0)
return posix_error_with_filename(path);
return _pystatvfs_fromstructstatvfs(st);
}
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]