harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Regis <xu.re...@gmail.com>
Subject Re: [jira] Created: (HARMONY-5987) [classlib][luni] - different behavior with RI when file path contains "\\" in Linux
Date Mon, 06 Oct 2008 03:34:00 GMT
Thanks Mark. After the fix, "\\" doesn't transform to "/" in constructor 
now, but new File("d1\\d2").mkdir(); return false and create nothing on 
  file system. The implementation of File.mkdir() delegate to native 
code by return mkdirImpl(properPath(true)); maybe properPath do the 
wrong thing. But I notice new File("d1\\d2").exists() will return false 
when there is file "d1/d2" in file system. So I suspect native code 
couldn't deal with "\\" correctly neither.

I will try to dig more...

Best Regards,

Mark Hindess wrote:
> In message <48E1E68E.5070102@gmail.com>, Tim Ellison writes:
>> Regis wrote:
>>> It seems intended to be, but I'm not sure. I think it's a great feature
>>> when porting the windows depended code("\\" in path name) to linux, but
>>> there is potential problem, how to reference a file which name contians
>>> "\\" on linux? And this different may cause surprise when some
>>> applications depends on the behavior of RI.
>>> Any comments/suggestions?
>> I think we need to change to allow \ to be passed through as part of the
>> file name on Linux.
> I agree with Tim.  In fact, I noticed this issue a little while ago and
> fixed it (plus some invalid tests) in commit r698140.
> -Mark.
>>> Regis Xu (JIRA) wrote:
>>>> [classlib][luni] - different behavior with RI when file path contains
>>>> "\\" in Linux
>>>> --------------------------------------------------------------------------
>> ---------
>>>>                  Key: HARMONY-5987
>>>>                  URL: https://issues.apache.org/jira/browse/HARMONY-5987
>>>>              Project: Harmony
>>>>           Issue Type: Bug
>>>>           Components: Classlib
>>>>     Affects Versions: 5.0M7
>>>>             Reporter: Regis Xu
>>>>              Fix For: 5.0M8
>>>> Consider the test:
>>>>         File file = new File("d1\\d2");
>>>>         file.mkdirs();
>>>> RI create a directory named "d1\d2", while Harmony create two
>>>> directories "d1" and "d1/d2", seems RI doesn't covert windows file
>>>> separator char "\\" to system separator char on Linux, and
>>>> spec says nothing about it. I quickly navigate the source, found we
>>>> have a method fixSlashes in java.io.File, which convert "\\" or "/" to
>>>> system separator char, so  it may be intended or a feature of harmony?

View raw message