Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 249316 - [efs] On NFS folders on Linux, IFileInfo.getLength() != EFS.NONE
Summary: [efs] On NFS folders on Linux, IFileInfo.getLength() != EFS.NONE
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-01 09:32 EDT by Martin Oberhuber CLA
Modified: 2008-10-07 17:44 EDT (History)
1 user (show)

See Also:


Attachments
Unittest exposing the issue (2.73 KB, patch)
2008-10-01 09:37 EDT, Martin Oberhuber CLA
no flags Details | Diff
Patch fixing the code (3.33 KB, patch)
2008-10-01 10:08 EDT, Martin Oberhuber CLA
no flags Details | Diff
Alternative patch with API specification update (869 bytes, patch)
2008-10-01 10:32 EDT, Martin Oberhuber CLA
john.arthorne: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2008-10-01 09:32:20 EDT
Javadocs of IFileInfo.getLength() say that for folders, EFS.NONE should always be returned.

But on Linux (tried RHEL 4 and RHEL 5), when the folder is on an NFS-shared file system (in my case, my UNIX user home is on NFS shared from an other Redhat box), the length returned may be different (4096 in my case).
Comment 1 Martin Oberhuber CLA 2008-10-01 09:37:32 EDT
Created attachment 113986 [details]
Unittest exposing the issue
Comment 2 Martin Oberhuber CLA 2008-10-01 10:08:59 EDT
Created attachment 113994 [details]
Patch fixing the code

Attached patch fixes the code to comply with the API specification (untested!).

Given that java.io.File#getLength() API is specified to be "undefined" for folders, I'm actually sligthly more in favor of doing an API specification update in IFileInfo#getLength() to specify the length as undefined, instead of changing the code.
Comment 3 Martin Oberhuber CLA 2008-10-01 10:32:32 EDT
Created attachment 113998 [details]
Alternative patch with API specification update
Comment 4 Szymon Brandys CLA 2008-10-03 09:24:42 EDT
+1 for Alternative patch. We could mention that the value depends on the file system provider implementation.
Comment 5 John Arthorne CLA 2008-10-07 17:43:57 EDT
+1 also for the alternative patch. I have released this fix. I can't think of any case where a client would care about the length of a directory. Since the java.io.File implementation and the Linux implementation were not obeying the spec it's unlikely anyone was relying on this.