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

Get-WGPackage Needs to recognize non-English results #1

Closed
stevenbaert opened this issue Feb 4, 2022 · 21 comments
Closed

Get-WGPackage Needs to recognize non-English results #1

stevenbaert opened this issue Feb 4, 2022 · 21 comments
Assignees
Labels
bug Something isn't working pending pending user feedback

Comments

@stevenbaert
Copy link

Hi,

First of all: great work guys!

I'm building small GUI on Winget with your wingettools.

Now Get-WGPackage seemed to work fine but suddenly stopped working.
F.e. Get-WGPackage Firefox shows no output.

Found https://www.powershellgallery.com/packages/WingetTools/0.6.0/Content/functions%5CGet-WGPackage.ps1 but didn't help me with analysis.

Any idea howto troubleshoot?
Thanks!
Steven

@jdhitsolutions
Copy link
Owner

Hmm..... This works for me with no errors.

image

What version of PowerShell are you running? What version of the WingetTools module? The most recent version is 1.0.0.

@jdhitsolutions jdhitsolutions added the bug Something isn't working label Feb 4, 2022
@jdhitsolutions
Copy link
Owner

You could also try running the native Winget command.

winget show --name firefox --source winget

And see what you get.

@stevenbaert
Copy link
Author

stevenbaert commented Feb 4, 2022

Thanks, Winget is working fine. But wingettools via search Firefox | get-wgpackage converts it to a powershell object and that's exactly what I need to list the result in a gridview.
That suddenly stopped working and then I noticed that the get-wgpackage didn't give output.

I did update software via Winget on my Windows 10 machine, maybe some dependency broke?
Note that I do have output via get-wgpackage Firefox but the lines - it lists several- below headings (name, id , version etc) are empty.

@jdhitsolutions
Copy link
Owner

What version of winget are you using?

winget --version

And what is the exact command you are trying to run?

@stevenbaert
Copy link
Author

stevenbaert commented Feb 4, 2022

I did install Winget via wingettools today, so I assume Winget is the latest version(?)

I have a textbox which contains the item to search for in value $textbox
I first do a $result = get-wgpackage $textbox.text | out-gridview -passthrough
Then the selection in the gridview is passed to Winget install $result.id
But the gridview suddenly appeared empty :-(
Then I saw the command is also empty when running get-wgpackage firefox

I have it on both a production system as well as a vanilla w10 system to which I install prereqs (wingettools, nuget, winget etc).
No clue why it suddenly stopped working.

@jdhitsolutions
Copy link
Owner

On a new Win10 system I can do this:
image

I can also pipe the command to Out-Gridview. At a prompt run:

Get-WGPackage Firefox -verbose

and paste the verbose output. That might help show where things are breaking down.

@stevenbaert
Copy link
Author

Thanks for your input!
Really strange, but I fail to reproduce the issue now. Have several W10 machines to test with but none of them has the issue now.
I'll have to test things again and hopefully can reproduce to update this item and find root cause.

@jdhitsolutions
Copy link
Owner

I suppose it could have been a back-end problem with the package repository. I'll leave this issue open for now.

@stevenbaert
Copy link
Author

I could reproduce on another (company build) system. Might be related to that system (on which it worked before).
Below the output. As you can see the output is empty.

PS C:\WINDOWS\system32> get-wgpackage firefox -Verbose
VERBOSE: [16:08:13.1092192 BEGIN ] Starting Get-WGPackage
VERBOSE: [16:08:13.1517023 BEGIN ] Using source winget
VERBOSE: [16:08:13.1517023 BEGIN ] Using Parameter set name
VERBOSE: [16:08:13.1517023 PROCESS] Invoking: winget show --source winget --name 'firefox'
VERBOSE: [16:08:15.0580108 PROCESS] Converting winget data
VERBOSE:
Gevonden Mozilla Firefox [Mozilla.Firefox]
Versie: 96.0.3
Uitgever: Mozilla
URL van uitgever: https://www.mozilla.org/en-US/
Ondersteunings-URL van uitgever: https://support.mozilla.org/en-US/
Auteur: Mozilla Foundation
Koppelingspad: firefox
Beschrijving: Firefox Browser, also known as Mozilla Firefox or simply Firefox, is a free and open-source web browser
developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation.
Firefox uses the Gecko layout engine to render web pages, which implements current and anticipated web standards.
In 2017, Firefox began incorporating new technology under the code name Quantum to promote parallelism and a more
intuitive user interface.
Firefox is officially available for Windows 7 or newer, macOS, and Linux.
Its unofficial ports are available for various Unix and Unix-like operating systems including FreeBSD, OpenBSD, NetBSD,
illumos, and Solaris Unix.
Startpagina: https://www.mozilla.org/en-US/firefox/
Licentie: Mozilla Public License Version 2.0
Licentie-URL: https://www.mozilla.org/en-US/MPL/2.0
Privacy-URL: https://www.mozilla.org/en-US/privacy/websites
Copyright-URL: https://www.mozilla.org/en-US/foundation/trademarks/policy
Opmerkingen bij de release: Fixed an issue that allowed unexpected data to be submitted in some of our search telemetry
(bug 1752317)

URL voor opmerkingen bij de release: https://www.mozilla.org/en-US/firefox/96.0.3/releasenotes/
Installatieprogramma:
Type: Msix
Download-URL:
https://download-installer.cdn.mozilla.net/pub/firefox/releases/96.0.3/win64/multi/Firefox%20Setup%2096.0.3.msix
SHA256: 449b02744455d86692c4eea0aabbb268ced75d54cc45772cfe2bc3cdc6659422
Releasedatum: 2022-01-26
VERBOSE: [16:08:15.0580108 CONVERT] Processing package data
VERBOSE: [16:08:15.0892598 CONVERT] Creating object

Name ID Version Description


VERBOSE: [16:08:15.1048852 END ] Ending Get-WGPackage

@jdhitsolutions
Copy link
Owner

This helps. At least I can see that winget is getting the package. Now I need to see what the package data isn't getting properly processed by the function.

@jdhitsolutions
Copy link
Owner

I wonder if there is a culture problem with the output from winget and my parsing function. Can you run winget show --name firefox --source winget | out-file winget-firefox.txt and attach the text file? That will give me something to test with.

@jdhitsolutions
Copy link
Owner

Yeah, I found at least one problem already with the regex patterns where I made the silly assumption winget output would always be in Engilish.

@jdhitsolutions jdhitsolutions self-assigned this Feb 6, 2022
@jdhitsolutions jdhitsolutions changed the title Get-WGPackage Get-WGPackage Needs to recognize non-English results Feb 6, 2022
@jdhitsolutions
Copy link
Owner

Definitely, a language issue that is going to be complicated to resolve.

@stevenbaert
Copy link
Author

Thanks for the input. Could I (temporarily) force the output to English? That would be fine for me as a workaround.

@jdhitsolutions
Copy link
Owner

This is apparently a known problem with Microsoft Store apps which, I think Winget is using behind the scenes. In my research, I found a reference to https://docs.microsoft.com/en-us/powershell/module/international/set-winuserlanguagelist?view=windowsserver2019-ps which might solve the problem. You might be able to add English. I tried adding NL-NL. Or you would need a system running the En-US culture.

I think I have a fix for the function. The challenge is the custom formatting file which assumes English. I'm not sure how to handle that yet.

@stevenbaert
Copy link
Author

Thanks! I ll look into it. If I can make it work, I ll let you know the details.

@stevenbaert
Copy link
Author

This works for me as a quickfix:

$OriginalLangList = Get-WinUserLanguageList
Set-WinUserLanguageList en-BE -Force -ErrorAction SilentlyContinue
get-wgpackage firefox
Set-WinUserLanguageList -LanguageList $OriginalLangList -Force

@jdhitsolutions
Copy link
Owner

That should work for the native winget command. The problem is that the Get-WGPackage is trying to parse and format the native output. The function is building a custom object based on the output. The challenge is that the property names of the object you create are different than what I create. That's the work I have to figure out.

@jdhitsolutions
Copy link
Owner

There is no easy fix on my part. Winget is inconsistent in the data that it returns so it is next to impossible to create a consistent object. Then we have the language issue. I think the best I can do is add some clarity to the documentation and recommend the WinUserLanguage workaround.

Can you run this and post the result:

Get-Culture
Get-UiCulture
$OriginalLangList = Get-WinUserLanguageList
Set-WinUserLanguageList en-BE -Force -ErrorAction SilentlyContinue
get-wgpackage firefox -verbose  |  Select *
Set-WinUserLanguageList -LanguageList $OriginalLangList -Force

It may be easiest to start a transcript, run the commands, then post the file. This will help with my documentation and help me better understand what is happeining.

@stevenbaert
Copy link
Author

Sorry, didn't see reply. Will check & update post.

@jdhitsolutions jdhitsolutions added the pending pending user feedback label Apr 11, 2022
@jdhitsolutions
Copy link
Owner

Closing the issue as stale but will happily re-open.

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

No branches or pull requests

2 participants