nixos/systemd-boot: fix conditional, undefined variable#132688
Closed
cole-h wants to merge 2 commits intoNixOS:masterfrom
Closed
nixos/systemd-boot: fix conditional, undefined variable#132688cole-h wants to merge 2 commits intoNixOS:masterfrom
cole-h wants to merge 2 commits intoNixOS:masterfrom
Conversation
Prior to this change, the conditional would always be true for the system profile because `prof` would contain `"system"`, whereas everywhere else that considers the system profile uses `None`.
`profile` is undefined at this point; however it is part of the `gen` tuple, so access it through that. A `None` is converted to the string `"system"` to align with the conventions of the rest of the script: `None` profiles refer to the system profile, whereas anything else is some other profile by the specified name.
10 tasks
KaiHa
approved these changes
Aug 5, 2021
Contributor
KaiHa
left a comment
There was a problem hiding this comment.
Ran your code on my system. Creating and deleting profiles works fine. Invalid names are reported as expected.
|
Any news on this? I just ran into the issue unfortunately- - |
Mic92
reviewed
Dec 3, 2021
| @@ -162,7 +162,8 @@ def remove_old_entries(gens: List[Tuple[Optional[str], int]]) -> None: | |||
| else: | |||
| prof = "system" | |||
Member
There was a problem hiding this comment.
Should we than not just set this to None?
Suggested change
| prof = "system" | |
| prof = None |
Mic92
reviewed
Dec 3, 2021
| write_loader_conf(*gen) | ||
| except OSError as e: | ||
| print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr) | ||
| print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(gen[0] if gen[0] else "system", e), file=sys.stderr) |
Member
There was a problem hiding this comment.
Suggested change
| print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(gen[0] if gen[0] else "system", e), file=sys.stderr) | |
| profile = gen[0] or "system" | |
| print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr) |
13 tasks
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
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.
Motivation for this change
I was tinkering with
systemd-boot-builder.pyand noticed these two oddities. See the individual commits for rationale / reasoning.Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)N.B.: I don't actually use profiles, so if somebody who does could test this and report back, that would fantastic...