Skip to content

UnArchiver inconsisteny regarding overwrite #228

Closed
@cstamas

Description

@cstamas

In case of UnArchiver we have this Javadoc:
https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/main/java/org/codehaus/plexus/archiver/UnArchiver.java#L58-L66

The default value of overwrite member is true:
https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java#L64

But in AbstractUnArchiver, the extractFile method invokes shouldExtractEntry method to check is entry to be extracted, and this method looks like this:
https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java#L401-L453

Hence, the Javadoc says one, but this method does "extract only if not exists or is newer" (and there is case thing but keep this issue simple). Basically, if file exists, and is newer, it is NOT overwritten despite overwrite member is true.

This is kinda confirmed with UTs as well:
https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/test/java/org/codehaus/plexus/archiver/AbstractUnArchiverTest.java#L127-L180

Do I miss something here?

Reason: using git results that files being used (for example checked out) will always have "now" timestamps, even if project itself is ancient (years old). Hence, this MAY be causing issue like https://issues.apache.org/jira/browse/MWRAPPER-77

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions