From ca1ede17cba6d029a8b60d5328ca51a43098491f Mon Sep 17 00:00:00 2001 From: edef Date: Mon, 9 Oct 2023 17:51:19 +0000 Subject: docs(tvix/nix-compat): document the name ordering requirement Change-Id: Ia2c5f0b357a23d4bfac1fd52cf01845c78ebfa22 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9612 Autosubmit: edef Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/nix-compat/src/nar/writer/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tvix/nix-compat/src') diff --git a/tvix/nix-compat/src/nar/writer/mod.rs b/tvix/nix-compat/src/nar/writer/mod.rs index 71625420cc19..ffc1a9f30e8e 100644 --- a/tvix/nix-compat/src/nar/writer/mod.rs +++ b/tvix/nix-compat/src/nar/writer/mod.rs @@ -163,6 +163,10 @@ impl<'a, 'w> Directory<'a, 'w> { /// /// The entry is simply another [`Node`], which can then be filled like the /// root of a NAR (including, of course, by nesting directories). + /// + /// It is the caller's responsibility to ensure that directory entries are + /// written in order of ascending name. If this is not ensured, this method + /// may panic or silently produce invalid archives. pub fn entry(&mut self, name: &[u8]) -> io::Result> { debug_assert!( name.len() <= wire::MAX_NAME_LEN, -- cgit 1.4.1