Skip to content

Fixing issue where archives created on windows have broken paths - #7751

Merged
mattfarina merged 1 commit into
helm:masterfrom
mattfarina:fix-7748
Mar 12, 2020
Merged

mattfarina merged 1 commit into
helm:masterfrom
mattfarina:fix-7748

Conversation

@mattfarina

@mattfarina mattfarina commented Mar 9, 2020 •

Copy link
Copy Markdown
Collaborator

When archives are created on windows the path spearator in the
archive file is \. This causes issues when the file is unpacked.
For example, on Linux the files are unpacked in a flat structure
and \ is part of the file name. This causes comp issues. In Helm
v2 the path was set as / when the archive was written. This works
on both Windows and POSIX systems.

The fix being implemented is to use the ToSlash function to ensure
/ is used as the separator.

Fixes #7748

@helm-bot helm-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 9, 2020
@mattfarina mattfarina added the bug Categorizes issue or PR as related to a bug. label Mar 9, 2020
@mattfarina mattfarina added this to the 3.1.2 milestone Mar 9, 2020
@meurig

meurig commented Mar 10, 2020

Copy link
Copy Markdown

I've tested this and I can confirm that it fixes #7748.

Thanks Matt!

@mattfarina

Copy link
Copy Markdown
Collaborator Author

@meurig Thanks for testing.

This reminds me that we should start using GitHub Actions to perform windows testing.

@bacongobbler

bacongobbler commented Mar 10, 2020 •

Copy link
Copy Markdown
Member

I recall us fixing this in Helm 2. Perhaps it was not ported over. I'm pretty sure this was how we fixed it. I'll see if I can pull up the PR

@bacongobbler

Copy link
Copy Markdown
Member

In Helm 2, we use filepath.ToSlash on line 215. In Helm 3, it looks like this is not reflected there on line 226.

To save the number of calls to filepath.ToSlash, would it be easier to place this under writeToTar? That would be forwards-compatible as well - any calling code provided in the future won't have to ensure they escape all filepath slashes in the tar header.

When archives are created on windows the path spearator in the
archive file is \\. This causes issues when the file is unpacked.
For example, on Linux the files are unpacked in a flat structure
and \ is part of the file name. This causes comp issues. In Helm
v2 the path was set as / when the archive was written. This works
on both Windows and POSIX systems.

The fix being implemented is to use the ToSlash function to ensure
/ is used as the separator.

Fixes helm#7748

Signed-off-by: Matt Farina <[email protected]>
@helm-bot helm-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 10, 2020
@mattfarina

Copy link
Copy Markdown
Collaborator Author

@bacongobbler Great catch. I should have noticed the pattern. Updated to the much simpler fix.

@bacongobbler bacongobbler added needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. and removed awaiting review labels Mar 10, 2020
@mattfarina
mattfarina merged commit 2dfb20f into helm:master Mar 12, 2020
@mattfarina
mattfarina deleted the fix-7748 branch March 12, 2020 14:20
@mattfarina mattfarina added the picked Indicates that a PR has been cherry-picked into the next release candidate. label Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Categorizes issue or PR as related to a bug. needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. picked Indicates that a PR has been cherry-picked into the next release candidate. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm v3 packaging charts differently on windows and linux (breaks artifactory)

4 participants