You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Spark Shen <sm...@gmail.com> on 2006/10/20 09:25:36 UTC

[classlib][luni] java.io.File bug?

Hi All:

When login as 'root' under Linux, the following test case fails on 
Harmony while passes on RI.
public void test_canWrite() throws IOException{
File f = File.createTempFile("test", null);
f.setReadOnly();
assertTrue(f.canWrite());
f.deleteOnExit();
}

I think RI's behavior is more reasonable since the 'root' account does 
have read/write privilege for temp files. However, Harmony only treats 
'root' as ordinary other users.
It seems that similar problem happens on java.io.File.canRead(). 

As we all know, File class deals with many different file object on many 
different file system, would any one test File behavior on other file 
systems.

Best regards

-- 
Spark Shen
China Software Development Lab, IBM


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][luni] java.io.File bug?

Posted by Spark Shen <sm...@gmail.com>.
Tony Wu 写道:
> you mean it fails when f.setReadOnly();?
Hi Tony:

No, setReadOnly is used to change the access privilege. After this 
change harmony and RI behaves differently.

Best regards
>
> On 10/20/06, Spark Shen <sm...@gmail.com> wrote:
>> Hi All:
>>
>> When login as 'root' under Linux, the following test case fails on
>> Harmony while passes on RI.
>> public void test_canWrite() throws IOException{
>> File f = File.createTempFile("test", null);
>> f.setReadOnly();
>> assertTrue(f.canWrite());
>> f.deleteOnExit();
>> }
>>
>> I think RI's behavior is more reasonable since the 'root' account does
>> have read/write privilege for temp files. However, Harmony only treats
>> 'root' as ordinary other users.
>> It seems that similar problem happens on java.io.File.canRead().
>>
>> As we all know, File class deals with many different file object on many
>> different file system, would any one test File behavior on other file
>> systems.
>>
>> Best regards
>>
>> -- 
>> Spark Shen
>> China Software Development Lab, IBM
>>
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
>
>


-- 
Spark Shen
China Software Development Lab, IBM


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][luni] java.io.File bug?

Posted by Tony Wu <wu...@gmail.com>.
you mean it fails when f.setReadOnly();?

On 10/20/06, Spark Shen <sm...@gmail.com> wrote:
> Hi All:
>
> When login as 'root' under Linux, the following test case fails on
> Harmony while passes on RI.
> public void test_canWrite() throws IOException{
> File f = File.createTempFile("test", null);
> f.setReadOnly();
> assertTrue(f.canWrite());
> f.deleteOnExit();
> }
>
> I think RI's behavior is more reasonable since the 'root' account does
> have read/write privilege for temp files. However, Harmony only treats
> 'root' as ordinary other users.
> It seems that similar problem happens on java.io.File.canRead().
>
> As we all know, File class deals with many different file object on many
> different file system, would any one test File behavior on other file
> systems.
>
> Best regards
>
> --
> Spark Shen
> China Software Development Lab, IBM
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Tony Wu
China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][luni] java.io.File bug?

Posted by Paulex Yang <pa...@gmail.com>.
Spark Shen wrote:
> Hi All:
>
> When login as 'root' under Linux, the following test case fails on 
> Harmony while passes on RI.
> public void test_canWrite() throws IOException{
> File f = File.createTempFile("test", null);
> f.setReadOnly();
> assertTrue(f.canWrite());
> f.deleteOnExit();
> }
> I think RI's behavior is more reasonable since the 'root' account does 
> have read/write privilege for temp files. However, Harmony only treats 
> 'root' as ordinary other users.
> It seems that similar problem happens on java.io.File.canRead().
I agree that RI's behavior is reasonable, although a little different 
with spec[1], Harmony should fix the implementation.

[1]public boolean *setReadOnly* ()
Marks the file or directory named by this abstract pathname so that only 
read operations are allowed. After invoking this method the file or 
directory is guaranteed not to change until it is either deleted or 
marked to allow write access. Whether or not a read-only file or 
directory may be deleted depends upon the underlying system.
>
> As we all know, File class deals with many different file object on 
> many different file system, would any one test File behavior on other 
> file systems.
I didn't follow, what you mean here?
>
> Best regards
>


-- 
Paulex Yang
China Software Development Lab
IBM