Skip to content

Commit b61f186

Browse files
committed
fix: explicit PRINTABLE_BINARY_MAP notice (Zig+FFI); drop stale PROJECT_STRUCTURE.md
The Zig and FFI builds use a compiled-in map and cannot honor a runtime PRINTABLE_BINARY_MAP file (the C/Lua/Node builds load the map at runtime). The audit flagged that both *silently* ignored it; now they print a one-line notice pointing to the C/Lua/Node builds for custom maps. (Full runtime-map support in the comptime-optimized Zig core is a larger deferred change.) Also remove PROJECT_STRUCTURE.md (stale — listed test_all/test_wasm etc. that no longer exist); per-file purpose docs will come from the dirtree pass.
1 parent 44fce29 commit b61f186

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/printable_binary_ffi_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ int main(int argc, char *argv[]) {
471471
const char *prog_name = argv[0] ? argv[0] : "printable-binary";
472472
bool stats_enabled = !env_var_truthy(getenv("PRINTABLE_BINARY_MUTE_STATS"));
473473

474+
if (getenv("PRINTABLE_BINARY_MAP") != NULL) {
475+
fprintf(stderr, "Warning: PRINTABLE_BINARY_MAP is ignored by the FFI build (compiled-in map); use the C, Lua, or Node build for custom maps.\n");
476+
}
474477
if (opts.help_mode) {
475478
print_usage(prog_name);
476479
return 0;

src/zig/main.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,14 @@ pub fn main(init: std.process.Init) !void {
546546
return;
547547
}
548548

549+
// The Zig build uses a compiled-in map and cannot honor a runtime PRINTABLE_BINARY_MAP
550+
// file (unlike the C/Lua/Node builds). Say so explicitly instead of silently ignoring it.
551+
if (g_environ_map) |env| {
552+
if (env.get("PRINTABLE_BINARY_MAP")) |_| {
553+
rawWriteAll(std.Io.File.stderr(), "Warning: PRINTABLE_BINARY_MAP is ignored by the Zig build (compiled-in map); use the C, Lua, or Node build for custom maps.\n");
554+
}
555+
}
556+
549557
if (opts.mappings_mode != .none) {
550558
try printMappings(opts.mappings_mode);
551559
return;

0 commit comments

Comments
 (0)