diff options
| author | aur-build <aur-build@localhost> | 2026-11-21 15:50:41 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-21 15:50:41 +0000 |
| commit | f5d970494f77d39dadf7c7d5a6a3d70221ca2da2 (patch) | |
| tree | 13c9943c6e3740e1f829d038f48418097f05da04 /src/http/mod.rs | |
| parent | 92742f0e5d336547d8d72464e2df0ff1c4f2d337 (diff) | |
| download | aur-build-f5d970494f77d39dadf7c7d5a6a3d70221ca2da2.tar.gz aur-build-f5d970494f77d39dadf7c7d5a6a3d70221ca2da2.zip | |
src,sandbox,http: three more fields nobody read, and the check that missed them
A field scan that printed its first thirty lines missed the rest. Three `pub`
fields were written and never read: `SandboxSpec::disk_mb`, copied off
`cfg.min_free_disk_mb` into a spec no backend consulted — the dispatcher already
checks the disk itself, so the knob stayed live and the plumbing around it was
dead; `SandboxInfo::warm`, computed three ways by three backends and read by
nobody; and `Server::handle`, a `JoinHandle` stored and never joined, which is
what detaching a thread means and so was never load-bearing. All three are gone,
their construction sites with them.
Four more are written-but-never-read on purpose and now say so where they are
declared: `Identity::upstream_pins` and `source_digests` reach the identity
digest through `canonical_json`, not through a name; `VirtualClock::_owner` is
the lease, and holding it unread is the whole mechanism; the `Ab`/`Ba` pair in
`hash`'s canonical-json test exist to be serialized.
`the_test_helpers_are_used` only looked at `pub` items, which left the blanket
`allow(dead_code)` in `tests/common` exactly as able to hide a private helper as
a public one — the objection was fair, and planting
`fn planted_private_helper_never_used()` proved it passed while a dead private
helper sat in the file. It now scans private declarations too, and fails on both
the planted function and a planted struct.
Diffstat (limited to 'src/http/mod.rs')
| -rw-r--r-- | src/http/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 8a00745..c95cd16 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -102,7 +102,6 @@ impl Res { /// feature-conditional visibility. mod server { pub struct Server { - pub handle: std::thread::JoinHandle<()>, pub addr: String, } } @@ -124,7 +123,9 @@ pub fn spawn(cfg: Config, db: Db) -> std::io::Result<Server> { let addr = server.server_addr().to_ip().map(|a| a.to_string()).unwrap_or_else(|| cfg.bind.clone()); let state = Arc::new(State { cfg, db }); eprintln!("aur-build listening on http://{addr}"); - let handle = std::thread::Builder::new() + // Detached on purpose: the accept loop owns the listener and runs until the + // process ends, and nothing joins it, so the handle would be stored unread. + std::thread::Builder::new() .name("http-accept".into()) .spawn(crate::time::inherit(move || { for request in server.incoming_requests() { @@ -139,7 +140,7 @@ pub fn spawn(cfg: Config, db: Db) -> std::io::Result<Server> { .ok(); } }))?; - Ok(Server { handle, addr }) + Ok(Server { addr }) } fn serve(state: Arc<State>, mut request: tiny_http::Request) -> std::io::Result<()> { |
