-
Notifications
You must be signed in to change notification settings - Fork 249
Fix bug when comparing profile item added by store path #1422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33692fa
to
478b1ab
Compare
7cea54a
to
46827ab
Compare
savil
approved these changes
Aug 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
478b1ab
to
e53d6e1
Compare
51345c7
to
a2ec7a2
Compare
Signed-off-by: Rodrigo Ipince <[email protected]>
mikeland73
added a commit
that referenced
this pull request
Sep 12, 2023
## Summary ProfileListIndex was broken for raw flakes. This would break `devbox update` I could have left the `return -1, errors.Wrap(nix.ErrPackageNotFound, args.Package.String())` inside the if statement, but it seems safer to just to attempt the slow matching instead of returning an error and only returning an error after all matching fails. Blame PR: #1422 ## How was it tested? ```bash devbox add github:F1bonacc1/process-compose/v0.43.1 devbox update ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When an package is added by store path, we can no longer recover the original package from the profile item itself, because the only information we have is the nix store path. So, some comparisons where we were trying to find if a profile item matched a devbox package were broken.
Here we introduce a
Item.Matches(Package)
function to return true if the item was installed from the package. It attempts to hide the complexity of whether the item was installed by store path or not inside it, so callers don't have to worry about it. Modified the callsites toToPackage()
to useMatches
instead, which simplified some logic.Also added a
len == 0
check to calls tonix profile remove
, since I noticed we were sometimes calling it with no arguments. No failures here, but just wasted time.How was it tested?
Manually tested by adding/removing packages and logging all the profile-related calls and item/package comparisons.