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

[Bug] Explicitly use Powershell's default Expand-Archive #5183

Closed
hongxuchen opened this issue Oct 13, 2022 · 3 comments · Fixed by #5247
Closed

[Bug] Explicitly use Powershell's default Expand-Archive #5183

hongxuchen opened this issue Oct 13, 2022 · 3 comments · Fixed by #5247
Labels

Comments

@hongxuchen
Copy link

hongxuchen commented Oct 13, 2022

Bug Report

Current Behavior

https://github.com/ScoopInstaller/Scoop/blob/master/lib/decompress.ps1#L243

is using a Expand-Archive which defaults to Microsoft Powershell's. However some people use Pscx which also has the function. And when Pscx's function overrides the default one, it will report the following error when using scoop install go (or many other packages).

go1.19.2.windows-amd64.zip (155.8 MB) [=============================================================================================================================================================================================] 100%
Checking hash of go1.19.2.windows-amd64.zip ... ok.
Extracting go1.19.2.windows-amd64.zip ... Expand-Archive: D:\scoop\apps\scoop\current\lib\decompress.ps1:243
Line |
 243 |      Expand-Archive -Path $Path -DestinationPath $DestinationPath -For …
     |                                 ~~~~~~~~~~~~~~~~
     | A parameter cannot be found that matches parameter name 'DestinationPath'.

Exception: D:\scoop\apps\scoop\current\lib\core.ps1:642
Line |
 642 |          throw "Could not find '$(fname $from)'! (error $($proc.ExitCo
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not find 'go'! (error 16)

Expected Behavior

decompression and installation succeed.

Additional context/output

Possible Solution

Explicitly use the default one by replacing the current line with

Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force

System details

Windows version: [e.g. 7, 8, 10, 11]
10

OS architecture: [e.g. 32bit, 64bit, arm64]
64bit

PowerShell version: [output of "$($PSVersionTable.PSVersion)"]
7.2.6

Additional software: [(optional) e.g. ConEmu, Git]

https://github.com/Pscx/Pscx

Scoop Configuration

{
  "lastupdate": "2022-10-13T18:24:55.5981183+08:00",
  "SCOOP_REPO": "https://github.com/lukesampson/scoop",
  "SCOOP_BRANCH": "master",
  "aria2-warning-enabled": false,
  "aria2-max-connection-per-server": 8,
  "aria2-split": 8,
  "rootPath": "D:\\scoop"
}
@hongxuchen hongxuchen added the bug label Oct 13, 2022
@niheaven
Copy link
Member

What version of Pscx do you use? It has changed Expand-Archive() to Expand-PscxArchive() since 4.0.0-beta1, and is released since October 17, 2020.

@hongxuchen
Copy link
Author

hongxuchen commented Oct 13, 2022

gcm Expand-Archive tells me that I'm using 3.3.2. I indeed have 4.0.0-beta4 installed however (Get-InstalledModule actually only shows 4.0.0-beta4).

@hongxuchen
Copy link
Author

confirmed that using install-module pscx defaults to 3.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants