[Python-bugs-list] [ python-Bugs-451890 ] Building with Large File Support fails

noreply@sourceforge.net noreply@sourceforge.net
Sun, 19 Aug 2001 22:24:02 -0700


Bugs item #451890, was opened at 2001-08-16 18:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=451890&group_id=5470

Category: Build
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerhard Häring (ghaering)
Assigned to: Nobody/Anonymous (nobody)
Summary: Building with Large File Support fails

Initial Comment:
(At least) on Linux, building 2.2-HEAD fails when 
building with Large File Support. In 
Objects/fileobject.c function _portable_ftell line 
262.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-08-19 22:24

Message:
Logged In: YES 
user_id=31435

Noting that C99 *requires* fpos_t values to hold all the 
info in an mbstate_t, in addition to stream position info.  
So we have to expect others to follow glibc in this, and 
eventually everyone.  fpos_t cannot resolve to an array 
type, but anything else is fair (in particular it need not 
map to an integral type -- and probably won't anymore).

We have to give up belief that fpos_t is a number, because 
it's not.  We can believe that ftell returns a number, 
because it does <wink> -- but ftell isn't suitable for 
large file support.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-08-17 06:13

Message:
Logged In: YES 
user_id=21627

This started in glibc 2.2, I believe, so it would appear in
Redhat 7, SuSE 7, etc.
To see the problem, you have to ./configure with
CFLAGS="-D_FILE_OFFSET_BITS=64" OPT="-O2 $(CFLAGS)"; see
pyconfig.h.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-17 03:55

Message:
Logged In: YES 
user_id=6380

Whoa.  Interesting. Which Linux version is this?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-08-17 00:21

Message:
Logged In: YES 
user_id=21627

This fails because in glibc, fpos_t contains an mb_state 
field, so that on restoring the file position, the 
multibyte encoding state of the file can be restored.

I see two solutions here:
- Python could give up the guarantee that the ftell result 
is a number, and return an object that embeds the fpos_t.
- Python could give up that guarantee that ftell/fseek 
works in all cases, and only use ftell(o), which should 
always return a number (atleast in Posix). If that 
approach is taken, an additional fgetpos/fsetpos call may 
be appropriate.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=451890&group_id=5470