Commit graph

1397 commits

Author SHA1 Message Date
Florian Klink
1a99b10b7e refactor(tvix/eval): cargo clippy
This passes a unit value to the function.

Change-Id: I4df3ad8fb0f35c0f110cee3349971ae28ce2878c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9101
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-20 21:51:04 +00:00
Florian Klink
ded577a73b refactor(tvix/eval/io): cargo clippy &Path
Change-Id: Ifec2a4fc93c482e41ff5993183643b5126a7728b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9100
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-20 21:51:04 +00:00
Florian Klink
def773d4d5 refactor(tvix/eval): cargo clippy (len() is usize)
Change-Id: I9d931ffcc03c6df7c0392dbc1c9a4ae0e3804213
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9099
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-20 21:51:04 +00:00
Florian Klink
1f02dc7eba refactor(tvix/eval): cargo clippy &GenCo
Change-Id: I6b1b902ccbc12bf2acdb0fdf406d6ef336ff0b2f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9098
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2023-08-20 21:51:04 +00:00
Florian Klink
690884426b refactor(tvix/eval): derive default for value::AttrsRep enum
Change-Id: Iaeb9ed7024c2ce85373f8aec0d223f52e1a3a539
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9097
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-20 21:51:04 +00:00
Florian Klink
3ffbcc6c8a refactor(tvix/store): cargo clippy
Change-Id: I3a80560d036e7ed08036b5e9f0974080d1a30ded
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9096
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
2023-08-20 21:51:04 +00:00
Florian Klink
bc852fa56f refactor(tvix/nix_cli): cargo clippy
Change-Id: Ib48063660432bea9de2fc9aff5914ef76db3ad64
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9095
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-08-20 21:51:04 +00:00
Florian Klink
146175b83d refactor(tvix/cli): cargo clippy
Change-Id: I723bc9b29733f5ee4e3094b92696fbdeb4b15a33
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9094
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-08-20 21:43:02 +00:00
Florian Klink
600d4eec77 refactor(tvix/serde): cargo clippy
Change-Id: I3c86225040a04c9cb5702b226b4a5008ae219c42
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9093
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-20 21:43:01 +00:00
Florian Klink
9cb38c5ba5 refactor(tvix/cli): stop parsing NixHash twice
We already have the parsed output_hash from above, no need to construct
it again.

Change-Id: Ie6d924ab446137c25c29fbeaf671aa7e5418262d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9110
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-20 19:44:19 +00:00
Ryan Lahfa
2d687e068a fix(tvix/nix-compat): disallow empty derivation names
Yes:

```
$ nix-build -E 'derivation { name = ""; builder = "/bin/sh"; system = "x86_64-linux"; }'
error: store path 'nr7i5pf18hw2zg487vkdyrbasdqylfcj-' has an empty name
```

Change-Id: I552f9ed1c1fe3bfceca18ca9b8e13d4b06dc6ff7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9108
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-08-20 19:34:35 +00:00
Ryan Lahfa
d504b440c2 feat(tvix/nix-compat): don't swallow hash validation errors
Previously, Output deserialization would silence validation errors and
provide `None` for `hash_with_mode` as soon as a validation error would
happen inside of the `NixHashWithMode` deserialization, e.g. invalid
hash length would not provide an validation error but a silent `None`
value.

This is problematic, we workaround a serde limitation here by writing
our own Deserializer.

As you can see, we write some boilerplate code unfortunately, as, for
example:

- `#[serde(fail_if_unparsed_as="Option::is_none")]` is not a thing,
  otherwise, we could have been able to just bubble up errors in case of
  "not fully parsed" (and not missing) values.

- `From<&serde_json::Value> for serde:🇩🇪:Unexpected` is not a thing,
  otherwise, we could just map invalid type errors and reuse the
  existing types instead of doing extremely bizarre things with
  `serde:🇩🇪:Unexpected::Other`, note: this is a not problem for
  expected, we know what we expect, we don't know what we received in
  practice.

I decided to write a `NixHashWithMode::from_map` which will eat a map
deserialized via `serde_json`, so our serde magic is not totally "data
model" agnostic.

I wanted to go for data model agnosticity and enable maximal
performance, e.g. building the structure as the map values are streamed
in the Visitor, this is needlessly painful because `Output` and
`NixHashWithMode` are in different files and this really makes sense
only if we write the full implementation in one file, indeed, otherwise,
you end up duplicating the work or having strange coupling.

So, for now, we will allocate a full map of the fields inside the
`Output`, i.e. if any "unknown field" is in that map, we will
deserialize it for no reason.

Doing it properly, as I repeat it in the code and to flokli at C3Camp
2023, requires to patch serde upstream IMHO.

Change-Id: I46fe6ccb8c390c48d6934fd3e3f02a0dfe59557b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9107
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2023-08-20 19:34:20 +00:00
Florian Klink
bb48d8c61b refactor(tvix): drop rust-analyzer from rust-docs build inputs
We don't need rust-analyzer to run cargo doc.

Change-Id: I5e2fd559e4045cadeab24b438c28d6df7f1d5d5f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9092
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
2023-08-19 20:16:28 +00:00
Florian Klink
6abf20f56b docs(tvix): update comment
cl/8306 fixed building all docs, but we forgot to update the comment.

Change-Id: I17829612f13e7357bd0efe8223cc28ed0f6cdea2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9091
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-08-19 20:12:45 +00:00
Florian Klink
946270142e refactor(tvix/nix-compat/derivation): cargo clippy
This `.into_iter()` call is equivalent to `.iter()` and will not consume
the `BTreeMap`.

Change-Id: Ie26637ebecb0bea5b09c447cc45ed207f8b50913
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9088
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-08-19 11:47:48 +00:00
Florian Klink
311752412b docs(tvix/nix-compat/store_path): fix broken docstr reference
Change-Id: Ie95ac265f8707e138c6a7b529760650d211f259d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9087
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2023-08-19 11:41:26 +00:00
Florian Klink
999b2d6995 refactor(tvix/nix-compat/nixhash): use shorthand struct init
Change-Id: I1e52b752408a70fdb27e3e5c6f3bef5417b3e922
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9085
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
2023-08-19 11:37:46 +00:00
Florian Klink
b5ed3a90f2 docs(tvix/nix-compat): remove disambiguity
Don't import thiserror::Error directly, so rustdoc knows what
`crate::store_path::Error` we're talking about.

Change-Id: I755c9377521a6833e9a77cb1a41b48edafb31fe0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9086
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2023-08-19 11:27:45 +00:00
Florian Klink
39efe50311 refactor(tvix/nix-compat/derivation/escape): move to Vec<u8>
We only need bstr::ByteSlice to be able to use replace, it doesn't need
to return a BString.

Change-Id: I811948436fb89652e880970c2c05356183f3e439
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9084
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-08-19 10:54:32 +00:00
sterni
08a5849e2b chore(tvix/cli): delete unused NixCompatIO code
Change-Id: Icb91b102208fea512e04383ce9d65b0681af18ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9079
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2023-08-14 11:50:00 +00:00
Vincent Ambo
8478448146 fix(tvix/eval): fix a comment position in value::json
Change-Id: Ic58653254b36694f1991a18db9ceea0d532c2e31
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9068
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2023-08-13 15:58:38 +00:00
sterni
8fb4c949dc test(tvix/eval): check truncation direction of builtins.div
builtins.div ought to truncate towards zero so that

    -(builtins.div a b) == builtins.div (-a) b
    -(builtins.div a b) == builtins.div a (-b)

Change-Id: I8b7c08cd7f4fa8a1363c786d42c8d484f6cd133d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9006
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2023-08-11 22:22:30 +00:00
Vincent Ambo
fcda068235 feat(nix/sparseTree): add optional name argument
This allows pinning the name of the sparse tree derivation, which
stops the continous rebuilding of tvix-store-proto dependents.

I've opted to let the function take an attribute set instead and
refactored the call sites appropriately.

Change-Id: I3e57785094b1adbfffa24caf9f1c3384844fa200
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8965
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2023-08-08 20:11:56 +00:00
Florian Klink
f9fbc9be85 refactor(tvix/nix-compat/derivation/tests): fix typo
Change-Id: I764232378f79f16c781870d467469db91a2f14d2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9001
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-07-31 21:59:42 +00:00
Florian Klink
a10d1e7bdf refactor(tvix/nix-compat): use local write::*;
Change-Id: I43cc1d5b3419255f815490b2e10f05db19e3bffc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9000
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 21:59:42 +00:00
Florian Klink
edde496040 refactor(tvix/nix-compat/test): rename data identifier
Make it more obvious if these are bytes pointing to JSON or ATerm, so we
don't get confused.

Change-Id: I2402c687b7ba9c05aac20ed63b0df54e4e96a9d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8998
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 21:59:42 +00:00
Florian Klink
8258dbecdf refactor(tvix/nix-compat/derivation): drop some useless allocations
Change-Id: I85e44e24e9ec3fe4284f02623a1ac7ca9935e554
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8999
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 21:59:42 +00:00
Florian Klink
779fad29a1 refactor(tvix/nix-compat/derivation): use writer.write_all
This is more concise than a io::copy of a Cursor to bytes, and we have
everything to be written in memory.

Change-Id: I81f34666aa61aef4e16b33423ce4a69c3781efc3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8997
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-07-31 21:50:48 +00:00
Florian Klink
737a6ca01e refactor(tvix/cli/refscan): use wu-manber crate with &[u8] support
PR'ed at https://github.com/tvlfyi/wu-manber/pull/1, and now merged.

Change-Id: I8c71e359196396a1d42a3ea2ab7ac15b137b2db0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8992
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 21:50:47 +00:00
Florian Klink
aa1982c085 refactor(tvix/derivation): move comma writing business up
write_input_derivations shouldn't need to write a comma to separate it
from the previous output from write_outputs.
This is better placed in the function calling all of these helper
functions.

Change-Id: I9ccc440e4665b52369ef39e75151b9a29469ce48
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8995
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-07-31 21:50:44 +00:00
Florian Klink
3f856d8977 refactor(tvix/nix-compat/derivation): generic write_array_elements
We're happy with any &[S], as long as <S: AsRef<[u8]>.

This allows passing both strings and &[u8].

Change-Id: If2a80d9b1ee33ba328c9cdab4fa83ca7b98a71e2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8994
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-07-31 21:50:44 +00:00
Florian Klink
34b7620764 refactor(tvix/nix-compat/derivation): simplify
Let the escape function only take care of string escaping, not quoting.

Let write_array_elements always quote and escape strings it consumes.
Move the business of writing additional wrapping characters around it to
the caller.

Change-Id: Ib8dea69c409561b49862c531ba5a3fe6c2f061f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8993
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-07-31 21:41:39 +00:00
Florian Klink
79531c3dab refactor(tvix/nix-compat): support non-unicode Derivations
Derivations can have non-unicode strings in their env values, so the
ATerm representations are not necessarily String anymore, but Vec<u8>.

Change-Id: Ic23839471eb7f68d9c3c30667c878830946b6607
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8990
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
2023-07-31 21:41:38 +00:00
Florian Klink
9521df708f feat(nix-compat/store_path): implement PartialOrd and Ord
This allows sorting Store Paths. We delegate the sorting business to the
PartialOrd, Ord impls for our digest fields only, as two StorePaths with
the same digest, but different names can't exist.

Change-Id: I5f81631e5f5063893b316c63a240c5266b7e5bad
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8988
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 20:29:25 +00:00
Florian Klink
0dea3086f5 docs(tvix/cli/refscan): fix comment
The comment still mentions Aho-Corasick, which isn't correct.

Change-Id: I846a2ca9ea7075c2456ca6ef04a132ff6161227a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8991
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2023-07-31 09:01:34 +00:00
Florian Klink
92e976b3a9 chore(tvix/nix-compat): drop useless clone
HashAlgo implements Copy, no need to clone here.

Change-Id: Ief11d2cfbd4fd0cd44224c7ddd575f518edbbd55
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8989
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
2023-07-31 09:01:34 +00:00
Florian Klink
432222f098 feat(tvix/store/proto): use Bytes instead of Vec<u8>
Makes use of https://github.com/tokio-rs/prost/pull/341, which makes our
bytes field cheaper to clone.

It's a bit annoying to configure due to
https://github.com/hyperium/tonic/issues/908, but the workaround does
get the job done.

Change-Id: I25714600b041bb5432d3adf5859b151e72b12778
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8975
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
2023-07-22 09:03:02 +00:00
Florian Klink
7971d7d9ff feat(tvix/nix-compat/store_path): store position in InvalidName
Add the position in the string where the name is problematic.

Change-Id: If6fd8be6100b718f8d68568eafc77ebb3cfb82d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8979
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2023-07-21 19:06:30 +00:00
Florian Klink
a6580748aa feat(tvix/store/digests): use bytes::Bytes instead of Vec<u8>
This will save us some copies, because a clone will simply create an
additional pointer to the same data.

Change-Id: I017a5d6b4c85a861b5541ebad2858ad4fbf8e8fa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8978
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-07-21 19:01:50 +00:00
Florian Klink
72e82ffcb1 refactor(tvix/store): use bytes for node names and symlink targets
Some paths might use names that are not valid UTF-8. We should be able
to represent them.

We don't actually need to touch the PathInfo structures, as they need to
represent StorePaths, which come with their own harder restrictions,
which can't encode non-UTF8 data.

While this doesn't change any of the wire format of the gRPC messages,
it does however change the interface of tvix_eval::EvalIO - its
read_dir() method does now return a list of Vec<u8>, rather than
SmolStr. Maybe this should be OsString instead?

Change-Id: I821016d9a58ec441ee081b0b9f01c9240723af0b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8974
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
2023-07-21 19:01:49 +00:00
Florian Klink
638f3e874d feat(tvix/store/fuse): implement open explicitly
This "reverts" commit 9f600de226 (the
initial revert of f5e291cf83).

Now with BlobService returning a BlobReader that implements io::Seek, we
can actually just call blob_reader.seek(io::SeekFrom::Start(offset as
u64)).

This means, we currently will fail to seek backwards inside a file.

Change-Id: I9c19448df6831a3537252f99210374f2126ecfc0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8886
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-21 18:52:47 +00:00
Florian Klink
7613e2e769 feat(tvix/store/blobservice): implement seek
For memory and sled, it's trivial, as we already have a Cursor<Vec<u8>>.
For gRPC, we simply reject going backwards, and skip n bytes for now.

Once the gRPC protocol gets support for offsets and verified streaming,
this can be improved.

Change-Id: I734066a514aed287ea3db64bfb1680911ac1eeb0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8885
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2023-07-21 18:52:46 +00:00
Florian Klink
42dc18353d feat(tvix/nix-compat): have StorePath accept bytes
The primary constructor for this is now from_bytes, from_string is
simply calling .as_bytes() on the string, passing it along.

The InvalidName error now contains a Vec<u8>, to encode the invalid name
(which might not be a string anymore).

from_absolute_path now accepts a &[u8] (even though we might want to
make this a OSString of some sort).

StorePath::validate_name has been degraded to a pub(crate) function.
It's still used in src/derivation, even though it probably shouldn't at
all - that cleanup is left for cl/8412 though.

Change-Id: I6b4e62a6fa5c4bec13b535279e73444f0b83ad35
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8973
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-21 18:04:38 +00:00
Florian Klink
5364fcb127 feat(tvix/nix-compat): fold NameError into Error
This being a nested error makes things more complicated than necessary.

Also, this caused BuildStorePathError to only hold NameError,
so refactor these utility functions to either return Error, or
BuildStorePathError.

Change-Id: I046fb403780cc5135df8b8833a291fc2a90fd913
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8972
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
2023-07-21 18:04:38 +00:00
sterni
8adc9c56f2 docs(tvix): document when pointer equality is preserved in C++ Nix
This explicitly documents behavior of C++ Nix that goes against the
intuition you'd gather from this document: that e.g. a simple select
from an attribute set causes a value to no longer be pointer equal to
its former self.

The point of documenting this is that we can show in a to be written
section on the use of pointer equality in nixpkgs that pointer equality
is only needed in a limited sense for evaluating it (C++ Nix's exterior
pointer equality). Tvix's pointer equality is far more powerful since
value identity preserving operations also preserve pointer equality,
generally speaking (this is because we implement interior pointer
equality in my made up terminology). This should eventually also be
documented.

Change-Id: I6ce7ef2d67b012f5ebc92f9e81bba33fb9dce7d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8856
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
2023-07-11 16:17:42 +00:00
sterni
4ba624efae fix(tvix/eval): use byte, not codepoint index for slicing in escape
This fixes a subtle issue which would occasionally lead to a crash (e.g.
when evaluating (pkgs.systemd.outPath with --trace-runtime): With each
character in the string that has a multi byte representation in UTF-8,
the actual byte position and what tvix thought it was would get out of
sync. This could either lead to

* Tvix swallowing characters or jumbling characters if multi byte
  characters would cause the tracked index to become out of sync with
  the byte position before the first character to be escaped, or

* Tvix crashing if (in the same situation) the out of sync index would
  be within a UTF-8 byte sequence.

Luckily, std's `char_indices()` iterator implements exactly what
`nix_escape_char()`'s original author had in mind with
`.chars().enumerate()`. Using `i + 1` for continuing is safe, since all
characters that need (in fact, can) to be escaped in Nix are represented
as a single byte in UTF-8.

Change-Id: I1c836f70cde3d72db1c644e9112852f0d824715e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8952
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2023-07-11 16:11:40 +00:00
sterni
88b0545908 chore(3p/sources): Bump channels & overlays
* //tvix/store: update code generated from proto files

Change-Id: Ie6aa53e71f07a0a0e637673ba4005ed983db315d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8929
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2023-07-08 10:46:31 +00:00
DavHau
e751372f2f docs(tvix/store): various improvements
Improve change some little things I noticed while reading through it.

Change-Id: I033209eece395e5aad4e10825e8dd6c0cfe68191
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8725
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-07-07 09:48:32 +00:00
Florian Klink
c767460440 fix(tvix/store/fuse): fix log level for a debug message
Change-Id: Ib801e46636901553d71455a739aed34e5828ca0f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8888
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-07-02 11:40:29 +00:00
Florian Klink
2a601d26a8 docs(tvix/store/fuse/inodes): clippy lint
Change-Id: I7b1bcb9c0cca76f05271f25912d26b14152fe0c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8887
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
2023-07-02 11:18:52 +00:00