Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite files when calling unzip from the tool-cache package #418

Closed

Conversation

svartalf
Copy link

While Windows implementation is executed in the non-interactive mode, unzip can prompt user in a many different situations, one of them if any of the extracted files already exists in the destination path,
see @actions-rs/tool-cache#5 as a bug example.

This patch adds -o flag to the unzip invocation, allowing non-interactive file overwrites as it stated in the unzip help:

unzip modifiers:
  -o   Overwrite existing files without prompting.  Useful with -f.  Use with
         care.

Without it `unzip` shows prompt if any of extracted files already exists in the destination path
@svartalf
Copy link
Author

Failed unittest seems to unrelated to the change:


FAIL packages/github/__tests__/github.test.ts (7.405s)
  @actions/github
    √ basic REST client (235ms)
    √ basic REST client with custom auth (328ms)
    √ basic REST client with proxy (236ms)
    √ basic GraphQL client (218ms)
    × basic GraphQL client with custom auth (5011ms)
    √ basic GraphQL client with proxy (188ms)

  ● @actions/github › basic GraphQL client with custom auth

    thrown: "Exceeded timeout of 5000ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      117 |   })
      118 | 
    > 119 |   it('basic GraphQL client with custom auth', async () => {
          |   ^
      120 |     const token = getToken()
      121 |     if (!token) {
      122 |       return

      at packages/github/__tests__/github.test.ts:119:3

@Veetaha
Copy link

Veetaha commented Apr 27, 2020

@jclem could you please take a look at this? This bug is currently a big blocker for us... I would appreciate if you get this merged

@thboop
Copy link
Collaborator

thboop commented Apr 28, 2020

Ideally, we should have the same behavior across all OS's. Windows does not currently overwrite files.

However, for a CI system I think there's value in doing this by default. @bryanmacfarlane, what do you think?

If we decide to do so, we should make the same change in windows. This would require having to swap to the Expand-Archive function with -force, which requires >= powershell 5). There might be other subtle changes in behavior we would have to investigate.

EDIT: If we are doing this for zip files, we should doing it for extractTar and extract7z as well.

@Veetaha
Copy link

Veetaha commented Jul 31, 2020

I don't think this is reasonable to let perfect be the enemy of good. Having this PR floating unmerged doesn't help, I'd suggest having a fix for what currently already seems ridiculous (falling into interactive mode on CI).
cc @thboop, @bryanmacfarlane

@thboop
Copy link
Collaborator

thboop commented May 19, 2021

Closing in favor of https://github.com/actions/toolkit/pull/807/files

@thboop thboop closed this May 19, 2021
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.

3 participants