ScoopInstaller / Extras

📦 The Extras bucket for Scoop.
https://scoop.sh
The Unlicense
1.79k stars 1.34k forks source link

[Bug]: spotify package is not idempotent and shows an error message during the upgrade #10841

Closed maephisto666 closed 1 month ago

maephisto666 commented 1 year ago

Prerequisites

Package Name

spotify

Expected/Current Behaviour

The first time the installation runs, a Update file is created within the $env:LOCALAPPDATA\Spotify. The file is given Read-Only and System attributes. This is a way to "block" the auto-updater.

Every next attempt to upgrade the package via scoop will end well BUT an error message will be shown

Updating 'spotify' (1.2.5.1006.g22820f93 -> 1.2.7.1277.g2b3ce637)
Downloading new version
SpotifyFullSetup.exe (83,5 MB) [==============================================================================] 100%
Checking hash of SpotifyFullSetup.exe ... ok.
Uninstalling 'spotify' (1.2.5.1006.g22820f93)
Running uninstaller script...
Unlinking D:\Portable\Scoop\apps\spotify\current
Installing 'spotify' (1.2.7.1277.g2b3ce637) [64bit] from extras bucket
Loading SpotifyFullSetup.exe from cache
Running installer script...
New-Item:
Line |
   4 |  … pdateFile = New-Item -Path "$env:LOCALAPPDATA\Spotify" -Name Update - …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Access to the path 'C:\Users\username\AppData\Local\Spotify\Update' is denied.
InvalidOperation:
Line |
   5 |  $updatefile.Attributes = 'ReadOnly', 'System'
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'Attributes' cannot be found on this object. Verify that the property exists and can be set.
Linking D:\Portable\Scoop\apps\spotify\current => D:\Portable\Scoop\apps\spotify\1.2.7.1277.g2b3ce637
Creating shortcut for Spotify (Spotify.exe)
'spotify' (1.2.7.1277.g2b3ce637) was installed successfully!

The problem is that if we look at the spotify.json we see

  1. First an attempt to remove the Update file
  2. Second the creation of the file and the setting of the attributes

This behaviour tries to make the package idempotent, but the deletion goes wrong (without showing any output, because the file was read-only and system)

Steps to Reproduce

`scoop install spotify` (with an old version of the `spotify` package)
`scoop upgrade spotify`

Possible Solution

Add -Force to the deletion step. This will make the deletion always successful and the next creation as well.

Scoop and Buckets Version

Current Scoop version:
v0.3.1 - Released at 2022-11-15

'extras' bucket:
f4c6823b0 (HEAD -> master, origin/master, origin/HEAD) reicon@2.0: Fix hash (Closes #10840)

'games' bucket:
f8c02aa4 (HEAD -> master, origin/master, origin/HEAD) yuzu-pineapple: Update to version EA-3473

'java' bucket:
b73d46df (HEAD -> master, origin/master, origin/HEAD) temurin11-nightly-jre: Update to version 11.0.19-6.0.202303231817

'main' bucket:
90919aa26 (HEAD -> master, origin/master, origin/HEAD) nixpacks: Update to version 1.6.0

'Scoop-Apps' bucket:
f0cfc5df (HEAD -> master, origin/master, origin/HEAD) Jacket-Portable: Update to version 0.20.3681

'versions' bucket:
522b621c9 (HEAD -> master, origin/master, origin/HEAD) neovim-nightly@0.9.0-dev-1265-g410dc3349: Fix hash (Closes #1115)

Scoop Config

aria2-enabled : False
use_lessmsi   : True
last_update   : 25/03/2023 09:16:19
scoop_branch  : master
scoop_repo    : https://github.com/lukesampson/scoop

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.3.3
PSEdition                      Core
GitCommitId                    7.3.3
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

Additional Softwares

No response

maephisto666 commented 1 year ago

If anyone confirms my analysis, I can make a PR.

HUMORCE commented 1 year ago

If anyone confirms my analysis, I can make a PR.

You are right.

webframp commented 1 month ago

Still seeing this:

Running installer script...New-Item:
Line |
   4 |  … pdateFile = New-Item -Path "$env:LOCALAPPDATA\Spotify" -Name Update - …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Access to the path 'C:\Users\sme\AppData\Local\Spotify\Update' is denied.
InvalidOperation:
Line |
   5 |  $updatefile.Attributes = 'ReadOnly', 'System'
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'Attributes' cannot be found on this object. Verify that the property exists and can be set.

Versions:

❯ scoop -v
Current Scoop version:
859d1db5 (HEAD -> master, tag: v0.5.2, origin/master, origin/HEAD) chore(release): Bump to version 0.5.2 (#6080)

'main' bucket:
fba36500d (HEAD -> master, origin/master, origin/HEAD) wasmtime: Update to version 24.0.0

'extras' bucket:
69cd30549 (HEAD -> master, origin/master, origin/HEAD) zrok: Update to version 0.4.39

'versions' bucket:
33af04bce (HEAD -> master, origin/master, origin/HEAD) phpstorm-rc: Update to version 2024.2.1-242.21829.34

'java' bucket:
84b7bb31 (HEAD -> master, origin/master, origin/HEAD) temurin11-nightly-jre: Update to version 11.0.25-3.0.ea

'scoop-nerd-fonts' bucket:
b17bbac (HEAD -> master, origin/master, origin/HEAD) SarasaGothic: Update to version 1.0.19