[Issue 11791] std.file.write failed to write huge files

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 28 14:18:00 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11791



--- Comment #4 from Peter Alexander <peter.alexander.au at gmail.com> 2014-01-28 14:17:52 PST ---
(In reply to comment #3)
> (In reply to comment #2)
> > import std.file;
> > 
> > void main() {
> >     auto data = new byte[2L^^31];
> >     std.file.write("data", data);
> > }
> > 
> > std.file.FileException at std/file.d(391): data: Success
> 
> works fine with 2L^^30

Ok, so that line indicates that the call to "close" failed (returned non-zero),
but didn't set errno, which is weird.

One possibility is that you are running a 32-bit kernel, and write will only be
able to write INT_MAX bytes, which would explain the error (although I would
have hoped for it to set errno). Are you running a 32-bit kernel?

I suppose an alternate question is: can you write a file like this using plain
C functions, or is it a D specific issue? Phobos literally just forwards the
call onto a few C functions (open file, write, close), so I suspect it is not
an issue in Phobos.

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


More information about the Digitalmars-d-bugs mailing list