fix: stack overflow on Linux + conditional codesign#86
Merged
justrach merged 2 commits intojustrach:mainfrom Apr 1, 2026
Merged
fix: stack overflow on Linux + conditional codesign#86justrach merged 2 commits intojustrach:mainfrom
justrach merged 2 commits intojustrach:mainfrom
Conversation
- build.zig: make macOS codesign step conditional (skip on Linux) - src/main.zig: trampoline through 64MB stack thread to avoid ~33MB stack frame overflow from Zig inlining all command branches
- scripts/codedb-cli: bash CLI client for the HTTP daemon (~14-21ms queries) - scripts/codedb.service: template systemd user service for persistent daemon - docs/cli.md: documentation for the daemon + CLI approach - .gitignore: exclude codedb.snapshot (machine-specific)
Owner
Security & Code Review — Tested in turbobox sandboxReviewed the full diff and tested the build + all CLI commands inside an isolated turbobox sandbox (Hetzner AX41 bare metal, Zig 0.15.2, Alpine Linux). Code changes reviewed
No malicious code found
Test results (turbobox sandbox)Verdict: Safe to merge. All changes are minimal, correct, and well-documented. The two bugs (stack overflow + codesign) are real issues that this PR fixes properly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
codedb fails to build and run on Linux:
build.zigunconditionally runscodesign, which doesn't exist on Linux → build failssrc/main.zig— Zig inlines all command branches intomain(), creating a ~33MB stack frame that overflows the default 16MB Linux stack → segfault on startupFix
build.zig: Gate the codesign step ontarget.result.os.tag == .macossrc/main.zig: Trampoline through a spawned thread with 64MB stack (std.Thread.spawnwith.stack_size = 64 * 1024 * 1024)Tested
tree,outline,find,search,word,hot,serve,mcp,snapshotzig build test) — 5 pre-existing failures (perf regression + git-related)