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

#799: fix zip extraction to preserve file attributes #835

Merged
merged 14 commits into from
Dec 9, 2024

Conversation

hohwille
Copy link
Member

@hohwille hohwille commented Dec 3, 2024

fixes #799

I first messed around with ZipEntry.getExtra() see this thread but had to give up.

Then I started from scratch and found this promising issue and this promising page.

Massive simplification of our code whilst also fixing all preservation of file permissions (not only executable flags but all attributes).

@hohwille hohwille added this to the release:2024.12.001 milestone Dec 3, 2024
@hohwille hohwille self-assigned this Dec 3, 2024
@hohwille hohwille added unpack logic to unpack archives (tar, zip, tgz, zbz2, msi, dmg, etc.) linux specific for linux OS (debian, ubunutu, suse, etc.) macOS specific for Apple MacOS labels Dec 3, 2024
@hohwille
Copy link
Member Author

hohwille commented Dec 5, 2024

Tested on Linux:

Trying to download terraform-1.10.1-linux-x64.zip from https://releases.hashicorp.com/terraform/1.10.1/terraform_1.10.1_linux_amd64.zip
Downloading 100% │████████████████████████│ 26/26MiB (0:00:00 / 0:00:00) ?MiB/s

And

hohwille@CE49454:~/projects/IDEasy/software/terraform$ ls -lah ~/Downloads/ide/default/terraform-1.10.1-linux-x64.zip
-rw-r--r-- 1 hohwille hohwille 27M Dec  5 23:32 /home/hohwille/Downloads/ide/default/terraform-1.10.1-linux-x64.zip

That looks sane even though 26 vs. 27 but I assume this is MB (1024^2) vs. MiB (1000^2).

But currently I cannot know the extracted size but also I now do not have a clue about uncompressed file sizes during unpacking.
Therefore the progressbar for unpacking is kind of confusing/wrong:

Checksum d49d4d08ed092a8dec335f1fe3e127d1a285f160557323dd5a84ddc0c8472e1a is correct.
Unpacking 100% │██████████████████████████│ 34/34MiB (0:00:00 / 0:00:00) ?MiB/s
Successfully installed terraform in version 1.10.1

And

hohwille@CE49454:~/projects/IDEasy/software/terraform$ ls -lah
total 87M
drwxr-xr-x 2 hohwille hohwille 4.0K Dec  5 23:32 .
drwxr-xr-x 3 hohwille hohwille 4.0K Dec  5 23:32 ..
-rw-r--r-- 1 hohwille hohwille    6 Dec  5 23:32 .ide.software.version
-rw-r--r-- 1 hohwille hohwille 4.9K Dec  5 23:32 LICENSE.txt
-rwxr-xr-x 1 hohwille hohwille  87M Dec  5 23:32 terraform

We can test if we can first summarize the sizes but we would need to traverse the virtual JAR/ZIP filesystem twice then.
This could lead to performance issues.
I will do a test with a large archive to measure the effect.
If Java VFS will do an efficient caching, that should be fine and we could then provide an accurate progress bar.

hohwille and others added 2 commits December 6, 2024 12:47
refactoring of progressbar and changing expected result of IJ and AStudio plugin
@hohwille
Copy link
Member Author

hohwille commented Dec 6, 2024

Progressbar entirely refactored and now correct for extract ZIP/JAR. Overhead when unpacking intellij ZIP (largest example we have) was < 1 second (increased from 22 sec to ~23 sec).

Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Co-Reviewed by: @WorkingAmeise Looks good to us apart from some questions. Approving for faster merge, but please check comments.

@hohwille hohwille merged commit afcaffc into devonfw:main Dec 9, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux specific for linux OS (debian, ubunutu, suse, etc.) macOS specific for Apple MacOS unpack logic to unpack archives (tar, zip, tgz, zbz2, msi, dmg, etc.)
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

binaries from zip download lack executable flags
2 participants