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

archive/zip: extra Extra fields when repacking zip file #61572

Open
rsc opened this issue Jul 25, 2023 · 4 comments
Open

archive/zip: extra Extra fields when repacking zip file #61572

rsc opened this issue Jul 25, 2023 · 4 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jul 25, 2023

If you use zip.(*Writer).CreateHeader (for example using a header from a zip file you are copying), CreateHeader encodes fh.Modified into fh.Extra even if fh.Extra already contains a modified time. You get an Extra with an extra extTimeExtraID entry. If there is already a extTimeExtraID entry in Extra, we shold not add an extra extTimeExtraID.

@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 25, 2023
@rsc rsc added this to the Go1.22 milestone Jul 25, 2023
AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jul 26, 2023
@gopherbot
Copy link

Change https://go.dev/cl/513437 mentions this issue: archive/zip: ignore modified time if extended timestamp extra field exists

@AlexanderYastrebov
Copy link
Contributor

If there is already a extTimeExtraID entry in Extra, we shold not add an extra extTimeExtraID.

Should it ignore fh.Modified or overwrite existing extra field?

@gopherbot
Copy link

Change https://go.dev/cl/513836 mentions this issue: archive/zip: update extended timestamp field if exists

AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jul 27, 2023
AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jul 28, 2023
@AlexanderYastrebov
Copy link
Contributor

Should it ignore fh.Modified or overwrite existing extra field?

I think it should update existing extended timestamp field otherwise there is no way to do it without digging into extra fields.
Created #61622 that implements this.

AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jul 28, 2023
@gopherbot gopherbot modified the milestones: Go1.22, Go1.23 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
3 participants