-
Notifications
You must be signed in to change notification settings - Fork 49
[MDEP-651] Warn on duplicate archive entries #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
52a9a1f
9b09808
e2f6f4c
e5a465c
6b03a0e
b6f5499
cf7c6d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -343,9 +343,14 @@ protected void extractFile( final File srcF, final File dir, final InputStream c | |
|
||
try | ||
{ | ||
if ( !isOverwrite() && f.exists() && ( f.lastModified() >= entryDate.getTime() ) ) | ||
if ( f.exists() && !StringUtils.equalsIgnoreCase( entryName, canonicalDestPath ) ) | ||
{ | ||
return; | ||
String message = String.format( "Archive entry %s and existing file %s names differ only by case." | ||
+ " This may cause issues on case insensitive file systems.", entryName, canonicalDestPath ); | ||
getLogger().warn( message ); | ||
if ( !isOverwrite() ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect
I can extend this table when required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Also added tests that verify the warning is logged. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mentioned #3 is incorrect: why warn if there is no override? Did you change that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I did not change that - I strictly followed the example table. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @plamentotev and/or @michael-o, any thoughts on rule number 3? Would it make sense to log the warning when we're not going to overwrite anyway? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the end it looks like we have 2 tastes:
I can imagine that if develop teams are all using case-sensitive OS, the warning doesn't add value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rfscholte How do you want to guarantee the second taste? There are a number of factors to determine case-sensitivity. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK the JRE takes care of that: new File("readme.txt").exists() should return true even it is actually "README.txt" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right, of course. Complete forgot that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Double-checked that last Friday, can confirm for Windows, macOS and Linux. |
||
return; | ||
} | ||
} | ||
|
||
// create intermediary directories - sometimes zip don't add them | ||
|
Uh oh!
There was an error while loading. Please reload this page.