fix(cli): avoid Argparse default aliasing (Void/Library#62); record sanitizer run
This commit is contained in:
1 parent
4bd2999b49
commit
7756bd9f60
4 files changed
+30
-2
No files matched your search
@@ -302,6 +302,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
|
||||
- **Wave 104 (Competitor Benchmark Harness)**: `benchmarks/compare.sh` generates one C++ project and times VBS, CMake/Ninja and Meson cold and warm. First baseline (20 sources, 32 jobs): VBS 2578/209 ms, CMake configure 234 ms + build 98/9 ms, Meson setup 438 ms + compile 232/166 ms - VBS's per-invocation descriptor/toolchain work is the documented optimization target.
|
||||
|
||||
- **Wave 105 (Sanitizer Groundwork)**: an ASan+UBSan build (`build/asan`) runs `vbs_core_tests` 7/7 clean with leak detection. It exposed a real VoidLibrary bug - `Argparse::option_default` use-after-free when the default aliases the output - filed as [Void/Library#62](https://git.faumaray.com/Void/Library/issues/62) and worked around by de-aliasing the `gc`/`clean` call sites. Full-binary ASan testing is limited because descriptor compilation does not inherit sanitizer flags (recorded as tooling work).
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -108,4 +108,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 102 (VoidLibrary migration trial) | Separate-clone `build.cpp` builds and tests VoidLibrary with VBS; assets in `contrib/voidlibrary-migration/`; upstream issue #61 | VERIFIED IN CLONE (23 actions, `vbs test` PASSED; no CMake) | `contrib/voidlibrary-migration/`, docs |
|
||||
| Wave 103 (JUnit & test timeout) | `vbs test --junit FILE --test-timeout SECONDS` with aggregated JUnit XML | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; JUnit assertions and CLI contract pass, full CTest 8/8) | `src/Main.cpp`, `tests/{FullV1Tests,CliContracts}.cpp/cmake`, docs |
|
||||
| Wave 104 (Competitor benchmark harness) | `benchmarks/compare.sh` timing VBS vs CMake/Ninja vs Meson; baseline recorded | COMPLETE & VERIFIED (baseline observed; VBS 2578/209 ms vs CMake 98/9 ms on a 20-source fixture) | `benchmarks/compare.sh`, `docs/roadmap/22-superiority-and-gaps.md`, docs |
|
||||
| Wave 105 (Sanitizer groundwork) | ASan+UBSan build runs core tests clean; found and filed Void/Library#62 (Argparse aliasing UAF) with a de-aliasing workaround | COMPLETE & VERIFIED (core 7/7 under ASan; normal CTest 8/8) | `src/Main.cpp`, `docs/agent-workflow/VERIFICATION.md`, Void/Library#62 |
|
||||
| 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) |
|
||||
@@ -1475,6 +1475,27 @@ invocations. VBS is slower on this small fixture because every invocation recomp
|
||||
description; the numbers are recorded in [22](../roadmap/22-superiority-and-gaps.md) as the
|
||||
optimization target.
|
||||
|
||||
## Sanitizer Groundwork (ASan + UBSan, GCC 16.2, pin `0002e74`)
|
||||
|
||||
```sh
|
||||
dev cpp-gcc -c cmake -S . -B build/asan -G Ninja -DCMAKE_BUILD_TYPE=Debug -DVBS_VOID_SOURCE_DIR=/tmp/opencode/vl-pin \
|
||||
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
|
||||
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
|
||||
dev cpp-gcc -c cmake --build build/asan --parallel 8
|
||||
ASAN_OPTIONS=detect_leaks=1 build/asan/bin/vbs_core_tests --no-color
|
||||
```
|
||||
|
||||
- `vbs_core_tests` under ASan+UBSan with leak detection: **7 / 7 passed**, no sanitizer reports.
|
||||
- Found and filed a real library bug: [Void/Library#62](https://git.faumaray.com/Void/Library/issues/62)
|
||||
- `Argparse::option_default` is a heap-use-after-free when `default_value` aliases `out`
|
||||
(`vbs --version` reproduced it). The two aliasing call sites in `Main.cpp` (`gc`, `clean`) now
|
||||
pass a separate default copy, and `vbs --version` is ASan-clean.
|
||||
- Limitation: full CLI E2E under ASan is blocked because the out-of-process descriptor compile
|
||||
does not inherit the sanitizer flags while it links the instrumented SDK archive; this is
|
||||
recorded as tooling work (propagate sanitizer flags to descriptor compilation), not a code bug.
|
||||
- Normal build CTest after the fix: **8 / 8 passed** in 278.59 s.
|
||||
|
||||
## 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).
|
||||
|
||||
+6
-2
@@ -2886,11 +2886,15 @@ int main(int argc, char **argv) {
|
||||
BridgeCmdOptions bridge_opts;
|
||||
GcCmdOptions gc_opts;
|
||||
gc_opts.build_arg = (std::filesystem::path{cwd} / "build").string();
|
||||
// Separate copies: Argparse's option_default must not alias `default_value` with `out`
|
||||
// (Void/Library reads the view after assigning to out).
|
||||
const std::string gc_default_build = gc_opts.build_arg;
|
||||
GenTestsCmdOptions gen_tests_opts;
|
||||
InitCmdOptions init_opts;
|
||||
init_opts.dir_arg = cwd;
|
||||
CleanCmdOptions clean_opts;
|
||||
clean_opts.build_arg = (std::filesystem::path{cwd} / "build").string();
|
||||
const std::string clean_default_build = clean_opts.build_arg;
|
||||
GraphCmdOptions graph_opts;
|
||||
graph_opts.project_arg = cwd;
|
||||
IdeCmdOptions ide_opts;
|
||||
@@ -3210,7 +3214,7 @@ int main(int argc, char **argv) {
|
||||
root.subcommand("gc", "Recover interrupted state and garbage-collect unreferenced blobs");
|
||||
gc_cmd
|
||||
.option_default("--build-dir", "-B", "Build directory", gc_opts.build_arg,
|
||||
gc_opts.build_arg)
|
||||
gc_default_build)
|
||||
.option_default("--max-bytes", "",
|
||||
"Target maximum retained CAS bytes (0=unreferenced only)",
|
||||
gc_opts.max_bytes_arg, "0");
|
||||
@@ -3238,7 +3242,7 @@ int main(int argc, char **argv) {
|
||||
root.subcommand("clean", "Remove generated profile build artifacts (preserving cache)");
|
||||
clean_cmd
|
||||
.option_default("--build-dir", "-B", "Build directory", clean_opts.build_arg,
|
||||
clean_opts.build_arg)
|
||||
clean_default_build)
|
||||
.flag("--all", "", "Also delete .vbs cache, snapshots, and state store",
|
||||
clean_opts.clean_all);
|
||||
add_log_flags(clean_cmd);
|
||||
|
||||
Reference in new issue
Block a user