Repository navigation
switch-to-configuration-ng: /etc/os-release should not be required - #543312
Conversation
The comment
// This is a NixOS installation if it has /etc/NIXOS or a proper /etc/os-release.
said OR but the code implemented AND because it errored out
if `/etc/os-release` did not exist.
This was a regression from the Perl-to-Rust rewrite.
See NixOS#308801 (review)
Assisted-by: Claude Opus 4.8 in Zoo Code, human comment cleanup
|
|
|
This doesn't appear to change the logic from AND to OR |
It does. The code until now does let os_release = parse_os_release().context("Failed to parse os-release")?;
// This is a NixOS installation if it has /etc/NIXOS or a proper /etc/os-release.
if !Path::new("/etc/NIXOS").is_file()
&& !os_release
.get("ID")
.map(|id| distro_id_re.is_match(id))
.unwrap_or_default()
{
eprintln!("This is not a NixOS installation!");
die();
}
// continue hereThe code It implemented AND, not OR, because My PR changes that because with it, Thus, when let os_release = emptyMap;
// This is a NixOS installation if it has /etc/NIXOS or a proper /etc/os-release.
if false && whatever {
die();
}
// continue herethus |
Gotcha, thanks! It appears this isn't about the boolean logic, just whether or not the error handling is tolerant of /etc/os-release being missing or not. |
|
|
Successfully created backport PR for |
The comment
said OR but the code implemented AND because it errored out if
/etc/os-releasedid not exist.This was a regression from the Perl-to-Rust rewrite.
See #308801 (review)
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.