www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4060] New: Phobos + linux problems with files > 2GB

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4060

           Summary: Phobos + linux problems with files > 2GB
           Product: D
           Version: 1.057
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: egonelbre gmail.com


--- Comment #0 from Egon Elbre <egonelbre gmail.com> 2010-04-04 15:50:46 PDT ---
Phobos is unable to seek/position positions that are > int.max

---
import std.stdio;
import std.string;
import std.stream;

int main(string[] args){
    auto file = new BufferedFile(args[1]);
    file.seek(cast(ulong)int.max + cast(ulong) atoi(args[2]), SeekPos.Set);
    writefln("%d", file.position);
    return 1;
}
---

Problem also happens with trying to use MMFile with files larger than int.max.

Probably related to bug 3409.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 04 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4060


Justin Spahr-Summers <Justin.SpahrSummers gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Justin.SpahrSummers gmail.c
                   |                            |om


--- Comment #1 from Justin Spahr-Summers <Justin.SpahrSummers gmail.com>
2010-04-05 03:06:44 CDT ---
This strikes me as a mistake in the Phobos declaration of seek(). The
underlying stdio fseek() function can only take longs as offsets, and Phobos'
seek() is defined the same way; however, a 'long' in C almost always
corresponds to an 'int' in D.

It's definitely a bug one way or the other, but to work around it you may want
to use offsets from SEEK_CUR instead of SEEK_SET.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2010