gerardog/gsudo

Issue: `Win32 internal error` over gsudo-elevated `Windows PowerShell` v5.1

SiyuChen opened this issue · 4 comments

Hi,
I can't just guess everything, so please at least follow the bug issue template and context information to your issue:

  • windows version
  • gsudo version
  • use gsudo --debug
  • version of PSReadLine (do Get-Module PSReadLine)
  • what scoop bucket are you pooling notepads-np from?
  • does this problem repeats if you retry?

Sorry about not following the bug issue template.

  • windows version: Windows 21H1
  • gsudo version: 1.6
  • use gsudo --debug:
    image
  • version of PSReadLine: 2.0.0
  • what scoop bucket are you pooling notepads-np from? --- From one of official buckets of scoop, see https://github.com/ScoopInstaller/Nonportable/blob/master/bucket/notepads-np.json
  • does this problem repeats if you retry? Yes, there is no issue when I install notepads-np with scoop, but the same error repeats every time when I uninstall notepads-np with scoop

Also, if one uses double 'gsudo' to uninstall notepads-np, it seems to work,
image

With a single gsudo, the Win32 internal error is always there.

Thanks for the additional context.

I've looked at that notepads-np.json manifest, and it breaks at Remove-AppxPackage. It is its progress bar throwing error.

I can also reproduce this on Win11, using Windows Powershell fails (not pwsh Core), by running: gsudo "Write-Progress -Activity 'Title'".
image

...but goes away when you wrap powershell.exe with some other app like gsudo (hence your double gsudo) or cmd /c
image

Workarounds:

  • If you add this line to the manifest, the progress bar will not be shown and the uninstall will succeed:
$ProgressPreference = "SilentlyContinue"
  • Use PowerShell v7 or newer.

Help wanted: Any Windows Internals, low-level guru willing to help me understand why powershell.exe with it's main process token replaced fails... but replacing the token of 'cmd /c powershell.exe' works.