about summary refs log tree commit diff
path: root/tvix/nix-compat/src/nar/mod.rs
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2024-05-07T08·33+0000
committeredef <edef@edef.eu>2024-05-08T04·44+0000
commitebad318ab3accf34dff84a49d18b96a7efd15c22 (patch)
tree0f9b55e497e6dd2003c81c77c36ffcf31bff7de4 /tvix/nix-compat/src/nar/mod.rs
parent0472b55b2009825e761ace8d17475d7f057ac924 (diff)
fix(nix-compat/wire/bytes/reader): always read trailer tag data r/8085
Even if we have an aligned (or zero) size (and thus have no padding),
we may still have a non-padding trailer.

Since an exact read of only the user data bytes must always read the
trailer bytes as well, this has to happen for aligned sizes too.

For zero-sized trailers, we solve this by reading immediately, since no
read is required of the user at all.

user_len thus becomes a NonZeroU64, and the definition of "body data"
is adjusted to always exclude the final block.

Change-Id: I2c6bb51270fb22ad72a65076a3468673ab56ef68
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11597
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat/src/nar/mod.rs')
-rw-r--r--tvix/nix-compat/src/nar/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/nix-compat/src/nar/mod.rs b/tvix/nix-compat/src/nar/mod.rs
index 058977f4fcd1..c678d26ffb38 100644
--- a/tvix/nix-compat/src/nar/mod.rs
+++ b/tvix/nix-compat/src/nar/mod.rs
@@ -1,4 +1,4 @@
-mod wire;
+pub(crate) mod wire;
 
 pub mod reader;
 pub mod writer;