Skip to content
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

UnArchiver fails to extract files if the target exists and is read-only #138

Open
Bdot42 opened this issue Jul 15, 2020 · 1 comment
Open
Labels

Comments

@Bdot42
Copy link

Bdot42 commented Jul 15, 2020

In my maven build the unpack extension is used to extract some packages like zulu or postgres, which contain read-only files (e.g. -r-xr-xr-x pgsql/lib/libssl.so.1.0.0). When re-building, I get the WARNING Unable to expand to file .../pgsql/lib/libssl.so.1.0.0 . (I created https://stackoverflow.com/questions/62836984/how-to-make-maven-unpack-overwrite-read-only-files for that)

I followed the code to the plexus archiver, where the extractFile method in AbstractUnArchiver.java is just overwriting the file without deleting it first if it exists.

Now, I'm not sure if it is a bug, an enhancement or even desired behavior, that read-only target files are not overwritten? The directory that contains it is writable, so deleting and creating a new file would work.

Would you consider something like adding ' if (f.exists()) { f.delete() } ' at around line 350? Or would that be undesired?

@plamentotev
Copy link
Member

From what I can gather tools like tar and unzip first delete the existing file when overriding files. I think first deleting the file should be ok for Plexus Archiver as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants