Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

[Bug] `scoop uninstall package` followed by `scoop uninstall -p package`

Open Aldo-f opened this issue 1 year ago • 5 comments

Bug Report

Current Behavior

When uninstalling a package without the -p flag i can't remove the persistence data afterward ('bc the package is uninstalled)

Expected Behavior

Doing the same command, but this time with -p, i would like it to remove the persistent data folder

Additional context/output


C:\Users\Aldo
λ scoop uninstall chromium
Uninstalling 'chromium' (116.0.5845.141-r1160321).
Removing shim 'chromium.shim'.
Removing shim 'chromium.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\Chromium.lnk
Unlinking ~\scoop\apps\chromium\current
'chromium' was uninstalled.

C:\Users\Aldo
λ scoop uninstall -p chromium
ERROR 'chromium' isn't installed.

Possible Solution

Also check if the persistent-directory exists after uninstall, and just remove it by the package-name.

System details

Windows version: 11

OS architecture: 64bit

Additional software: Cmder

Scoop Configuration


{
    "last_update":  "2023-09-03T12:09:24.6725171+02:00",
    "scoop_branch":  "master",
    "scoop_repo":  "https://github.com/ScoopInstaller/Scoop"
}


Aldo-f avatar Sep 03 '23 10:09 Aldo-f

Hmm, I think this should be solved by introducing a -p flag in the scoop cleanup command, where it will check and delete the persist directory for that application, regardless of its installation state.

Would you like to work on it?

rashil2000 avatar Sep 10 '23 18:09 rashil2000

Have never edited a .ps1 file, but will try to make a -p in the scoop-cleanup.ps1 based on what is already written in scoop-uninstall.ps1

But don't have your hopes up for clean code and tests...

All I can promise is that I will have a look at this, probably, small issue. And if I can't manage it I'll let it know.

Aldo-f avatar Sep 10 '23 19:09 Aldo-f

-p flag in scoop cleanup command, where it will check and delete the persist directory for that application, regardless of its installation state.

Delete a persist directory of installed application might break/damage the working state of the application. e.g. pip (package installer) for python.

In my mind, cleanup is a safe operation that you don't need to think too much about the consequences. I agree with @Aldo-f that it should work thru uninstall which it is a "destructive" operation in many context.

hagaigold avatar Oct 10 '23 00:10 hagaigold

I agree with @Aldo-f that it should work thru uninstall which it is a "destructive" operation in many context.

In that case, some check for the -p flag would be required somewhere here and action would be taken accordingly.

https://github.com/ScoopInstaller/Scoop/blob/7b35e19d4cc32eb8cd562559c5a72f488d57a946/libexec/scoop-uninstall.ps1#L43-L45

rashil2000 avatar Oct 19 '23 09:10 rashil2000

but will try to make a -p in the scoop-cleanup.ps1

@Aldo-f, I can make PR for this one

hagaigold avatar Oct 20 '23 08:10 hagaigold