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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitted by:  Max Brante <mabr>
Submitted on:  Fri 15 Jul 2005 09:06:34 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Duplicate
Privacy: PublicAssigned to: None
Open/Closed: Closed

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

Duplicate of bug #13156 already fixed in CVS

Richard Frith-Macdonald <CaS>
Project 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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Fri 15 Jul 2005 09:40:44 AM UTCCaSStatusNone=>Duplicate
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1