You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
strip_path function requires two parameters, the returned variable from env and $pcdir respectively. And it utilizes the second returned one, $currpath and makes use of it to configure paths.
Since the function is a deprecated function, it actually outputs a warning and then another function, Split-PathLikeEnvVar is called. In the past, it was Test-PathLikeEnvVar and required two string variables, $Name and '$Path'.
In the recent commit, The string type $Name parameter has been updated to the string array type $Pattern. But strip_path still provides the parameter with the old name.
So, Split-PathLikeEnvVar wants $Pattern, but it has $null value, then the error occurs.
Additional context/output
I discovered this issue at sdl2 manifest which contains the problematic functions stored at ScoopInstaller/Extras. Here's the output:
PS> scoop update sdl2
Uninstalling 'sdl2' (2.30.2)
Running uninstaller script...
WARN "env" will be deprecated. Please change your code/manifest to use "Get-EnvVar"-> :4:38
WARN "strip_path" will be deprecated. Please change your code/manifest to use "Split-PathLikeEnvVar"-> :4:26
InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85
Line |85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.WARN"env"willbedeprecated.Pleasechangeyourcode/manifesttouse"Get-EnvVar"-> :9:38WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :9:26InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :15:26InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :17:26InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.Unlinking ~\scoop\apps\sdl2\currentInstalling'sdl2' (2.30.3) [64bit] from'extras'bucketLoadingSDL2-devel-2.30.3-VC.zipfromcache.LoadingSDL2-2.30.3.zipfromcache.ExtractingSDL2-devel-2.30.3-VC.zip ...done.ExtractingSDL2-2.30.3.zip ...done.Runninginstallerscript...WARN"env"willbedeprecated.Pleasechangeyourcode/manifesttouse"Get-EnvVar"-> :33:32WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :33:20InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.WARN"env"willbedeprecated.Pleasechangeyourcode/manifesttouse"Set-EnvVar"-> :34:1WARN"env"willbedeprecated.Pleasechangeyourcode/manifesttouse"Get-EnvVar"-> :35:32WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :35:20InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.WARN"env"willbedeprecated.Pleasechangeyourcode/manifesttouse"Set-EnvVar"-> :36:1WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :38:31InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.WARN"strip_path"willbedeprecated.Pleasechangeyourcode/manifesttouse"Split-PathLikeEnvVar"-> :40:33InvalidOperation: C:\Users\[redacted]\scoop\apps\scoop\current\lib\system.ps1:85Line|85|$splitPattern=$Pattern.Split(';', [System.StringSplitOption …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Youcannotcallamethodonanull-valuedexpression.Linking ~\scoop\apps\sdl2\current=> ~\scoop\apps\sdl2\2.30.3'sdl2' (2.30.3) wasinstalledsuccessfully!
Possible Solution
This problem can be resolved with 2 ways. We should update strip_path function in lib/system.ps1 to provide the parameter with -Pattern. Also, Split-PathLikeEnvVar now receives the changed one as a string array, it would be better to include casting to array before invoking the function.
strip_path is a deprecated function, so manifests that uses it should be updated not to use that function.
System details
Windows version: Windows 10 22H2, and Windows 11 23H2 (Tested on both environments)
OS architecture: AMD64 (x64)
PowerShell version: [output of "$($PSVersionTable.PSVersion)"]
PS>$PSVersionTable
Name Value
---------
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
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
@william-lohan I checked that this issue is from installer script, which contains legacy functions including strip_path. This trouble is appeared after updating Scoop to v0.4.x recently, and we could solve this problem by replacing legacy functions in script with newer functions. I will make pull requests for those manifests regarding this issue to Scoop's repositories as soon as possible.
Bug Report
Current Behavior
One parameter was entered with a different name, so the following error occurs every time it is installed or uninstalled.
Since
$Pattern
is$null
, it occurs error.Expected Behavior
In sdl2 manifest,
strip_path
function has been invoked several times. For example, in the manifest's installer script:strip_path
function requires two parameters, the returned variable fromenv
and$pcdir
respectively. And it utilizes the second returned one,$currpath
and makes use of it to configure paths.Since the function is a deprecated function, it actually outputs a warning and then another function,
Split-PathLikeEnvVar
is called. In the past, it wasTest-PathLikeEnvVar
and required two string variables,$Name
and '$Path'.In the recent commit, The string type
$Name
parameter has been updated to the string array type$Pattern
. Butstrip_path
still provides the parameter with the old name.So,
Split-PathLikeEnvVar
wants$Pattern
, but it has$null
value, then the error occurs.Additional context/output
I discovered this issue at sdl2 manifest which contains the problematic functions stored at ScoopInstaller/Extras. Here's the output:
Possible Solution
This problem can be resolved with 2 ways. We should update
strip_path
function inlib/system.ps1
to provide the parameter with-Pattern
. Also,Split-PathLikeEnvVar
now receives the changed one as a string array, it would be better to include casting to array before invoking the function.strip_path is a deprecated function, so manifests that uses it should be updated not to use that function.
System details
Windows version: Windows 10 22H2, and Windows 11 23H2 (Tested on both environments)
OS architecture: AMD64 (x64)
PowerShell version: [output of
"$($PSVersionTable.PSVersion)"
]Additional software:
None
Scoop Configuration
The text was updated successfully, but these errors were encountered: