Bug 1105 – std.c.linux.linux.stat fails for files > 2GB

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-04-06T12:38:00Z
Last change time
2014-02-16T15:26:26Z
Assigned to
bugzilla
Creator
Alexander.Blum

Attachments

IDFilenameSummaryContent-TypeSize
144dmd-1.014_bigfile64.diffbigfile support for DMD-1.014's Phobos (mostly un-tested)text/plain8425
145libphobos.a.bz2bzip2 compressed DMD-1.014 libphobos.a with bigfile supportapplication/x-bzip2277962

Comments

Comment #0 by Alexander.Blum — 2007-04-06T12:38:33Z
While trying to use listdir (combined with isdir) on a folder containing files > 2GB I ran into a "Value too large for defined data type" FileException. Further inspection showed that a call to std.c.linux.linux.stat returns -1 on files > 2GB. I found that st_size is of type int in struct_stat. Testfall: dd if=/dev/zero of=/tmp/test.dat bs=100MB count=22 error.d: import std.file; void main(char[][] args) { isdir ("/tmp/test.dat"); }
Comment #1 by thomas-dloop — 2007-04-25T12:49:13Z
This is a C issue. The below C code shows the same symbtoms like the above D code: # #include <sys/stat.h> # #include <stdio.h> # #include <errno.h> # # int main(){ # struct stat meta; # int code = stat("/tmp/test.dat", &meta); # # if(0 == code){ # printf("isdir: %i\n", S_ISDIR(meta.st_mode)); # }else{ # printf("errno: %i\n", errno); # } # # return 0; # } While this issue can be by-passed via stat64 (below) stat64 isn't guaranteed to be present (most current Linux system should support it but some odler ones don't): # #define _LARGEFILE64_SOURCE 1 # #include <sys/stat.h> # #include <stdio.h> # #include <errno.h> # # int main(){ # struct stat64 meta; # int code = stat64("/tmp/test.dat", &meta); # # if(0 == code){ # printf("isdir: %i\n", S_ISDIR(meta.st_mode)); # }else{ # printf("errno: %i\n", errno); # } # # return 0; # }
Comment #2 by thomas-dloop — 2007-04-28T12:08:40Z
Created attachment 144 bigfile support for DMD-1.014's Phobos (mostly un-tested)
Comment #3 by thomas-dloop — 2007-04-28T12:10:21Z
Created attachment 145 bzip2 compressed DMD-1.014 libphobos.a with bigfile support
Comment #4 by thomas-dloop — 2007-04-29T04:00:33Z
changed to "duplicate" because Bugzilla's duplication statistic is rather limited and doesn't support lower numbered issue reports to be marked as duplicate of an higher numbered one *** This bug has been marked as a duplicate of 579 ***