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

FilePath.exists = false with large files

Moderators: kris

Posted: 01/21/09 12:39:19

simple example:

module test;


void main(char[][] args) {
    auto fp = new FilePath(args[1]);

I call this with a file which size is 2.4G. It returns false. If i remove the file an create it with size 0 it return true

Is this a Bug in Tango or is this a System Problem

I use Red Hat 5.

(sorry for bad english)

Sorry for my bad English, im German ;)

Author Message

Posted: 01/21/09 16:06:31

Just to check you're not compiling with version=SMALLFILE ? You could check USE_LARGEFILE64 in tango/stdc/posix/config.d to be sure.

The tango check "exists" actually returns true if no errors occur getting a stat of the file, so another error could have occurred.

You could try the following C program to check what the error actually is (it doesn't seem possible to get the error with D):

#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>

int main (int argc, char *argv[]) {
    if (argc < 2) return 1;
    struct stat stats;
    if (stat (argv[1], &stats)) {
        printf ("Error from stat: %d\n",errno);
        return 1;
    return 0;

and look it up:

Posted: 01/22/09 07:23:21

this is my tango/stdc/posix/config.d:

 * D header file for POSIX.
 * Copyright: Public Domain
 * License:   Public Domain
 * Authors:   Sean Kelly
 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
module tango.stdc.posix.config;

public import tango.stdc.config;

extern (C):

version( linux )
  version( none /* X86_64 */ )
    const bool  __USE_LARGEFILE64   = true;
    const bool  __USE_LARGEFILE64   = false;
    const bool  __USE_FILE_OFFSET64 = __USE_LARGEFILE64;
    const bool  __REDIRECT          = false;

I have an X86_64 System. if i change the second USE_LARGEFILE64 to true i get some errors like this:

Error: identifier 'off64_t' is not defined

your small programm runs without any error.

This is the output from stat Programm:

  File: „/file-name-is-secret“
  Size: 2492461056      Blocks: 4872856    IO Block: 4096   reguläre Datei
Device: 16h/22d Inode: 2053144659  Links: 1
Access: (0640/-rw-r-----)  Uid: ( 1019/   xxxxx   Gid: (  xxx/    xxxx)
Access: 2009-01-16 10:56:40.000000000 +0100
Modify: 2009-01-15 13:15:20.000000000 +0100
Change: 2009-01-15 13:15:20.000000000 +0100

Sorry for my bad English, im German ;)

Posted: 01/22/09 09:34:14

Could you update to tango trunk (or wait for the 0.99.8 release)? I fixed large file support since 0.99.7.

Posted: 01/22/09 11:30:17

Ok, update was hard because i using dwt and deprecated colletions ;) but now it works fine. thanks.

Sorry for my bad English, im German ;)