Only write cross platform compatible directory separators in Compress-Archive#62
Only write cross platform compatible directory separators in Compress-Archive#62anmenaga merged 5 commits intoPowerShell:masterfrom mryanmurphy:master
Conversation
|
Not sure who the maintainers of the repo are, so this has been waiting for quite some time. As top contributor @anmenaga, is there anything I can do to get some visibility? |
|
@mryanmurphy we appreciate your contribution. Sorry about the delay. @anmenaga can you review this? |
There was a problem hiding this comment.
Overall looks good; can merge after some minor updates:
- Please bump
ModuleVersionfrom1.2.2.0to1.2.3.0inMicrosoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 - Please add to the end of the description that archive expansion on Windows is doing the opposite conversion from forward slashes to backslashes in
Expand-Archive/ExpandArchiveHelper/Join-Path. - Entire PR description should be added as a comment to
DirectorySeparatorNormalizeHelper. This will greatly help with reading the code. - It would be good to rebase this PR based on the latest code in the repo.
Thank you.
|
Thanks for the feedback all, I believe I addressed each point. |
|
@anmenaga @SteveL-MSFT Let me know if there's anything else I can do to get this merged. Thanks! |
|
Is there a workaround for the separator issue until version 1.2.3 is generally available? |
|
This should fix files that have been extracted with backslashes in the meantime: for file in *\\*; do target="${file//\\//}"; mkdir -p "${target%/*}"; mv -v "$file" "$target"; done |
|
I'm not sure how often they push changes to PSGallery. Since opening the PR I've had the fixed module on my machines with a Besides that I think the only workaround would be to not use this module for cross platform archiving. |
|
I since discovered that https://blogs.technet.microsoft.com/virtualization/2017/12/19/tar-and-curl-come-to-windows/ That works better for what I'm trying to do, which is extract archives on linux machines. |
|
Is If so there seems to be more issues with directory separators: |
|
Hrm it seems 6.2 still ships with the broken And I can't update it: How can we get our hands on the fix? |
|
@SteveL-MSFT is there a process to get version 1.2.3.0 deployed to PS Gallery? |
|
@anmenaga is working on publishing new version of Archive module to PSGallery. Unfortunately, we missed this and didn't get it into 6.2. Perhaps we can pick it up for a future 6.2.x servicing release. |
|
Looks like it got into 6.2.1 today from PowerShell/PowerShell#9594, and updated in PSGallery last week https://www.powershellgallery.com/packages/Microsoft.PowerShell.Archive/1.2.3.0 Thanks. |
This resolves #11 and #48
The approach taken is leveraging the fact that .net on Windows all the way back to Framework 1.1 specifies
\as DirectoryPathSeparatorChar and/as AltDirectoryPathSeparatorChar, while other platforms in .net Core use/for DirectoryPathSeparatorChar and AltDirectoryPathSeparatorChar.When using a *nix platform, the replacements will be no-ops, while Windows will convert all
\to/for the purposes of the ZipEntry FullName.