feat(graph): validate Windows path case and reserved names
This commit is contained in:
1 parent
b55aca328a
commit
7772697a48
6 files changed
+115
-9
No files matched your search
@@ -290,6 +290,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
|||||||
|
|
||||||
- **Wave 98 (Signed Installer Archives)**: `vbs install --archive FILE --signing-key SEED` now writes `<archive>.sha256` (sha256sum format), `<archive>.sig` (Ed25519 detached signature hex) and `<archive>.pub` (signer key hex), and fails closed when no Ed25519 backend is available. The install test verifies the checksum prefix, the signature/key lengths, and the signature over the archive bytes when signing is available.
|
- **Wave 98 (Signed Installer Archives)**: `vbs install --archive FILE --signing-key SEED` now writes `<archive>.sha256` (sha256sum format), `<archive>.sig` (Ed25519 detached signature hex) and `<archive>.pub` (signer key hex), and fails closed when no Ed25519 backend is available. The install test verifies the checksum prefix, the signature/key lengths, and the signature over the archive bytes when signing is available.
|
||||||
|
|
||||||
|
- **Wave 99 (Windows Path & Case-Sensitivity Validation)**: graph lowering for Windows targets rejects case-insensitive output collisions (`Tool` vs `tool` → `Tool.exe`/`tool.exe`) and reserved device names (`CON`, `NUL`, `COM1`, …), with explicit diagnostics. The Wine regression test now also proves PE case-insensitive file semantics (`fopen("CASE_A.TXT")` finds `case_a.txt`) and asserts both validation errors.
|
||||||
|
|
||||||
## Remaining future scope
|
## Remaining future scope
|
||||||
|
|
||||||
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
||||||
|
|||||||
@@ -102,4 +102,5 @@ Base HEAD: `fe0d1a6`
|
|||||||
| Wave 96 (Wine-first Windows target) | MinGW-w64 cross discovery, PE artifact naming, `--target-os/--target-arch`, Wine test runner | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Windows target cross-build + Wine test pass; full CTest 8/8) | `src/Toolchain/Driver.cpp`, `src/Graph/Graph.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
| Wave 96 (Wine-first Windows target) | MinGW-w64 cross discovery, PE artifact naming, `--target-os/--target-arch`, Wine test runner | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Windows target cross-build + Wine test pass; full CTest 8/8) | `src/Toolchain/Driver.cpp`, `src/Graph/Graph.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Wave 97 (ZIP & DEB generators) | `--archive-format zip|deb`: stored ZIP and Debian ar package with metadata; tested structurally and validated with real `dpkg-deb` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install test passes, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
| Wave 97 (ZIP & DEB generators) | `--archive-format zip|deb`: stored ZIP and Debian ar package with metadata; tested structurally and validated with real `dpkg-deb` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install test passes, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Wave 98 (Signed installer archives) | `--signing-key` writes `.sha256`/`.sig`/`.pub` for the installer archive and fails closed without a backend | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install test passes, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
| Wave 98 (Signed installer archives) | `--signing-key` writes `.sha256`/`.sig`/`.pub` for the installer archive and fails closed without a backend | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install test passes, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
|
| Wave 99 (Windows path semantics) | Case-insensitive output collision + reserved device name validation for Windows targets; Wine case-insensitivity assertion | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Windows regression test passes, full CTest 8/8) | `src/Graph/Graph.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||||
@@ -1399,6 +1399,19 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
|
|||||||
over the archive bytes are verified; otherwise the failure path is asserted.
|
over the archive bytes are verified; otherwise the failure path is asserted.
|
||||||
- Full CTest: **8 / 8 passed** in 281.48 s.
|
- Full CTest: **8 / 8 passed** in 281.48 s.
|
||||||
|
|
||||||
|
## Windows Path & Case-Sensitivity Validation (GCC 16.2, pin `0002e74`)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc -p wine64 -c build/pinned/bin/vbs_v1_tests \
|
||||||
|
--filter track_c_windows_target_cross_build_and_wine_test --no-color
|
||||||
|
```
|
||||||
|
|
||||||
|
- The Windows test binary creates `case_a.txt` and opens `CASE_A.TXT`; it passes only because
|
||||||
|
Wine applies Windows case-insensitive filesystem semantics.
|
||||||
|
- A project declaring `Tool` and `tool` executables fails with `differ only by case`, and a `CON`
|
||||||
|
target fails with `reserved Windows device name`.
|
||||||
|
- Regression test: **passed** (14.12 s); full CTest: **8 / 8 passed** in 277.56 s.
|
||||||
|
|
||||||
## Limits and Unrun Checks
|
## Limits and Unrun Checks
|
||||||
|
|
||||||
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ build2 documentation was **not** available through Context7; build2 statements b
|
|||||||
- **Native MSVC / clang-cl host support is deferred** (Track C3-native) until a real Windows
|
- **Native MSVC / clang-cl host support is deferred** (Track C3-native) until a real Windows
|
||||||
host exists.
|
host exists.
|
||||||
|
|
||||||
Status 2026-12-05: items 1-3 below are **implemented** (`--target-os windows --target-arch x86_64`, MinGW-w64 discovery, `.exe`/`.dll` naming, Wine test runner) and verified by `FullV1Tests.track_c_windows_target_cross_build_and_wine_test`; item 4 (path/case-sensitivity validation under Wine) remains.
|
Status 2026-12-05: items 1-3 below are **implemented** (`--target-os windows --target-arch x86_64`, MinGW-w64 discovery, `.exe`/`.dll` naming, Wine test runner) and verified by `FullV1Tests.track_c_windows_target_cross_build_and_wine_test`; item 4 (path/case-sensitivity validation under Wine) is also implemented: Windows-target lowering rejects case-only output collisions and reserved device names, and the Wine regression test proves case-insensitive file semantics.
|
||||||
|
|
||||||
Concrete work this implies:
|
Concrete work this implies:
|
||||||
1. Toolchain driver discovers `x86_64-w64-mingw32-{gcc,g++,ar,windres}` and records
|
1. Toolchain driver discovers `x86_64-w64-mingw32-{gcc,g++,ar,windres}` and records
|
||||||
|
|||||||
@@ -2109,6 +2109,41 @@ lower_project_graph(const ProjectDescription &description,
|
|||||||
graph.targets.push_back(std::move(summary));
|
graph.targets.push_back(std::move(summary));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Windows targets live on a case-insensitive filesystem with reserved device names.
|
||||||
|
if (Void::Str::to_lower_ascii(description.profile.os) == "windows") {
|
||||||
|
static constexpr const char *kReserved[] = {
|
||||||
|
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7",
|
||||||
|
"COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"};
|
||||||
|
std::map<std::string, std::string, std::less<>> seen_outputs;
|
||||||
|
for (const auto &target : graph.targets) {
|
||||||
|
std::string stem = target.name;
|
||||||
|
if (const auto dot = stem.find('.'); dot != std::string::npos) {
|
||||||
|
stem.resize(dot);
|
||||||
|
}
|
||||||
|
const std::string upper_stem = [&] {
|
||||||
|
std::string s = stem;
|
||||||
|
std::ranges::transform(s, s.begin(), [](char c) {
|
||||||
|
return static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
|
||||||
|
});
|
||||||
|
return s;
|
||||||
|
}();
|
||||||
|
if (std::ranges::find(kReserved, upper_stem) != std::end(kReserved)) {
|
||||||
|
return std::unexpected{
|
||||||
|
make_error(std::format("target '{}' uses the reserved Windows device name '{}'",
|
||||||
|
target.name, upper_stem))};
|
||||||
|
}
|
||||||
|
for (const auto &output : target.primary_outputs) {
|
||||||
|
const std::string lower = Void::Str::to_lower_ascii(output.filename().string());
|
||||||
|
const auto [it, inserted] = seen_outputs.emplace(lower, output.string());
|
||||||
|
if (!inserted && it->second != output.string()) {
|
||||||
|
return std::unexpected{make_error(
|
||||||
|
std::format("Windows output collision: '{}' and '{}' differ only by case",
|
||||||
|
it->second, output.string()))};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+63
-8
@@ -18,9 +18,9 @@
|
|||||||
#include <Void/Build/Provider/Provider.hpp>
|
#include <Void/Build/Provider/Provider.hpp>
|
||||||
#include <Void/Build/Provider/Translator.hpp>
|
#include <Void/Build/Provider/Translator.hpp>
|
||||||
#include <Void/Build/Snapshot/Snapshot.hpp>
|
#include <Void/Build/Snapshot/Snapshot.hpp>
|
||||||
#include <Void/Build/Util/Sha256.hpp>
|
|
||||||
#include <Void/Build/State/StateStore.hpp>
|
#include <Void/Build/State/StateStore.hpp>
|
||||||
#include <Void/Build/Toolchain/Driver.hpp>
|
#include <Void/Build/Toolchain/Driver.hpp>
|
||||||
|
#include <Void/Build/Util/Sha256.hpp>
|
||||||
#include <Void/Build/Watch/Watcher.hpp>
|
#include <Void/Build/Watch/Watcher.hpp>
|
||||||
#include <Void/Core/Scope.hpp>
|
#include <Void/Core/Scope.hpp>
|
||||||
#include <Void/Data/StrictJson.hpp>
|
#include <Void/Data/StrictJson.hpp>
|
||||||
@@ -1007,8 +1007,7 @@ void build(Void::Build::Project &p) {
|
|||||||
if (data_member) {
|
if (data_member) {
|
||||||
const auto data_tar_path = tmp / "data.tar";
|
const auto data_tar_path = tmp / "data.tar";
|
||||||
write_file(data_tar_path, *data_member);
|
write_file(data_tar_path, *data_member);
|
||||||
Void::Testing::expect(
|
Void::Testing::expect(Package::extract_safe_tar(data_tar_path, data_out).has_value());
|
||||||
Package::extract_safe_tar(data_tar_path, data_out).has_value());
|
|
||||||
Void::Testing::expect(std::filesystem::exists(data_out / "bin" / "cli_hi"));
|
Void::Testing::expect(std::filesystem::exists(data_out / "bin" / "cli_hi"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,8 +1024,7 @@ void build(Void::Build::Project &p) {
|
|||||||
sign_req.arguments.push_back(signing_seed.string());
|
sign_req.arguments.push_back(signing_seed.string());
|
||||||
const bool signing_ready = Provenance::signing_available();
|
const bool signing_ready = Provenance::signing_available();
|
||||||
if (signing_ready) {
|
if (signing_ready) {
|
||||||
Void::Testing::require(
|
Void::Testing::require(Provenance::generate_signing_seed(signing_seed).has_value());
|
||||||
Provenance::generate_signing_seed(signing_seed).has_value());
|
|
||||||
}
|
}
|
||||||
auto sign_res = Platform::run_supervised(sign_req);
|
auto sign_res = Platform::run_supervised(sign_req);
|
||||||
if (signing_ready) {
|
if (signing_ready) {
|
||||||
@@ -1044,8 +1042,7 @@ void build(Void::Build::Project &p) {
|
|||||||
Void::Testing::expect_eq(public_key_text->size(), std::size_t{65});
|
Void::Testing::expect_eq(public_key_text->size(), std::size_t{65});
|
||||||
Void::Testing::expect(checksum_text->starts_with(Util::sha256_hex(*archive_bytes)));
|
Void::Testing::expect(checksum_text->starts_with(Util::sha256_hex(*archive_bytes)));
|
||||||
auto verified = Provenance::verify_message(
|
auto verified = Provenance::verify_message(
|
||||||
std::as_bytes(
|
std::as_bytes(std::span<const char>{archive_bytes->data(), archive_bytes->size()}),
|
||||||
std::span<const char>{archive_bytes->data(), archive_bytes->size()}),
|
|
||||||
std::string_view{*signature_text}.substr(0, 128),
|
std::string_view{*signature_text}.substr(0, 128),
|
||||||
std::string_view{*public_key_text}.substr(0, 64));
|
std::string_view{*public_key_text}.substr(0, 64));
|
||||||
Void::Testing::require(verified.has_value());
|
Void::Testing::require(verified.has_value());
|
||||||
@@ -1086,7 +1083,19 @@ void build(Void::Build::Project &p) {
|
|||||||
}
|
}
|
||||||
)cpp");
|
)cpp");
|
||||||
write_file(proj / "main.cpp", "#include <cstdio>\nint main() { return 0; }\n");
|
write_file(proj / "main.cpp", "#include <cstdio>\nint main() { return 0; }\n");
|
||||||
write_file(proj / "test.cpp", "#include <cstdio>\nint main() { return 0; }\n");
|
// Under Wine the Windows filesystem semantics apply: an upper-case open must find the file
|
||||||
|
// created in lower case, proving PE path handling rather than Linux semantics.
|
||||||
|
write_file(proj / "test.cpp", R"cpp(#include <cstdio>
|
||||||
|
int main() {
|
||||||
|
std::FILE *f = std::fopen("case_a.txt", "wb");
|
||||||
|
if (!f) return 2;
|
||||||
|
std::fclose(f);
|
||||||
|
std::FILE *g = std::fopen("CASE_A.TXT", "rb");
|
||||||
|
if (!g) { std::printf("case-insensitive open failed\n"); return 1; }
|
||||||
|
std::fclose(g);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)cpp");
|
||||||
|
|
||||||
Platform::ProcessRequest req;
|
Platform::ProcessRequest req;
|
||||||
req.executable = vbs_bin;
|
req.executable = vbs_bin;
|
||||||
@@ -1113,6 +1122,52 @@ void build(Void::Build::Project &p) {
|
|||||||
}
|
}
|
||||||
Void::Testing::expect(std::filesystem::exists(tmp / "build" / "profiles" / "debug" / "out" /
|
Void::Testing::expect(std::filesystem::exists(tmp / "build" / "profiles" / "debug" / "out" /
|
||||||
"bin" / "winapp.exe"));
|
"bin" / "winapp.exe"));
|
||||||
|
|
||||||
|
// Case-insensitive output collisions and reserved device names are rejected for Windows.
|
||||||
|
const auto collision_proj = tmp / "collision_proj";
|
||||||
|
write_file(collision_proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||||
|
void build(Void::Build::Project &p) {
|
||||||
|
p.executable("Tool").sources({"main.cpp"});
|
||||||
|
p.executable("tool").sources({"main.cpp"});
|
||||||
|
}
|
||||||
|
)cpp");
|
||||||
|
write_file(collision_proj / "main.cpp", "int main() { return 0; }\n");
|
||||||
|
Platform::ProcessRequest collision_req = req;
|
||||||
|
collision_req.arguments = {"build",
|
||||||
|
"--project",
|
||||||
|
collision_proj.string(),
|
||||||
|
"--build-dir",
|
||||||
|
(tmp / "collision_build").string(),
|
||||||
|
"--target-os",
|
||||||
|
"windows"};
|
||||||
|
auto collision_res = Platform::run_supervised(collision_req);
|
||||||
|
Void::Testing::expect(collision_res.has_value() && !collision_res->succeeded());
|
||||||
|
if (collision_res) {
|
||||||
|
Void::Testing::expect(collision_res->stderr_data.find("differ only by case") !=
|
||||||
|
std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto reserved_proj = tmp / "reserved_proj";
|
||||||
|
write_file(reserved_proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||||
|
void build(Void::Build::Project &p) {
|
||||||
|
p.executable("CON").sources({"main.cpp"});
|
||||||
|
}
|
||||||
|
)cpp");
|
||||||
|
write_file(reserved_proj / "main.cpp", "int main() { return 0; }\n");
|
||||||
|
Platform::ProcessRequest reserved_req = req;
|
||||||
|
reserved_req.arguments = {"build",
|
||||||
|
"--project",
|
||||||
|
reserved_proj.string(),
|
||||||
|
"--build-dir",
|
||||||
|
(tmp / "reserved_build").string(),
|
||||||
|
"--target-os",
|
||||||
|
"windows"};
|
||||||
|
auto reserved_res = Platform::run_supervised(reserved_req);
|
||||||
|
Void::Testing::expect(reserved_res.has_value() && !reserved_res->succeeded());
|
||||||
|
if (reserved_res) {
|
||||||
|
Void::Testing::expect(reserved_res->stderr_data.find("reserved Windows device name") !=
|
||||||
|
std::string::npos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Plan 08: Modern C++ (GCC16 P1689 named modules + partitions, cycle/dup checks, unity, PCH)
|
// === Plan 08: Modern C++ (GCC16 P1689 named modules + partitions, cycle/dup checks, unity, PCH)
|
||||||
|
|||||||
Reference in new issue
Block a user