Skip to content

build: take the git revision from Nix when git is unavailable - #13

Merged
paveq merged 1 commit into
mainfrom
build/version-from-nix
Sep 22, 2026
Merged

paveq merged 1 commit into
mainfrom
build/version-from-nix

Conversation

@paveq

@paveq paveq commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

airlock --version reported 1.0.0 (unknown) from every Nix build. build.rs shells out to git rev-parse, and the Nix build sandbox has no git and builds from a store copy of the source with no .git directory, so both git calls fail and the fallback wins.

build.rs now prefers AIRLOCK_GIT_HASH / AIRLOCK_GIT_DIRTY when they are set, and the flake passes the revision Nix already resolved when it fetched the source. Cargo builds are unchanged: the variables are unset, so git is still consulted.

self.shortRev is only present for a clean checkout or a github: input; a dirty working tree provides dirtyShortRev instead, whose "-dirty" suffix is stripped because GIT_DIRTY already carries that. Both paths now render the same string cargo would for the same tree.

Claude-Session: https://claude.ai/code/session_01E3R8fS7y8zYjoEzjorYTBJ

`airlock --version` reported `1.0.0 (unknown)` from every Nix build.
[build.rs](build.rs) shells out to `git rev-parse`, and the Nix build
sandbox has no git and builds from a store copy of the source with no
`.git` directory, so both git calls fail and the fallback wins.

build.rs now prefers `AIRLOCK_GIT_HASH` / `AIRLOCK_GIT_DIRTY` when they
are set, and the flake passes the revision Nix already resolved when it
fetched the source. Cargo builds are unchanged: the variables are unset,
so git is still consulted.

`self.shortRev` is only present for a clean checkout or a `github:`
input; a dirty working tree provides `dirtyShortRev` instead, whose
"-dirty" suffix is stripped because `GIT_DIRTY` already carries that.
Both paths now render the same string cargo would for the same tree.

Claude-Session: https://claude.ai/code/session_01E3R8fS7y8zYjoEzjorYTBJ
@paveq paveq self-assigned this Sep 22, 2026
@paveq
paveq merged commit 5231299 into main Sep 22, 2026
3 of 4 checks passed
@paveq
paveq deleted the build/version-from-nix branch September 22, 2026 08:29
paveq added a commit that referenced this pull request Sep 23, 2026
CI fails now and then with "socket ... has insecure permissions 0o755".
It hit run_embedded_exits_on_cancel on #14 and
synchronous_startup_explicit_path_uses_parent_as_sandbox_root on #13.

The socket gets its mode from the umask at bind time, and the umask is
process-wide. synchronous_startup and four socket tests each did
umask(077) / bind / umask(old) with no lock, and cargo test runs them on
parallel threads. If one thread restores 022 between another thread's
swap and its bind, that socket comes out 0755. The post-bind check then
rightly refuses it.

The swap now lives in bind_owner_only, behind a static mutex, and
synchronous_startup and the tests both go through it. The lock is in
production code, not a test-only mutex, so the integration test
binaries that call synchronous_startup in parallel are covered too. The
real daemon binds before any other thread exists, so it never waits on
the lock.

Stress run of `daemon::` lib tests, 200 iterations at 16 threads: 5
failures before, 0 after.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant