bugGNUstep - Bugs: bug #13813, NSFileManager fileExistsAtPath...

Group
 
 

bug #13813: NSFileManager fileExistsAtPath does not work for files >= 2GB

Submitter:  Max Brante <mabr>
Submitted:  Fri 15 Jul 2005 09:06:34 AM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 15 Jul 2005 09:40:44 AM UTC, comment #1: 

Duplicate of bug #13156 already fixed in CVS

Richard Frith-Macdonald <CaS>
Group Member
Fri 15 Jul 2005 09:06:34 AM UTC, original submission:  

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;
}

Max Brante <mabr>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-07-15 CaS StatusNone Duplicate
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-d3ae.
Corresponding source code