[PR #3] [MERGED] Accept verbatim Windows output paths (\\?\C:\...) #12

Closed
opened 2026-11-02 15:32:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon-mixins/pull/3
Author: @d3grando
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @levzzz5154

Base: main ← Head: windows-verbatim-output-path


📝 Commits (1)

  • 392b38a Accept verbatim Windows output paths (\?\C:...)

📊 Changes

2 files changed (+21 additions, -0 deletions)

View changed files

📝 crates/horizon-mixins-cli/src/staging.rs (+6 -0)
📝 crates/horizon-mixins-cli/tests/integration.rs (+15 -0)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

apply fails on Windows for any canonicalized --out:

{ "code": "E_IO", "message": "Incorrect function. (os error 1)", "file": "\\\\?\\C:" }

output_path checks every component of the output path with fs::symlink_metadata, the drive prefix included. On
Windows, canonicalize returns a verbatim path (\\?\C:\Users\...), whose first component is \\?\C:: the volume
device, not a directory, and Windows answers ERROR_INVALID_FUNCTION when it is stat'ed. A plain C:\... path works
(its prefix C: resolves to the drive's current directory), which is why this never showed on a typed path.

The Horizon launcher passes exactly such a path: it canonicalizes its data folder before apply (for macOS's /tmp
link, launcher/src/native_mods.rs), so native mods couldn't build on Windows at all. Found while building Veinminer
0.3.0 on Windows 11, the first Windows build as far as I know (the launcher side is horizon-rust/horizon#3377).

The change

Component::Prefix is pushed and not checked: a drive prefix names a volume, which is never a link. Every component
after it is checked as before, so a link anywhere in the path is still refused.

Test: a_canonicalized_output_path_stages runs apply with --out inside a canonicalized directory, as the launcher
does. On Windows it fails before the change with the error above and passes after it; on Linux and macOS it passes
either way (no prefix).

Checked on Windows 11

On a checkout with LF line endings (core.autocrlf=false), toolchain 1.95.0 from rust-toolchain.toml:

  • cargo fmt --all --check: clean
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
  • cargo test --workspace --locked: 59 passed, 5 failed. The same 5 fail on 0500ff2 without this change (58 passed),
    so they come from Windows itself:
    • cfg_attributes_shared_module_sources_and_shadowing_fail_closed, indexes_inline_external_path_inherent_and_trait_methods:
      E_INVALID_PATH "--workspace must name the Cargo workspace root" (likely the same verbatim-path mismatch, with
      the path Cargo reports);
    • compiled_mvp_is_deterministic_preserves_sources_and_unchanged_mtimes, scoped::scoped_features_compile_preserve_inputs_and_unchanged_mtimes:
      E_ATOMIC_STAGE, by design ("atomic replacement of an existing stage currently requires Linux");
    • output_protection_ownership_trust_and_missing_lockfile: E_STAGE_OWNERSHIP where the test expects E_INVALID_PATH.

Also, with Git for Windows' default core.autocrlf=true, 7 more snapshot tests fail because the fixtures and
snapshots are checked out with CRLF; a .gitattributes with * text=auto eol=lf would make a Windows checkout match.
Happy to send that, or to look at the first two failures, in separate pull requests.

End to end: with this tool in place of the pinned one, the released launcher 0.2.21 (MinGW-w64 put on its PATH by
hand) built Horizon at 83f15fa with Veinminer on Windows, and the mod mined a whole coal vein with one break in game.
The launcher pull request also stops passing a verbatim path, so it doesn't depend on this one; this one fixes the
tool for anyone who passes one.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon-mixins/pull/3 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `windows-verbatim-output-path` --- ### 📝 Commits (1) - [`392b38a`](https://github.com/horizon-rust/horizon-mixins/commit/392b38a6fd3545a15b14dd5400dfe0ada395c143) Accept verbatim Windows output paths (\\?\C:\...) ### 📊 Changes **2 files changed** (+21 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-mixins-cli/src/staging.rs` (+6 -0) 📝 `crates/horizon-mixins-cli/tests/integration.rs` (+15 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why `apply` fails on Windows for any canonicalized `--out`: ``` { "code": "E_IO", "message": "Incorrect function. (os error 1)", "file": "\\\\?\\C:" } ``` `output_path` checks every component of the output path with `fs::symlink_metadata`, the drive prefix included. On Windows, `canonicalize` returns a verbatim path (`\\?\C:\Users\...`), whose first component is `\\?\C:`: the volume device, not a directory, and Windows answers `ERROR_INVALID_FUNCTION` when it is stat'ed. A plain `C:\...` path works (its prefix `C:` resolves to the drive's current directory), which is why this never showed on a typed path. The Horizon launcher passes exactly such a path: it canonicalizes its data folder before `apply` (for macOS's `/tmp` link, `launcher/src/native_mods.rs`), so native mods couldn't build on Windows at all. Found while building Veinminer 0.3.0 on Windows 11, the first Windows build as far as I know (the launcher side is horizon-rust/horizon#3377). ## The change `Component::Prefix` is pushed and not checked: a drive prefix names a volume, which is never a link. Every component after it is checked as before, so a link anywhere in the path is still refused. Test: `a_canonicalized_output_path_stages` runs `apply` with `--out` inside a canonicalized directory, as the launcher does. On Windows it fails before the change with the error above and passes after it; on Linux and macOS it passes either way (no prefix). ## Checked on Windows 11 On a checkout with LF line endings (`core.autocrlf=false`), toolchain 1.95.0 from `rust-toolchain.toml`: - `cargo fmt --all --check`: clean - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo test --workspace --locked`: 59 passed, 5 failed. The same 5 fail on 0500ff2 without this change (58 passed), so they come from Windows itself: - `cfg_attributes_shared_module_sources_and_shadowing_fail_closed`, `indexes_inline_external_path_inherent_and_trait_methods`: `E_INVALID_PATH` "--workspace must name the Cargo workspace root" (likely the same verbatim-path mismatch, with the path Cargo reports); - `compiled_mvp_is_deterministic_preserves_sources_and_unchanged_mtimes`, `scoped::scoped_features_compile_preserve_inputs_and_unchanged_mtimes`: `E_ATOMIC_STAGE`, by design ("atomic replacement of an existing stage currently requires Linux"); - `output_protection_ownership_trust_and_missing_lockfile`: `E_STAGE_OWNERSHIP` where the test expects `E_INVALID_PATH`. Also, with Git for Windows' default `core.autocrlf=true`, 7 more snapshot tests fail because the fixtures and snapshots are checked out with CRLF; a `.gitattributes` with `* text=auto eol=lf` would make a Windows checkout match. Happy to send that, or to look at the first two failures, in separate pull requests. End to end: with this tool in place of the pinned one, the released launcher 0.2.21 (MinGW-w64 put on its `PATH` by hand) built Horizon at 83f15fa with Veinminer on Windows, and the mod mined a whole coal vein with one break in game. The launcher pull request also stops passing a verbatim path, so it doesn't depend on this one; this one fixes the tool for anyone who passes one. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:32:28 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon-mixins#12
No description provided.