Skip to content

Comments

refactor(wsl): relax WSL error judgment#106

Merged
ihexon merged 1 commit intooomol-lab:mainfrom
BlackHole1:improve-wsl-err
Apr 23, 2025
Merged

refactor(wsl): relax WSL error judgment#106
ihexon merged 1 commit intooomol-lab:mainfrom
BlackHole1:improve-wsl-err

Conversation

@BlackHole1
Copy link
Member

We found that Microsoft sometimes modifies the WSL error codes. To avoid this, we relax the handling of error codes.

Signed-off-by: Kevin Cui <bh@bugs.cc>
@BlackHole1 BlackHole1 requested review from Copilot and ihexon April 23, 2025 09:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR relaxes the WSL error judgment to accommodate variations in error codes introduced by Microsoft.

  • Removed module-specific prefixes from error message substring checks in MountVHDX, UmountVHDX, and MoveDistro functions.
  • Adjusted error handling to be more flexible by checking for core error codes without their former qualifiers.
Comments suppressed due to low confidence (2)

pkg/wsl/distro.go:109

  • Relaxing the error check by removing the module prefix improves flexibility; however, verify that the substring matching will not inadvertently capture unrelated error messages in the future.
if strings.Contains(err.Error(), "WSL_E_USER_VHD_ALREADY_ATTACHED") {

pkg/wsl/distro.go:137

  • The removal of the module-specific prefix in the MoveDistro error check makes the matching more permissive; ensure this change does not unintentionally catch non-targeted errors.
if strings.Contains(err.Error(), "ERROR_SHARING_VIOLATION") {

@ihexon ihexon merged commit 55cca7e into oomol-lab:main Apr 23, 2025
1 check passed
@BlackHole1 BlackHole1 deleted the improve-wsl-err branch April 23, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants