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

Uninstallation seems to be done via Package Name #288

Closed
farosch opened this issue Oct 17, 2022 · 21 comments
Closed

Uninstallation seems to be done via Package Name #288

farosch opened this issue Oct 17, 2022 · 21 comments
Labels
bug Something isn't working ready-to-go

Comments

@farosch
Copy link

farosch commented Oct 17, 2022

It looks like uninstallations are triggered using the Package Name.
This does not work when two installed packages have the same name.
Installations/uninstallations should be triggered using the Package ID.

wingetui_Bznrfl8GJB

@ppvnf
Copy link
Contributor

ppvnf commented Oct 17, 2022

I agree this should be implemented for installs, uninstalls and updates as well. Also, I believe it's better to use --id and -e, like suggested in Winget docs:

The best way to limit the selection to one file is to use the id of the application combined with the exact query option. For example:
winget install --id Git.Git -e

@fernandog
Copy link

fernandog commented Oct 17, 2022

A quick look at the code I found this:

https://github.com/martinet101/WingetUI/blob/main/wingetui/storeEngine.py#L374

Code uses ID and "-e" only if self.useif is set

if(self.store == "winget" or self.store.lower() == "local pc"):
            self.p = subprocess.Popen(self.adminstr + [wingetHelpers.winget, "uninstall", "-e"] + (["--id", self.packageId] if self.useId else ["--name", self.programName]) + wingetHelpers.common_params + self.cmdline_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, shell=True, cwd=sudoLocation, env=os.environ)

I found out this code useId=not("…" in id)

So, if it founds the "..." in the ID, code uses package name.

Question is: why ID would have "..." ? Maybe too long string ?

Maybe @martinet101 can enlighten us

@marticliment
Copy link
Owner

Question is: why ID would have "..." ? Maybe too long string ?

We should ask this to winget.

Whenever some package names/ids are too long, winget cuts them, ignoring if there's plenty of horixontal space in the console window. When so happens, it uses name.

However, this case shouldn't apply here and winget should be defaulting to ID uninstall

@marticliment marticliment added bug Something isn't working ready-to-go labels Oct 17, 2022
@fernandog
Copy link

Do you have an example of package name/ID that this issue happens @martinet101 ?

@marticliment
Copy link
Owner

image

@fernandog
Copy link

Did you try the "Format-Table -AutoSize" parameter for Powershell / subprocess.Popen ?

https://learn.microsoft.com/en-GB/powershell/module/microsoft.powershell.utility/format-table

@marticliment
Copy link
Owner

I used the mode command in cmd, and while it works, winget just ignores it. There's an issue where this was discussed, but it is just winget's fault

@fernandog
Copy link

winget with Win11 beta (insider) has no issue. If I resize Powershell window, strings go to the next line

image

image

@marticliment
Copy link
Owner

which winget version are you using?

@fernandog
Copy link

which winget version are you using?

PS C:\WINDOWS\system32> winget --version
v1.3.2691

@marticliment
Copy link
Owner

the command winget search "" also shows the full names?

@fernandog
Copy link

Look like it's showing f ull names

image

@marticliment
Copy link
Owner

and with an empty string as a search query?

@fernandog
Copy link

damn, truncated

image

@marticliment
Copy link
Owner

That's the thing i was saying. it sometimes does work, it sometimes does not

@fernandog
Copy link

fernandog commented Oct 17, 2022

command winget search ""

I misread this. I thought the "" was to me to fill with something. with an empty string is always truncated

@ppvnf
Copy link
Contributor

ppvnf commented Oct 17, 2022

I've tested it here on cmd and PShell. If the window is maximized I get the full results, if it's a regular window I get the ...

EDIT:
Regular window
Maximized one

@fernandog
Copy link

@ppvnf its not the console window. Its how winget print the results on screen when you run winget search " "

@ppvnf
Copy link
Contributor

ppvnf commented Oct 17, 2022

You mean winget search " " with a space in the middle, now I get it. Thanks.

@fernandog
Copy link

Opened an issue there: microsoft/winget-cli#2603

@marticliment
Copy link
Owner

The issue with the uninstall failing has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready-to-go
Projects
None yet
Development

No branches or pull requests

4 participants