lfs confusion

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Sep 23 11:07:08 EDT 2004


I am a bit confused about LFS in python.  In the olden days, I used
the following to test whether python and my kernel supported large
files

    >>> fd = open('/dev/null', 'rw')
    >>> fd.tell()
    0L

If 0L was returned, LFS was enabled, if 0 was returned, LFS was not
enabled.

I built python with LFS

  499  CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS"         ./configure
  501  make
  502  make install

But fd.tell() returned 0.  I wrote a little script to create a large
file >4GB

    [root at crcdocs tmp]# cat lfs_write.py
    fd = file('test2.dat', 'w')

    SIZE = 4096
    STOP = 2**32
    total = 0
    s = 'a'*SIZE
    while total<STOP:
        fd.write(s)
        total += SIZE
        print total


    print fd.tell()


and it ran without incident, reporting at the end 4294967296 (no L).
So I can at least write files past the 2GB limit (and I wrote a script
to verify that I could read the who file too).  

I am installing a zope server and will need to create a Data.fs that
exceeds the 2GB limit.  

Is the fd.tell() 0L trick no longer valid.  What is the right way to
test for LFS support in python?

JDH



More information about the Python-list mailing list