Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1145 (assigned defect)

Opened 3 months ago

Last modified 1 month ago

Exception for large file in FileConduit.position()

Reported by: keinfarbton Assigned to: sean (accepted)
Priority: critical Milestone: 0.99.8
Component: Tango Version: 0.99.6 Jeff
Keywords: triage Cc:

Description

large file means greater 2 GB.

FileConduit.position() calls seek(), which calls

long result = Posix.lseek( handle, 0, Seek.Anchor.Current );

This fails because lseek cannot return the correct position in the 32 bit return value of type "off_t". I checked with a C program, on my linux the off_t type is also 4 byte. So the signature is correct.

I found a solution that works for me, using lseek64. In unistd.d:62 I added

long lseek64( int, long, int );

and in FileConduit:553 I changed the code to

long result = posix.lseek64 (handle, /+cast(int)+/ offset, anchor);

I am not sure if this can be a general solution. Is lseek64 available on all posix platforms.

Change History

06/14/08 09:16:28 changed by keinfarbton

Same problem can be expected in TempFile:559

06/14/08 15:25:15 changed by kris

  • owner changed from kris to sean.

File support for Posix is currently 32bit only. The 64bit headers need to be resolved first, which Sean is aware of

06/15/08 12:28:40 changed by keinfarbton

with 64bit you meant the filesystem API, not the OS?

Just to clarify, i have this problem on a x86 32 bit linux ubuntu 8.04 with dmd.

06/17/08 05:00:47 changed by larsivi

I believe largefile support is a combination of the FS supporting it (most do these days), and the OS/kernel supporting it (most do these days), but there is no POSIX 64 bit standard, so this is done by mapping various combinations filefoo and filefoo64 calls onto either the same underlying system calls, or stuff like foo(2) - this all depends on the OS, for instance is Solaris different from Linux.

So to answer your last question, Tango's API doesn't properly support 64 bit filesystems.


As mentioned elsewhere, best bet is to somehow pick up the relevant C define and translate it to a D version or const value that can be checked in D source.

It would be sweet if the compilers had a way to do this, but for DMD for instance, we probably can check when creating/modifying dmd.conf, and set the appropriate version.

One of these days I'll collect my thoughts on this in one place ...

06/17/08 05:01:30 changed by larsivi

FWIW, #656 is the original large file system ticket I think.

06/17/08 05:21:50 changed by larsivi

  • keywords set to triage.

07/10/08 07:04:27 changed by larsivi

  • milestone changed from 0.99.7 to 0.99.8.

07/25/08 14:38:51 changed by sean

  • status changed from new to assigned.

This should be fixed with the largefile changes I checked in today. However, I don't want to switch Tango over to using the new routines until they've been verified to work. To do this, set USE_LARGEFILE64 to true in tango.stdc.posix.config.