On Fri, 27 Sep 2024 01:41:17 GMT, Henry Jen <henry...@openjdk.org> wrote:

>> src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties line 
>> 316:
>> 
>>> 314: main.help.opt.extract.keep-old-files=\
>>> 315: \  -k, --keep-old-files       Do not overwrite existing files.\n\
>>> 316: \                             In particular, if a file appears more 
>>> than once in an\n\
>> 
>> In addition, we need to update the help to clarify -x. --extract behavior 
>> that it will overwrite by default.
>> 
>> Here is the verbiage from tar to give you a start
>> 
>> ` -x      Extract to disk from the archive.  If a file with the same name 
>> appears more than
>>              once in the archive, each copy will be extracted, with later 
>> copies overwriting
>>              (replacing) earlier copies.  The long option form is --extract.`
>
> Updated.

Hello Henry, I think this `-k` option help text would need a slight 
modification. Right now it states that if a file appears more than once in an 
archive, then this setting this flag will not overwrite the earlier copies. In 
reality, it doesn't matter how many times the file appears in the archive - 
even if it appears just once, and if the file is being extracted into a 
directory which already has the same named file at that path, then this `-k` 
flag will not overwrite that existing file.

So I think we should reword it to talk about its behaviour in context of some 
file already existing in the destination directory where the jar contents are 
being extracted. 

I wonder if we should make a mention that we don't do any case sensitive checks 
for the existence of the file in the destination directory and instead we use 
filesystem API to check for existence (which depending on the filesystem may be 
case insensitive, like macosx).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21141#discussion_r1779492170

Reply via email to