[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #13813] NSFileManager fileExistsAtPath does not work for files >= 2

From: Max Brante
Subject: [bug #13813] NSFileManager fileExistsAtPath does not work for files >= 2GB
Date: Fri, 15 Jul 2005 09:06:35 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050712 Firefox/1.0.4


                 Summary: NSFileManager fileExistsAtPath does not work for
files >= 2GB
                 Project: GNUstep
            Submitted by: mabr
            Submitted on: Fri 07/15/2005 at 09:06
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open



linux 2.6.11
gcc 3.3.5

When using fileExistsAtPath method of NSFileManager for files that are >= 2GB
in size the method return NO.

Also in in NSOpenPanel files >= 2GB does not show.

Possible solution:

I think the culprit is the use of stat. When a file has a size >= 2GB, the
size of the file does not fit in st_size in the stat struct and the call to
stat fails (on linux and maybe others).

Consider the sample source code below. It reports that the file does not exist
if the test.img is a file >= 2GB. However if the code is compiled with
-D_FILE_OFFSET_BITS=64, st_size is 64 bits and can hold the size of the file
and it works.

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main()
  struct stat myStat;

  if (0 == stat("test.img",&myStat))
      printf("The file exists\n");
      printf("The file does not exist\n");

  return 0;


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]