On Mon, Jan 15, 2001 at 11:02:39AM -0500, Guido van Rossum wrote: > Greg Stein noticed me checking in *yet* another system that needs > the fallback TELL64() definition in fileobjects.c, and wrote: > > > All of those #ifdefs could be tossed and it would be more robust (long term) > > if an autoconf macro were used to specify when TELL64 should be defined. > > > > [ I've looked thru fileobject.c and am a bit confused: the conditions for > > defining TELL64 do not match the conditions for *using* it. that would > > seem to imply a semantic error somewhere and/or a potential gotcha when > > they get skewed (like I assume what happened to FreeBSD). simplifying with > > an autoconf macro may help to rationalize it. ] The problem is that these systems lie when they "say" (according to Python's configure tests for HAVE_LARGEFILE_SUPPORT) that they have largefile support. This seems to have happened for a particular release of BSD (which has since been fixed). I think that the Right(tm) (meaning the cleanest solution where the tests and definitions in the code actually represent the truth) answer is a proper configure test (sort of as Greg suggests). I don't really feel comfortable writing that patch (because (1) lack of time and (2) inability to test, I don't have any access to any of these BSD machines). [Guido] > > I have a better idea. Since "lseek((fd),0,SEEK_CUR)" seems to be the > universal fallback, why not just define TELL64 to be that if it's not > previously defined (currently only MS_WIN64 has a different > definition)? It isn't always *used* (the conditions under which > _portable_fseek() uses it are quite complex), but *when* it is used, > this seems to be the most common definition... While I agree that it is annoying that the build breaks for these platforms I think that it is appropriate that the build breaks. Having to put these: #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(_HAVE_BSDI) || defined(__APPLE__) definitions here gives a nice list of those platforms that *do* lie. I would prefer that to having an "#else" block that just captures all other cases, but that is just my opinion. Options (in order of preference): (1) Update the configure test for HAVE_LARGEFILE_SUPPORT such that the proper versions of these OSes do *not* #define it. (2) Guido's suggestion. (2) Keep extending the "#elif" list. ^---- using (2) twice was intentional Trent > > *** fileobject.c 2001/01/15 10:36:56 2.106 > --- fileobject.c 2001/01/15 16:02:06 > *************** > *** 58,66 **** > /* define the appropriate 64-bit capable tell() function */ > #if defined(MS_WIN64) > #define TELL64 _telli64 > ! #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(_HAVE_BSDI) || defined(__APPLE__) > ! /* NOTE: this is only used on older > ! NetBSD prior to f*o() funcions */ > #define TELL64(fd) lseek((fd),0,SEEK_CUR) > #endif > > --- 58,65 ---- > /* define the appropriate 64-bit capable tell() function */ > #if defined(MS_WIN64) > #define TELL64 _telli64 > ! #else > ! /* Fallback for older systems that don't have the f*o() funcions */ > #define TELL64(fd) lseek((fd),0,SEEK_CUR) > #endif > > > I'll check this in after 24 hours unless a better idea comes up. > Better idea but no patch. :( Trent -- Trent Mick TrentM@ActiveState.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4