-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
os-release: preserve fields from being excessively quoted #164068
Conversation
I can also add lowercase, whitespace and other checks, just in case :D |
With this patch, ID field is generated correctly
|
This breaks a lot of existing checks for nixos, as it replaces ID=nixos with ID="nixos".
If checks are broken, they should be fixed as there is nothing wrong with having the fields without spaces quoted as you correctly point out:
Assignments that do not include these special characters may be enclosed in quotes too, but this is optional.
Having a hardcoded list of fields seems like a suboptimal way to solve it, so in order of preference:
1. fix the places that break because they assume a literal ID=nixos (just out curiosity what exactly breaks?)
2. if the value contains characters outside A–Z, a–z, 0–9, quote it - otherwise don't. And this should be regardless of the field.
A hardcoded workaround for 2 specific fields is not the way to go so NAK on this specific solution.
|
E.g rust-analyzer’s vscode extension (I patched it), Airshipper, probably many more unexpected scripts. |
I'd still argue that these downstream consumers are broken, but to avoid pissing off too many people, please change this to look for non-alphanummeric in the values and then write them out un-quoted in that case.
|
@peterhoeg please, re-review |
99108a2
to
a9007d1
Compare
(In cases it is unnecessary)
Thank you all! |
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.
bootstrap.py: nixos check in /etc/os-release with quotes 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.
bootstrap.py: nixos check in /etc/os-release with quotes 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.
Description of changes
Recent change made
ID=nixos
checks, used by many programs to patch static nixos binaries and other reasons, obsolete.This removes ID and ID_LIKE fields from being quoted — as quoting those
violatesshould never be necessary according to os-release file formatThings done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes