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

Re-apply PR #2271 & Fix For Loop in 'Install-WinUtilProgramWinget' Private Function #2396

Conversation

og-mrk
Copy link
Contributor

@og-mrk og-mrk commented Jul 17, 2024

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Hotfix
  • Security patch
  • UI/UX improvement

Description

PR #2271 had a major flaw of installing some un-wanted apps from MS Store (as described in issue #2385), It was temporarily solved by reverting its changes in commit c903631.

This PR tries to solve the underlying logical error that PR #2271 had, which was trying to access out-of-bound memory (a common off-by-one error), where PowerShell would return $null (meaning the item this function has requested from $ProgramsToInstall Object Array is an empty item), which will make the Program ID (the input) an invalid value, causing un-expected behaviors from WinGet (The Package Manager), like installing the newest released app from MS Store.

Testing

After further testing (tried it with all sort of combinations, one app, multiple applications, some are installed already, some had to upgrade, etc...), the updated code is working as expected.

Impact

At the end.. it won't be noticeable by the end user, as the only thing this PR (and #2271 PR) tried to solve is the terminal progress bar (it was broken in original ForEach loop, off by one in #2271 PR, and in this PR it's working as expected).

So generally speaking.. User won't really notice this issue (The progress bar being off or broken), but it would be nice to fix this if possible.

Issue related to PR

Additional Information

If you've the time to spare, please consider testing these changes, thanks in advance 😄

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

og-mrk added 2 commits July 17, 2024 23:27
…e' (Less or Equal) to '-lt' (Less Than) in For Loop of 'Install-WinUtilProgramWinget' Private Function
@og-mrk og-mrk requested a review from ChrisTitusTech as a code owner July 17, 2024 21:00
@ChrisTitusTech ChrisTitusTech merged commit fcc48a2 into ChrisTitusTech:main Jul 25, 2024
@og-mrk og-mrk deleted the fix-forloop-in-install-winutilprogramwinget-function branch July 26, 2024 05:48
@ChrisTitusTech ChrisTitusTech added the skip-changelog Skip Change Logs label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Skip Change Logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

winutil(?) installs an unwanted app from ms store
2 participants