GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add ABI-compatible Rust native implementations and side-by-side CI by SteveL-MSFT · Pull Request #118 · PowerShell/PowerShell-Native Conversation
|
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A legal null COM variant can trigger a crash, packaged MSVC binaries depend on an unbundled VC runtime, and CoreCLR tests do not cover successful managed execution.
Adds Rust implementations alongside the existing native C++ code, preserving the Unix C ABI and providing Windows launcher and hosting support while leaving the WSMan plugin unchanged.
Changes:
| File | Description |
|---|---|
rust/windows/tests/launcher-smoke.ps1 |
Checks launcher resources and startup. |
rust/windows/src/win.rs |
Provides Windows API bindings and resource wrappers. |
rust/windows/src/shell.rs |
Implements shortcuts and taskbar integration. |
rust/windows/src/policy.rs |
Defines parsing and hosting policies with tests. |
rust/windows/src/main.rs |
Adds the launcher entry point. |
rust/windows/src/lib.rs |
Exposes Windows hosting modules. |
rust/windows/src/launcher.rs |
Processes arguments and invokes managed hosts. |
rust/windows/src/hosting.rs |
Implements CLR hosting and COM Automation. |
rust/windows/src/common.rs |
Handles registry, configuration, and XML discovery. |
rust/windows/README.md |
Documents Windows builds and deployment contracts. |
rust/windows/Cargo.toml |
Defines launcher features and Windows dependencies. |
rust/windows/build.rs |
Embeds launcher resources using Windows SDK tools. |
rust/tests/WindowsLauncher.Tests.ps1 |
Tests packaged Windows launchers. |
rust/tests/NativeMethods.cs |
Defines managed Unix ABI test bindings. |
rust/tests/NativeLibrary.Tests.ps1 |
Tests packaged Unix exports and behavior. |
rust/tests/Invoke-Tests.ps1 |
Runs Pester and writes NUnit reports. |
rust/README.md |
Documents compatibility, builds, migration, and validation. |
rust/libpsl-native/tests/native.rs |
Tests Unix API behavior and layouts. |
rust/libpsl-native/tests/abi.ps1 |
Checks managed string, boolean, and errno compatibility. |
rust/libpsl-native/tests/abi.cpp |
Validates ABI compatibility using original headers. |
rust/libpsl-native/src/time.rs |
Implements native time conversion and clock setting. |
rust/libpsl-native/src/process.rs |
Implements process creation, identity, and control. |
rust/libpsl-native/src/logging.rs |
Implements syslog and macOS unified logging. |
rust/libpsl-native/src/lib.rs |
Exposes Unix APIs and shared ABI helpers. |
rust/libpsl-native/src/filesystem.rs |
Implements filesystem and metadata exports. |
rust/libpsl-native/src/accounts.rs |
Implements account and process-owner lookups. |
rust/libpsl-native/Cargo.toml |
Defines the Unix library crate. |
rust/Cargo.toml |
Configures workspace lint and release policies. |
rust/Cargo.lock |
Locks Rust dependencies. |
rust/build-linux.py |
Builds and packages four Linux variants. |
rust/.gitignore |
Excludes Rust build outputs. |
rust/.cargo/config.toml |
Configures Linux linkage and shared-library naming. |
README.md |
Introduces the additive Rust implementation. |
.gitignore |
Excludes repository-level artifacts. |
.github/workflows/rust-native.yml |
Adds cross-platform side-by-side builds and validation. |
Review effort: Balanced
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Isolate Pester dependencies, avoid host-mounted account assumptions in Alpine, and reject null COM variants before constructing an owner. Link the Windows CRT statically and verify PE imports. Exercise successful CoreCLR hosting with checksum-verified matching legacy payloads on x86 and x64. Co-authored-by: Copilot App <[email protected]>
Install make for the C++ musl baseline. Bind negative exit codes explicitly in the legacy managed test script and decode managed diagnostics as UTF-8. Unwrap Framework handles through the documented IObjectHandle interface and report failed COM interface IDs. Co-authored-by: Copilot App <[email protected]>
Match the original host's VT_DISPATCH ownership contract and cover AddRef/Release balancing with a regression test. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Keep Windows PowerShell 5.1 unsupported as requested. Exercise real Framework activation, Automation argument marshaling, and signed exit codes without depending on its incompatible non-COM-visible entry point. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
BOM-prefixed configuration files can prevent startup, and redirected CoreCLR stdout can mix UTF-16LE diagnostics with byte-oriented command output.
No open issues 🎉
In code that hasn't changed since last review
rust/windows/src/policy.rs:120
A UTF-8 BOM prevents the first configuration setting from being recognized: str::trim leaves U+FEFF intact, so a file beginning with PSHOMEDIR= after the BOM returns None here. HostEnvironment::discover then silently ignores both configured paths and searches beside the executable, preventing startup when the payload is elsewhere. Strip an initial BOM before parsing, and add a BOM-prefixed configuration regression test.
rust/windows/src/win.rs:295
CoreCLR native stdout now uses UTF-16LE when redirected, unlike the original CssMainEntry.cpp output through wprintf. With -Verbose -Command ..., the success message can therefore append NUL bytes to the managed command's byte-oriented output, producing a mixed-encoding stream. Keep UTF-16 for legacy resource diagnostics, but use a separate byte-oriented output path for CoreCLR native stdout and update the help/debug/verbose output tests accordingly.
Review effort: Balanced
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Preserve legacy UTF-16 resource diagnostics while writing native CoreCLR stdout as UTF-8. Add packaged-launcher regressions for external BOM-prefixed configuration and redirected help, debug prompts, and mixed native/managed verbose output. Co-authored-by: Copilot App <[email protected]>
There was an error while loading. Please reload this page.
|
Fixed both previously missed issues in 701c6a4:
All eight matrix jobs pass: https://github.com/PowerShell/PowerShell-Native/actions/runs/42953093912
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Public hosting APIs allow safe Rust code to trigger invalid frees and out-of-bounds vtable calls, leaving critical memory-safety issues unresolved.
No open issues 🎉
In code that hasn't changed since last review
rust/windows/src/hosting.rs:176
The public tag and payload can be overwritten by entirely safe Rust code after AutomationVariant::default(). For example, setting kind to VT_BSTR and value to a non-BSTR pointer makes Drop pass that pointer to VariantClear, causing an invalid free. Keep these fields private so the safe constructors preserve the ownership invariant; any raw-variant construction or mutation should require an explicit unsafe contract.
rust/windows/src/hosting.rs:338
query returns the same publicly invokable type for every interface IID, but invoke unconditionally calls IDispatch slots 5 and 6. A safe caller can query IID_IUnknown on an instance and then call invoke on the returned three-slot interface, causing an out-of-bounds vtable call rather than a COM error. Keep this low-level helper private (its current callers are all internal), or return interface-specific wrappers that only expose invoke for IDispatch.
rust/windows/src/common.rs:250
DirEntry::file_type() does not follow symbolic links, so this excludes DLL symlinks that the original FindFirstFile enumeration included. A payload with a symlinked System.Private.CoreLib.dll or Microsoft.PowerShell.ConsoleHost.dll can load CoreCLR but then fail initialization or delegate creation because the assembly is missing from the TPA list. Follow links when checking whether the candidate is a file, while retaining the filename exclusions.
rust/windows/tests/launcher-smoke.ps1:38
The Framework smoke path still expects the registered PowerShell console host to execute exit 37. On a normal Windows installation this selects Windows PowerShell 5.1, which this port explicitly does not support because its entry point is not COM-visible, so the documented smoke command fails even when the launcher is built correctly. Pass @('-Version', 'invalid') instead and update the assertion at lines 58–59 to expect BAD_COMMAND_LINE (-196608) and report native argument-rejection failures.
Review effort: Balanced
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Make Automation storage and arbitrary COM queries private, add compile-fail API regressions, follow DLL symlinks, and exercise payload-independent launcher smoke checks. Co-authored-by: Copilot App <[email protected]>
There was an error while loading. Please reload this page.
|
Addressed all four newly reported findings in 439f1be:
All eight native CI jobs and all PR checks passed at this commit: https://github.com/PowerShell/PowerShell-Native/actions/runs/42955460413
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Handwritten COM vtables and Windows shell integration are not exercised by headless CI, requiring Windows platform-owner review and desktop validation to establish compatibility.
No open issues 🎉
Review effort: Balanced
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Prevent concurrent native test forks from crashing in macOS child-side libSystem initialization before exec. Keep other tests parallel and report child wait status before asserting SIGINT output. Co-authored-by: Copilot App <[email protected]>
There was an error while loading. Please reload this page.
|
Fixed the intermittent macOS ARM64 test failure in fc065b9. The empty SIGINT-test output was a child-process crash before exec, not a SIGINT assertion race. Local stress runs also reproduced failures in the other process tests; the crash report identified macOS libSystem/libnotify child-side fork initialization ( Added a macOS-only mutex around test fork calls, leaving the rest of the suite parallel and production behavior unchanged. The SIGINT test now reaps the child and checks its termination status before checking output, so a future process crash reports the actual wait status. The parallel native suite passed 200 consecutive local runs after the fix. All eight native CI jobs, including macOS ARM64, and all PR checks now pass: https://github.com/PowerShell/PowerShell-Native/actions/runs/43122250368
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.