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

Packages without CancelCodes get 0 added as a CancelCode #87

Closed
jantari opened this issue Apr 25, 2023 · 0 comments
Closed

Packages without CancelCodes get 0 added as a CancelCode #87

jantari opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jantari
Copy link
Owner

jantari commented Apr 25, 2023

Version

1.5.4

Computer Model

20Q5

Problem

Affects all models.

Because an empty string when cast to [Int64] becomes 0:

❯ [Int64[]]''
0

all packages that don't have any CancelCodes defined in their XML end up with 0 as a CancelCode in LSUClient.

Bug is caused here:

LSUClient/LSUClient.psm1

Lines 217 to 219 in 1b19ff0

$this.SuccessCodes = $PackageXML.Install.GetAttribute('rc') -split ','
$this.FailureCodes = $PackageXML.Install.GetAttribute('rcfailure') -split ','
$this.CancelCodes = $PackageXML.Install.GetAttribute('rccancel') -split ','

and technically affects 'SuccessCodes' too but it wasn't noticed because basically all packages have SuccessCodes defined.

Additional context

This issue causes successful package installations to come back ass "Success: True" and at the same time "FailureReason: CANCELLED_BY_USER" due to:

$Success = $installProcess.Err -eq [ExternalProcessError]::NONE -and $(
if ($installProcess.Info -is [BiosUpdateInfo] -and $null -ne $installProcess.Info.SuccessOverrideValue) {
$installProcess.Info.SuccessOverrideValue
} else {
$installProcess.Info.ExitCode -in $PackageToProcess.Installer.SuccessCodes
}
)
$FailureReason = if ($installProcess.Err) {
"$($installProcess.Err)"
} elseif ($installProcess.Info.ExitCode -in $PackageToProcess.Installer.CancelCodes) {
'CANCELLED_BY_USER'
} elseif (-not $Success) {
'INSTALLER_EXITCODE'
} else {
''
}

Observed example:

ID             : n3xdy04w
Title          : Lenovo Intelligent Thermal Solution Driver - 10 (1607 or Later)/11 (21H2 or Later)
Type           : Driver
Success        : True
FailureReason  : CANCELLED_BY_USER
PendingAction  : REBOOT_SUGGESTED
ExitCode       : 0
StandardOutput :
StandardError  :
LogOutput      :
Runtime        : 00:00:02.7590412
@jantari jantari added the bug Something isn't working label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant