Package: python-fuse
Version: 2.5-5
Followup-For: Bug #407695

Below is a diff of the quick patch I made. It does not interfere with
existing applications if they work within the existing 2*31 -1 size limit. If
they do, the change would mean read/write/truncate would receive the correct
offset size and it is their responsibility to handle it properly. The problem
I see is the C wrapper of getattr still expect a 32 bit signed integer so it
cannot be returned as stored. As a result, I use "-1" as an indicator 
that field is invalid and two extra fields at the end of the tuple is needed
to construct the > 32 bit size. See the getattr C wrapper for how to
construct it. 


--- _fusemodule.c.old   2006-02-04 11:21:38.000000000 +0800
+++ _fusemodule.c       2007-01-21 14:26:17.000000000 +0800
@@ -85,6 +85,14 @@
 st->st_mtime= PyInt_AsLong(PySequence_GetItem(v, 8));
 st->st_ctime= PyInt_AsLong(PySequence_GetItem(v, 9));
 
+#ifdef HAVE_LONG_LONG
+if (st->st_size < 0) {
+    off_t xx = PyInt_AsLong(PySequence_GetItem(v, 10));
+    off_t yy = PyInt_AsLong(PySequence_GetItem(v, 11));
+    st->st_size = (xx << 31) + yy;
+} 
+#endif
+    
 /* Fill in fields not provided by Python lstat() */
 st->st_blksize= 4096;
 st->st_blocks= (st->st_size + 511)/512;
@@ -258,7 +266,11 @@
 
 static int truncate_func(const char *path, off_t o)
 {
+#ifdef HAVE_LONG_LONG
+       PyObject *v = PyObject_CallFunction(truncate_cb, "sL", path, o);
+#else
        PyObject *v = PyObject_CallFunction(truncate_cb, "si", path, o);
+#endif
        PROLOGUE
        EPILOGUE
 }
@@ -278,7 +290,11 @@
 
 static int read_func(const char *path, char *buf, size_t s, off_t off)
 {
+#ifdef HAVE_LONG_LONG
+       PyObject *v = PyObject_CallFunction(read_cb, "siL", path, s, off);
+#else
        PyObject *v = PyObject_CallFunction(read_cb, "sii", path, s, off);
+#endif
        PROLOGUE
        if(PyString_Check(v)) {
                if(PyString_Size(v) > s) goto OUT_DECREF;
@@ -292,7 +308,11 @@
 
 static int write_func(const char *path, const char *buf, size_t t, off_t off)
 {
+#ifdef HAVE_LONG_LONG
+       PyObject *v = PyObject_CallFunction(write_cb,"ss#L", path, buf, t, off);
+#else
        PyObject *v = PyObject_CallFunction(write_cb,"ss#i", path, buf, t, off);
+#endif
        PROLOGUE
        EPILOGUE
 }
-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-co-0.8
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages python-fuse depends on:
ii  libfuse2                      2.5.3-4.1  Filesystem in USErspace library
ii  python                        2.4.4-2    An interactive high-level object-o
ii  python-central                0.5.12     register and build utility for Pyt

python-fuse recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to