Qonfused / OSX-Hyper-V

OpenCore configuration for running macOS on Windows Hyper-V.
https://github.com/Qonfused/OSX-Hyper-V
BSD 3-Clause "New" or "Revised" License
235 stars 11 forks source link

Host system damage 😡 #10

Closed NuoFang6 closed 5 months ago

NuoFang6 commented 5 months ago

Thank you for deleting a bunch of my files with your script. Now the system, software, and other things are broken.👎 image

NuoFang6 commented 5 months ago

Check the deletion result image ` + CategoryInfo : InvalidArgument: (tipresx.dll.mui:FileInfo) [Remove-Item],ArgumentException

Qonfused commented 5 months ago

It seems that there were several cascading errors here. The main build script should have failed if it was unable to create a temporary directory, or if the postinstall script was unable to find and extract the MacHyperVSupport archive in that temporary directory. The lack of an explicit path check in the powershell script is quite a significant security oversight, though it can never reach that point if the path did not exist.

These checks exist as startup assertions in OCE-Build, which the build script traps as terminating errors in powershell to stop script execution. Other kinds of non-terminating errors (e.g. from Expand-Archive or Invoke-WebRequest cmdlets) are also set to halt script execution though $ErrorActionPreference = 'Stop'. https://github.com/Qonfused/OCE-Build/blob/25c113a/ci/bootstrap.ps1#L22-L24 https://github.com/Qonfused/OSX-Hyper-V/blob/c44a738/scripts/build.ps1#L32-L34

The build script should catch the error and fail gracefully, though this appears to have somehow been swallowed inside the Invoke-Command cmdlet which should have returned an error code and all ambient error preferences to the caller.

I've since addressed this in ee0c7e3760e9b0c191fbae5fff124ef78afba0cf to explicitly disallow running the post-install script before the build script is ran, though I am concerned about the underlying cause. Any version of PowerShell since November 2022 (v7.3 and later) should respect both ambient error handling preferences.

Would you be able to provide info about your current build of Windows and PowerShell? You can get version information about both by running $PSVersionTable in PowerShell:

$PSVersionTable
>>> Name                           Value
>>> ----                           -----
>>> PSVersion                      5.1.22621.3672
>>> PSEdition                      Desktop
>>> PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
>>> BuildVersion                   10.0.22621.3672
>>> CLRVersion                     4.0.30319.42000
>>> WSManStackVersion              3.0
>>> PSRemotingProtocolVersion      2.3
>>> SerializationVersion           1.1.0.1
NuoFang6 commented 5 months ago

I attempted to restore my system, so this output may not be the same as at that time. image Unfortunately, the restore operation did not have much effect