Lanzatool: respect configuration limit #34
No reviewers
Labels
No labels
bug
dependency
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
review-next
security
stub
tool
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
raito/lanzaboote!34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "configuration-limit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR enables setting a configuration limit for lanzatool via the
--configuration-limit
parameter.It includes
needed to be made to the flake to support the new lanzatool integration tests.
It is missing a NixOS integration test because it turns out these are really hard to implement with an out-of-tree module (and even nixpkgs does not contain any tests for the config limit).
I recommend review commit-by-commit.
Depends on #42
Nice! I especially like the tests. ❤️
You may want to keep this as
usize
to avoid the awkward conversion betweenu64
andusize
.@ -8,37 +8,71 @@ use nix::unistd::sync;
use tempfile::tempdir;
It would be helpful to add a comment why
RefCell
is necessary here. Did you lose against the borrow checker? :)nit: Technically this is a lossy conversion and that Rust allows this is sad. :) I tend to write
.try_into().unwrap()
when I don't explicitly intend a lossy conversion. Butconfiguration_limit
could just beusize
to begin with.You want
.sort_by_key(|l| l.version)
instead of implementingPartialEq
,Eq
andOrd
forGenerationLink
.The problem with your trait implementations is that they do not actually implement the traits as they are intended. Two
GenerationLink
instances will compare as equal even though they have different paths. This may be surprising in other circumstances.This function could use a comment that says that it outputs a UEFI filename, which is a bit non-obvious from the name alone.
There is no need to open the file. You can just do
fs:metadata(path)
.Why not propagate the error (with some context)?
Why not propagate the error?
@ -8,37 +8,71 @@ use nix::unistd::sync;
use tempfile::tempdir;
This is what I was looking for! I guess I was just overcome with small brain syndrome and didn't bother to look into a more elegant solution. Thanks for the pointer!
I guess my intuition was that I'd rather have an explicit type than usize. Thinking about it more, I don't really see a good reason for why u64 would be better.
There is no good reason why I didn't, just a leftover.
But is there a good reason to propagate the error in a test? My belief was that unwrap or expect is fine there.
This is a good suggestion. Since these changes were pulled out into a (now already merged) separate PR (#42), I have opened another PR which implements your requested changes: #43
See #43
See #43
Ah, yes. It's fine in the test. If you can, it's nice to propagate it anyway, because code tends to multiply and people take anything as template.
Can you add a developer-actionable error message somehow? Right now a developer not using our shell environment will see:
Alternatively a well placed comment in the code would also be ok.
@ -0,0 +100,4 @@
ID=lanzaos
NAME=LanzaOS
PRETTY_NAME="LanzaOS 23.05 (Goat)"
VERSION="23.05 (Goat)"
I really like the subtle change
Amazing <3.
@ -8,37 +8,71 @@ use nix::unistd::sync;
use tempfile::tempdir;
I thought interior mutability would be the right pattern here, so I don't have to pass the entire struct around as mutable. But, since RefCell also incurs a runtime penality making the entire struct mutable is probably better.
@blitz @RaitoBezarius thank you for the feedback!