Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

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

Merged

Conversation

luna-duclos
Copy link
Contributor

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

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
Copy link
Contributor Author

luna-duclos commented Jun 15, 2021

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
Contributor Author

Aaand tests are green! Good to review :)

Copy link
Collaborator

@gravypod gravypod left a comment

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants