https://bugs.winehq.org/show_bug.cgi?id=45118
Bug ID: 45118 Summary: Microsoft Windows PowerShell 6.x reports 'PowerShell Gallery is currently unavailable.' (WinHttpSetOption returns incorrect lasterror on unsupported options) Product: Wine Version: 3.7 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: winhttp Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net Distribution: ---
Hello folks,
as it says.
Prerequisites:
* 32-bit WINEPREFIX * .NET Framework 4.5 -> 'winetricks -q dotnet45' * PowerShell 6.0 unpack to: 'c:\Program Files\PowerShell' (no install)
https://github.com/PowerShell/PowerShell/releases/download/v6.0.0/PowerShell...
Start PowerShell.
NOTE: PowerShell relies on extended CUI functionality (screen buffer) it needs to be run with with 'wineconsole' which provides this. A bare console can't work by design here.
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files/PowerShell
$ wineconsole ./pwsh.exe ... --- snip ---
Register PowerShell Gallery repo:
--- snip --- PS C:\Program Files\PowerShell> Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/ -PackageManagementProvider NuGet -PublishLocation https:// www.powershellgallery.com/api/v2/package/ -ScriptSourceLocation https://www.powershellgallery.com/api/v2/items/psscript/ -ScriptPublishLocation https://www.powershellgallery.com/api/v2/p ackage/
Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later. At C:\Program Files\PowerShell\Modules\PowerShellGet\1.6.0\PSModule.psm1:4515 char:9 + Get-PSGalleryApiAvailability -Repository $Name + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException + FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability
Register-PSRepository : Use 'Register-PSRepository -Default' to register the PSGallery repository. At line:1 char:1 + Register-PSRepository -Name PSGallery -SourceLocation https://www.pow ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (PSGallery:String) [Register-PSRepository], ArgumentException + FullyQualifiedErrorId : UseDefaultParameterSetOnRegisterPSRepository,Register-PSRepository --- snip ---
Relevant part of MS .NET Core Framework reference impl.:
https://github.com/dotnet/corefx/blob/71cc1ae8ba02b7b71878cb69a50c667c8ed0f5...
--- snip --- ... uint optionAssuredNonBlockingTrue = 1; // TRUE
if (!Interop.WinHttp.WinHttpSetOption( sessionHandle, Interop.WinHttp.WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS, ref optionAssuredNonBlockingTrue, (uint)sizeof(uint))) { // This option is not available on downlevel Windows versions. While it improves // performance, we can ignore the error that the option is not available. int lastError = Marshal.GetLastWin32Error(); if (lastError != Interop.WinHttp.ERROR_WINHTTP_INVALID_OPTION) { throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.WinHttp.WinHttpSetOption)); } } ... --- snip ---
-> relies on lasterror being 'ERROR_WINHTTP_INVALID_OPTION', otherwise throws managed CLR exception.
https://github.com/dotnet/corefx/blob/71cc1ae8ba02b7b71878cb69a50c667c8ed0f5...
--- snip --- public const uint ERROR_WINHTTP_INVALID_OPTION = 12009; --- snip ---
https://github.com/dotnet/corefx/blob/71cc1ae8ba02b7b71878cb69a50c667c8ed0f5...
--- snip --- public const uint WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS = 111; --- snip ---
You can use the definitions there to advance Wine's WINHTTP_LAST_OPTION further, matching all the MSDN option flags:
https://msdn.microsoft.com/de-de/library/windows/desktop/aa384066(v=vs.85).a...
Wine source:
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/winhttp/session.c#l89...
--- snip --- 892 static BOOL request_set_option( object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen ) 893 { 894 request_t *request = (request_t *)hdr; 895 896 switch (option) 897 { ... 1025 default: 1026 FIXME("unimplemented option %u\n", option); 1027 set_last_error( ERROR_INVALID_PARAMETER ); 1028 return TRUE; 1029 } 1030 } --- snip ---
$ wine --version wine-3.7-31-gdbce559df6
Regards
https://bugs.winehq.org/show_bug.cgi?id=45118
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://github.com/PowerShe | |ll/PowerShell/releases/down | |load/v6.0.0/PowerShell-6.0. | |0-win-x86.zip Keywords| |dotnet, download
https://bugs.winehq.org/show_bug.cgi?id=45118
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=45118
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |0b61334b9d6392e8c8a9772d762 | |efaf0c2eb0835 Status|NEW |RESOLVED
--- Comment #1 from Anastasius Focht focht@gmx.net --- Hello folks,
this is fixed by commit https://source.winehq.org/git/wine.git/commitdiff/0b61334b9d6392e8c8a9772d76...
Thanks Hans
Still fails to add a repository but that's another bug.
$ wine --version wine-3.7-65-ge637a6f0bf
Regards
https://bugs.winehq.org/show_bug.cgi?id=45118
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #2 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.8.
https://bugs.winehq.org/show_bug.cgi?id=45118
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |3.0.x
https://bugs.winehq.org/show_bug.cgi?id=45118
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|3.0.x |---
--- Comment #3 from Michael Stefaniuc mstefani@winehq.org --- Removing the 3.0.x milestone from bugs included in 3.0.3.
https://bugs.winehq.org/show_bug.cgi?id=45118
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL|https://github.com/PowerShe |https://web.archive.org/web |ll/PowerShell/releases/down |/20180121080712/https://git |load/v6.0.0/PowerShell-6.0. |hub.com/PowerShell/PowerShe |0-win-x86.zip |ll/releases/download/v6.0.0 | |/PowerShell-6.0.0-win-x86.z | |ip