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

fix: use 'zipfile' module to extract fetches on Windows #73

Closed
wants to merge 1 commit into from

Conversation

ahal
Copy link
Collaborator

@ahal ahal commented Jul 11, 2022

Zipfiles generated natively on Windows use backslash path separators for
their internal path structure. The unzip utility in Linux is unable to
interpret this and creates files with \ in their name rather than
directories.

Even if a task is running on Windows, the unzip utility is bundled
with mozilla-build and runs in the shell there. So it is still unable
to extract the archive properly.

This patch switches to extracting with the zipfile stdlib rather than
the unzip utility when running from Windows.

Note that the bug can still exist if a task running on Linux attempts to
consume a zipfile created from a task on Windows.

Zipfiles generated natively on Windows use backslash path separators for
their internal path structure. The `unzip` utility in Linux is unable to
interpret this and creates files with `\` in their name rather than
directories.

Even if a task is running on Windows, the `unzip` utility is bundled
with `mozilla-build` and runs in the shell there. So it is still unable
to extract the archive properly.

This patch switches to extracting with the `zipfile` stdlib rather than
the `unzip` utility when running from Windows.

Note that the bug can still exist if a task running on Linux attempts to
consume a zipfile created from a task on Windows.
@ahal ahal self-assigned this Jul 11, 2022
@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #73 (9c2a9dc) into main (db1a72c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #73   +/-   ##
=======================================
  Coverage   55.47%   55.47%           
=======================================
  Files          59       59           
  Lines        4575     4575           
=======================================
  Hits         2538     2538           
  Misses       2037     2037           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db1a72c...9c2a9dc. Read the comment docs.

@ahal
Copy link
Collaborator Author

ahal commented Jul 11, 2022

Going to go with a different approach here.

@ahal ahal closed this Jul 29, 2022
@ahal
Copy link
Collaborator Author

ahal commented Jul 29, 2022

I found:
PowerShell/Microsoft.PowerShell.Archive#48

So this issue was actually fixed in PowerShell, but I guess the VPN workers have a very old version of it installed. For this reason, I don't think it's worth solving in Taskgraph. Instead I'll see extract: false in the VPN repo and the task will handle extraction itself.

@ahal ahal deleted the win_zipfile_fix branch August 10, 2022 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant