URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13813>

                 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

    _______________________________________________________

Details:

gnustep-base-1.10.3
gnustep-gui-0.9.5
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");
    }
  else
    {
      printf("The file does not exist\n");
    }

  return 0;
}







    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13813>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to