From 76756ccb3ab1f06a034878d6cb50672f5c8d1331 Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Wed, 23 Mar 2022 00:03:13 -0700 Subject: [PATCH] bootstrap.py: nixos check in /etc/os-release with quotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per https://www.freedesktop.org/software/systemd/man/os-release.html, > Variable assignment values must be enclosed in double or single quotes > if they include spaces, semicolons or other special characters outside > of A–Z, a–z, 0–9. (Assignments that do not include these special > characters may be enclosed in quotes too, but this is optional.) So, past `ID=nixos`, let's also check for `ID='nixos'` and `ID="nixos"`. One of these is necessary between nixos/nixpkgs#162168 and nixos/nixpkgs#164068, but this seems more correct either way. --- src/bootstrap/bootstrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 71b8f3c4553bc..0b6bdf474195d 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -678,7 +678,7 @@ def fix_bin_or_dylib(self, fname): # The latter one does not exist on NixOS when using tmpfs as root. try: with open("/etc/os-release", "r") as f: - if not any(line.strip() == "ID=nixos" for line in f): + if not any(l.strip() in ["ID=nixos", "ID='nixos'", 'ID="nixos"'] for l in f): return except FileNotFoundError: return