Skip to content

fix extractTar on Windows#264

Merged
ericsciple merged 11 commits intomasterfrom
users/ericsciple/m163tar
Dec 19, 2019
Merged

fix extractTar on Windows#264
ericsciple merged 11 commits intomasterfrom
users/ericsciple/m163tar

Conversation

@ericsciple
Copy link
Copy Markdown
Contributor

@ericsciple ericsciple commented Dec 17, 2019

Fixes extractTar on Windows by formatting the arguments different depending on whether BSD tar or GNU tar is being called.

@@ -268,96 +268,88 @@ describe('@actions/tool-cache', function() {
await io.rmRF(tempDir)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i had to recreate test.tar.gz with the option --format pax otherwise bsdtar doesnt preserve UTF file names correctly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i added a README.txt to the archive for future reference

This reverts commit 4b8b9fd.
This reverts commit 46de6c6.
}

await io.mkdirP(tempDir)
it('extract .tar.gz', async () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no changes here, just eliminated the else condition and de-indented

let destArg = dest
if (IS_WINDOWS && isGnuTar) {
args.push('--force-local')
destArg = dest.replace(/\\/g, '/')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both destArg and file need the \ replacement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can add for file too, but when i tested file doesnt appear to be required

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'll push this change, aesthetically it will look good for consistency

@bryanmacfarlane
Copy link
Copy Markdown
Member

Add a description for the PR ☝️

@bryanmacfarlane
Copy link
Copy Markdown
Member

Other than description, LGTM

stderr: (data: Buffer) => (versionOutput += data.toString())
}
})
const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR')
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.

Consider debugging this so we can troubleshoot easier if for some reason this breaks. (Analyzing text output of a cli can be a little fragile)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the output flows to the console too, so we're good wrt that aspect

Copy link
Copy Markdown
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

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

LGTM minor thoughts

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.

4 participants