RFR : 8207395: jar has issues with UNC-path arguments for the jar -C parameter [windows]

Xueming Shen xueming.shen at oracle.com
Fri Jul 20 16:58:40 UTC 2018


+1

On 7/20/18, 1:08 AM, Baesken, Matthias wrote:
> Thanks !
> Sherman - are you fine with the latest version , if so I would push it  .
>
> Best regards, Matthias
>
>
>> -----Original Message-----
>> From: Lindenmaier, Goetz
>> Sent: Freitag, 20. Juli 2018 09:38
>> To: Baesken, Matthias<matthias.baesken at sap.com>; core-libs-
>> dev at openjdk.java.net; xueming.shen at oracle.com
>> Subject: RE: RFR : 8207395: jar has issues with UNC-path arguments for the
>> jar -C parameter [windows]
>>
>> Looks good.
>>
>> Best regards,
>>    Goetz.
>>
>>> -----Original Message-----
>>> From: Baesken, Matthias
>>> Sent: Donnerstag, 19. Juli 2018 11:15
>>> To: core-libs-dev at openjdk.java.net; xueming.shen at oracle.com
>>> Cc: Lindenmaier, Goetz<goetz.lindenmaier at sap.com>
>>> Subject: Re: RFR : 8207395: jar has issues with UNC-path arguments for the
>>> jar -C parameter [windows]
>>>
>>> Hi Sherman ,  I like your proposal , I prepared  this webrev :
>>>
>>> http://cr.openjdk.java.net/~mbaesken/webrevs/8207395.2/
>>>
>>>
>>> (and looking forward to your future  move  of  jar to a complete nio
>>> implementation !)
>>>
>>> Best regards, Matthias
>>>
>>>
>>>> Message: 2
>>>> Date: Wed, 18 Jul 2018 11:37:34 -0700
>>>> From: Xueming Shen<xueming.shen at oracle.com>
>>>> To: core-libs-dev at openjdk.java.net
>>>> Subject: Re: RFR : 8207395: jar has issues with UNC-path arguments for
>>>> 	the jar -C parameter [windows]
>>>> Message-ID:<5B4F88EE.8080608 at oracle.com>
>>>> Content-Type: text/plain; charset=UTF-8; format=flowed
>>>>
>>>>
>>>> Ideally it would be preferred to move jar to a complete nio
>>>> implementation and we then
>>>> can leave the WindowsPath to take care of this stuff. That said that
>>>> would be a relative
>>>> big change. I do have a version on my disk but need clean up, test,
>>>> performance measurement
>>>> and review to get it.
>>>>
>>>> So for now I think it's fine to add this small fix to support the unc.
>>>>
>>>> now sure if the following is better?
>>>>
>>>>    637                         boolean hasUNC = File.separatorChar == '\\'&&
>>>> dir.startsWith("//");
>>>>    638                         while (dir.indexOf("//")>   -1) {
>>>>    639                             dir = dir.replace("//", "/");
>>>>    640                         }
>>>>    641                         if (isUNC)     // Restore Windows UNC path.
>>>>    642                             dir = "/" + dir;
>>>>
>>>> -Sherman
>>>>
>>>>
>>>> On 7/18/18, 6:44 AM, Roger Riggs wrote:
>>>>> Hi,
>>>>>
>>>>> Is there any chance that just using java.nio.file.Path.of will do the
>>>>> needed cleanup?  (or Paths.get)
>>>>> It seems a shame to spread this kind of adhoc fixup around?
>>>>>
>>>>> $0.02, Roger
>>>>>
>>>>> On 7/18/2018 5:31 AM, Lindenmaier, Goetz wrote:
>>>>>> Hi Matthias,
>>>>>>
>>>>>> thanks for doing this fix.
>>>>>>
>>>>>> I think this can be noted down a bit better, avoiding duplicating the
>>>>>> loop.
>>>>>> Also, please remove the redundant dir.replace(File.separatorChar, '/').
>>>>>>
>>>>>>                            dir = dir.replace(File.separatorChar, '/');
>>>>>> +                        String unc = (dir.startsWith("//")&&
>>>>>> (File.separatorChar == '\\')) ? "/" : "";
>>>>>>                            while (dir.indexOf("//")>  -1) {
>>>>>>                                dir = dir.replace("//", "/");
>>>>>>                            }
>>>>>> -
>>>>>> pathsMap.get(version).add(dir.replace(File.separatorChar, '/'));
>>>>>> +                        // Restore the second leading '/' needed for
>>>>>> the Windows UNC path.
>>>>>> +                        dir = unc + dir;
>>>>>> +                        pathsMap.get(version).add(dir);
>>>>>>                            nameBuf[k++] = dir + args[++i];
>>>>>>
>>>>>> Best regards,
>>>>>>     Goetz.
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: core-libs-dev [mailto:core-libs-dev-
>> bounces at openjdk.java.net]
>>>> On
>>>>>>> Behalf Of Baesken, Matthias
>>>>>>> Sent: Dienstag, 17. Juli 2018 13:15
>>>>>>> To: core-libs-dev at openjdk.java.net
>>>>>>> Subject: [CAUTION] RFR : 8207395: jar has issues with UNC-path
>>>>>>> arguments
>>>>>>> for the jar -C parameter [windows]
>>>>>>>
>>>>>>> Please review   this small fix for allowing  windows UNC paths  in
>>>>>>> the  jar -C
>>>>>>> parameter.
>>>>>>> Currently  passing a UNC path to a directory   with -C<dir>    fails  :
>>>>>>>
>>>>>>> c:\testdir>c:\tools\jdk10\bin\jar.exe test.jar -C
>> \\MYMACHINE\subdir
>>>>>>> README.txt
>>>>>>> Illegal option: s
>>>>>>> Try `jar --help' for more information.
>>>>>>>
>>>>>>> With  the patch  it works .
>>>>>>>
>>>>>>> webrev
>>>>>>>
>>>>>>> http://cr.openjdk.java.net/~mbaesken/webrevs/8207395/
>>>>>>>
>>>>>>> bug
>>>>>>>
>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8207395
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks, Matthias



More information about the core-libs-dev mailing list