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

fix(install): Avoid error when unlinking non-existent junction/hardlink #5552

Merged
merged 4 commits into from
Oct 3, 2023

Conversation

HUMORCE
Copy link
Member

@HUMORCE HUMORCE commented Jun 20, 2023

Description

Motivation and Context

Closes #5511 #5473

How Has This Been Tested?

Before:

PS C:\Users\WDAGUtilityAccount> scoop install 7zip -u
Installing '7zip' (22.01) [64bit] from main bucket
Loading 7z2201-x64.msi from cache
Checking hash of 7z2201-x64.msi ... ok.
Extracting 7z2201-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\22.01
Creating shim for '7z'.
Creating shim for '7zFM'.
Creating shim for '7zG'.
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post_install script...
'7zip' (22.01) was installed successfully!
Notes
-----
Add 7-Zip as a context menu option by running:
"C:\Users\WDAGUtilityAccount\scoop\apps\7zip\current\install-context.reg"
PS C:\Users\WDAGUtilityAccount> # 'Codecs', 'Formats' Deleted.
PS C:\Users\WDAGUtilityAccount> scoop uninstall 7zip
Uninstalling '7zip' (22.01).
Removing shim '7z.shim'.
Removing shim '7z.exe'.
Removing shim '7zFM.shim'.
Removing shim '7zFM.exe'.
Removing shim '7zG.shim'.
Removing shim '7zG.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\7-Zip.lnk
Unlinking ~\scoop\apps\7zip\current
Get-Item : Cannot find path 'C:\Users\WDAGUtilityAccount\scoop\apps\7zip\22.01\Codecs' because it does not exist.
At C:\Users\WDAGUtilityAccount\scoop\apps\scoop\current\lib\install.ps1:1188 char:23
+             $source = Get-Item "$dir\$source"
+                       ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\WDAGUt...ip\22.01\Codecs:String) [Get-Item], ItemNotFoundExcep
   tion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

Get-Item : Cannot find path 'C:\Users\WDAGUtilityAccount\scoop\apps\7zip\22.01\Formats' because it does not exist.
At C:\Users\WDAGUtilityAccount\scoop\apps\scoop\current\lib\install.ps1:1188 char:23
+             $source = Get-Item "$dir\$source"
+                       ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\WDAGUt...p\22.01\Formats:String) [Get-Item], ItemNotFoundExcep
   tion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

'7zip' was uninstalled.

After:

PS C:\Users\WDAGUtilityAccount> scoop install 7zip -u
Installing '7zip' (22.01) [64bit] from main bucket
Loading 7z2201-x64.msi from cache
Checking hash of 7z2201-x64.msi ... ok.
Extracting 7z2201-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\22.01
Creating shim for '7z'.
Creating shim for '7zFM'.
Creating shim for '7zG'.
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post_install script...
'7zip' (22.01) was installed successfully!
Notes
-----
Add 7-Zip as a context menu option by running:
"C:\Users\WDAGUtilityAccount\scoop\apps\7zip\current\install-context.reg"
PS C:\Users\WDAGUtilityAccount> # 'Codecs', 'Formats' Deleted.
PS C:\Users\WDAGUtilityAccount> scoop uninstall 7zip
Uninstalling '7zip' (22.01).
Removing shim '7z.shim'.
Removing shim '7z.exe'.
Removing shim '7zFM.shim'.
Removing shim '7zFM.exe'.
Removing shim '7zG.shim'.
Removing shim '7zG.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\7-Zip.lnk
Unlinking ~\scoop\apps\7zip\current
'7zip' was uninstalled.

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

@rashil2000
Copy link
Member

Looks fine, update changelog?

@HUMORCE
Copy link
Member Author

HUMORCE commented Oct 3, 2023

Done

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
@rashil2000 rashil2000 merged commit 00c92b0 into ScoopInstaller:develop Oct 3, 2023
2 checks passed
CrendKing pushed a commit to CrendKing/Scoop that referenced this pull request Oct 3, 2023
…nk (ScoopInstaller#5552)

* fix(install): Avoid error when unlinking non-existent junction / hardlink

* CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>

---------

Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants