-
-
Notifications
You must be signed in to change notification settings - Fork 7
fix(updater): Pass OriginalTag to post-update script on second run #133
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
Changes from all commits
581daab
e6b456f
7536879
17487e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ param( | |
| [string] $GhTitlePattern = '', | ||
| # Specific version - if passed, no discovery is performed and the version is set directly | ||
| [string] $Tag = '', | ||
| # Version that the dependency was on before the update - should be only passed if $Tag is set. Necessary for PostUpdateScript. | ||
| [string] $OriginalTag = '', | ||
| # Optional post-update script to run after successful dependency update | ||
| # The script receives the original and new version as arguments | ||
| [string] $PostUpdateScript = '' | ||
|
|
@@ -134,6 +136,8 @@ if (-not $isSubmodule) { | |
| } | ||
|
|
||
| if ("$Tag" -eq '') { | ||
| $OriginalTag | Should -Be '' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The script uses Pester's Suggested FixReplace the Pester Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
| if ($isSubmodule) { | ||
| git submodule update --init --no-fetch --single-branch $Path | ||
| Push-Location $Path | ||
|
|
@@ -250,11 +254,10 @@ if ("$Tag" -eq '') { | |
| } | ||
|
|
||
| $Tag = $latestTag | ||
| } else { | ||
| $OriginalTag | Should -Not -Be '' | ||
| } | ||
|
|
||
| $originalTagForPostUpdate = if ($originalTag) { $originalTag } else { '' } | ||
| $newTagForPostUpdate = $Tag | ||
|
|
||
| if ($isSubmodule) { | ||
| Write-Host "Updating submodule $Path to $Tag" | ||
| Push-Location $Path | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: The script uses lowercase variables
$tagand$originalTag, but the parameters are defined as$Tagand$OriginalTag, leading to incorrect behavior.Description: In the execution path where
TagandOriginalTagare explicitly provided, the script attempts to use lowercase variables$tagand$originalTag. However, these variables are not defined in this scope; the correct, case-sensitive parameters are$Tagand$OriginalTag. Because PowerShell treats undefined variables as empty strings, the call toDependencyConfig 'set-version' $tagwill incorrectly update the dependency file with an empty version. Additionally, the post-update script will be called with empty parameters, causing the dependency update process to fail or produce incorrect results. This bug occurs specifically in the new scenario introduced by the code change.Suggested fix: Correct the variable names used in the core functionality to match the case of the defined parameters. Change
$tagto$Tagand$originalTagto$OriginalTagwhere they are used to callDependencyConfigand the post-update script.severity: 0.85, confidence: 0.98
Did we get this right? 👍 / 👎 to inform future reviews.