Skip to content

[Bug]: extract_dir seems dependent on PS character encoding #13221

@ifeelagood

Description

@ifeelagood

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues/PRs to ensure it has not already been reported or fixed.
  • I have verified that I am using the latest version of Scoop and corresponding bucket.

Package Name

extras/openrgb

Expected/Current Behaviour

When installing the manifest for openrgb in Powershell 5.1, core.ps1 claims not to find the extract_dir "OpenRGB Windows 64-bit" even though it is infact the correct string. Installing using Powershell 7 using a different character encoding works just fine.

Steps to Reproduce

PS> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  4291

PS> [System.Text.Encoding]::Default
IsSingleByte      : True
BodyName          : iso-8859-1
EncodingName      : Western European (Windows)
HeaderName        : Windows-1252
WebName           : Windows-1252
WindowsCodePage   : 1252
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
EncoderFallback   : System.Text.InternalEncoderBestFitFallback
DecoderFallback   : System.Text.InternalDecoderBestFitFallback
IsReadOnly        : True
CodePage          : 1252



PS> scoop install openrgb
Installing 'openrgb' (0.9) [64bit] from 'extras' bucket
Loading OpenRGB_0.9_Windows_64_b5f46e3.zip from cache
Checking hash of OpenRGB_0.9_Windows_64_b5f46e3.zip ... ok.
Extracting OpenRGB_0.9_Windows_64_b5f46e3.zip ... Could not find 'OpenRGB Windows 64-bit'! (error 16)
At C:\scoop\apps\scoop\current\lib\core.ps1:860 char:9
+         throw "Could not find '$(fname $from)'! (error $($proc.ExitCo ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find ...it'! (error 16):String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find 'OpenRGB Windows 64-bit'! (error 16)

-----------
PS> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      4      1

PS> [System.Text.Encoding]::Default

Preamble          :
BodyName          : utf-8
EncodingName      : Unicode (UTF-8)
HeaderName        : utf-8
WebName           : utf-8
WindowsCodePage   : 1200
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
IsSingleByte      : False
EncoderFallback   : System.Text.EncoderReplacementFallback
DecoderFallback   : System.Text.DecoderReplacementFallback
IsReadOnly        : True
CodePage          : 65001

PS> scoop install openrgb
Installing 'openrgb' (0.9) [64bit] from 'extras' bucket
Loading OpenRGB_0.9_Windows_64_b5f46e3.zip from cache
Checking hash of OpenRGB_0.9_Windows_64_b5f46e3.zip ... ok.
Extracting OpenRGB_0.9_Windows_64_b5f46e3.zip ... done.
Linking C:\scoop\apps\openrgb\current => C:\scoop\apps\openrgb\0.9
Creating shortcut for OpenRGB (OpenRGB.exe)
'openrgb' (0.9) was installed successfully!
'openrgb' suggests installing 'extras/vcredist2022'.

Possible Solution

  1. Do not allow scoop to run on certain character encoding/version (terrible solution)
  2. Account for encodings in core.ps1 by either a) converting to UTF-8 or b) changing extraction utility (I have not read the code for scoop and cannot comment)

Scoop and Buckets Version

PS> scoop --version
Current Scoop version:
d285bb08 (HEAD -> master, tag: v0.4.1, origin/master, origin/HEAD) chore(release): Bump to version 0.4.1 (#5924)

'extras' bucket:
4e0ff2774 (HEAD -> master, origin/master, origin/HEAD) supermium: Update to version 122.0.6261.152

Scoop Config

PS> scoop config
last_update           : 2024-05-03T11:02:34.6707081+10:00
root_path             : C:\scoop
aria2-warning-enabled : False
aria2-enabled         : False
scoop_branch          : master
scoop_repo            : https://github.com/ScoopInstaller/Scoop

PowerShell Version

(likely to do with [System.Text.Encoding]::Default !!!)
Failing Version:

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.4291
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4291
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Working Version: 
PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional Softwares

Powershell 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions