Skip to content

Bugfix: Fix issue with interactive unzip on Linux - #807

Merged
luketomlinson merged 16 commits into
mainfrom
bugfix/interactive-unzip
May 21, 2021
Merged

luketomlinson merged 16 commits into
mainfrom
bugfix/interactive-unzip

Conversation

@luketomlinson

@luketomlinson luketomlinson commented May 12, 2021 •

Copy link
Copy Markdown
Contributor

Resolves #456

Fixes issue where unzip would freeze when asking for interactive input.

This unifies the behavior across platforms to overwrite files instead of failing (windows, previously) or asking for user input (macOS and linux previously).

Comment thread packages/tool-cache/src/tool-cache.ts
Comment thread packages/tool-cache/src/tool-cache.ts Outdated
@luketomlinson luketomlinson changed the title Change unzip overwrite Bugfix: Fix issue with interactive unzip on Linux May 14, 2021
@luketomlinson
luketomlinson force-pushed the bugfix/interactive-unzip branch from 70491f6 to b31bbe5 Compare May 14, 2021 18:17
@luketomlinson
luketomlinson marked this pull request as ready for review May 18, 2021 13:35
@luketomlinson
luketomlinson requested a review from a team as a code owner May 18, 2021 13:35
Comment thread packages/tool-cache/src/tool-cache.ts
Comment thread packages/tool-cache/src/tool-cache.ts Outdated
Comment thread packages/tool-cache/src/tool-cache.ts Outdated
Comment thread packages/tool-cache/src/tool-cache.ts
@luketomlinson
luketomlinson merged commit a1b068e into main May 21, 2021
@luketomlinson
luketomlinson deleted the bugfix/interactive-unzip branch May 21, 2021 21:01
@StevenACoffman

StevenACoffman commented Feb 27, 2022 •

Copy link
Copy Markdown

Hi. This doesn't appear to be fully resolved.

As I can see the extractTar function is imported from internal package: https://github.com/actions/toolkit/blob/main/packages/cache/src/cache.ts#L5 and the internal implementation does not contain --overwrite flag:

export async function extractTar(
archivePath: string,
compressionMethod: CompressionMethod
): Promise<void> {
// Create directory to extract tar into
const workingDirectory = getWorkingDirectory()
await io.mkdirP(workingDirectory)
// --d: Decompress.
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
// Using 30 here because we also support 32-bit self-hosted runners.
function getCompressionProgram(): string[] {
switch (compressionMethod) {
case CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -d --long=30']
case CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -d']
default:
return ['-z']
}
}
const args = [
...getCompressionProgram(),
'-xf',
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
'-P',
'-C',
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
await execTar(args, compressionMethod)
}

so there is no way to fix the issue within this action, while GitHub Action uses tar without --overwrite flag.

@lawyoum lawyoum left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fix it

Derrick-MUGISHA pushed a commit to Derrick-MUGISHA/toolkit that referenced this pull request Oct 12, 2026
* Add new powershell commands for windows unzip

* Test fails to overwrite file

* Add new windows commands for unzip

* Add Test for failing case for both pwsh and powershell

* Modify test to confirm overwrite behavior for xar

* Delete ._test.txt

* Add fallback case for older windows systems

* Remove try

* Run Tests on windows-2016

* Update tar tests to handle existing files

* Lint

* Update tool-cache.test.ts

* Update tool-cache.test.ts

* Update tool-cache.test.ts

* Update tool-cache.test.ts

* Update from PR feedback
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.

Unziping tools from cache on linux freezes the entire workflow in interactive mode waiting for user input

4 participants