Skip to content

Fix path handling in archive.py to always be posix and not native paths - #1892

Merged
alexeagle merged 2 commits into
bazelbuild:masterfrom
luna-duclos:ld/archive.py-file-handling-posix
Jun 23, 2021
Merged

Fix path handling in archive.py to always be posix and not native paths#1892
alexeagle merged 2 commits into
bazelbuild:masterfrom
luna-duclos:ld/archive.py-file-handling-posix

Conversation

@luna-duclos

@luna-duclos luna-duclos commented Jun 15, 2021

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

No tests have been changed or added, but existing tests should validate the new behaviour still results in valid images

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

Currently, rules_docker when executed on windows will build a tar file with \ characters in the tar, this works fine when opened with tools like 7z, however, when extracting using a typical tar tool (or when docker does it), the files end up mangled with <filename>` all jumbled up together in their file name

This is because archive.py makes a lot of assumptions about posix paths using / characters, but then bundles this up with also using os.path instead of posixpath

What is the new behavior?

This fixes this problem by using posixpath in archive.py

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I realize windows support is spotty and partial at best, but this gets us going :)

@luna-duclos

luna-duclos commented Jun 15, 2021

Copy link
Copy Markdown
Contributor Author

Would love some help figuring out whats failing on the mac, os.path should have already been posixpath on that platform. so its confusing me

@luna-duclos

Copy link
Copy Markdown
Contributor Author

Aaand tests are green! Good to review :)

@gravypod gravypod left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Thanks for doing this!

@alexeagle
alexeagle merged commit d395626 into bazelbuild:master Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants