Skip to content

lib/systems/parse.nix: replicate cygwin/msvc parsing hack when unparsing#235229

Closed
ghost wants to merge 1 commit intomasterfrom
unknown repository
Closed

lib/systems/parse.nix: replicate cygwin/msvc parsing hack when unparsing#235229
ghost wants to merge 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented May 31, 2023

Description of changes

For about five years nixpkgs has parsed *-*-{cygwin,msvc} as if cygwin and msvc were ABIs for a common kernel (windows), rather than as kernels (which is how gnu-config rather counterintuitively treats them). This PR replicates the special-case parsing hack when unparsing, in order to ensure that (unparse . parse)==id.

These windows triples are probably used much more often in Nix expressions downstream of nixpkgs than in nixpkgs itself -- so we have really poor visibility on what kind of breakage would be caused by changing this treatment. Because most of the uses of this behavior are by now long-established and out-of-tree where we can't see them, I think it would be a bad idea to try to change this, and we should just grandfather the hack as a special exception.

Part of:

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

For almost a decade nixpkgs has parsed `*-*-{cygwin,msvc}` as being
ABIs for a common kernel (windows), rather than as kernels.  It
isn't really reasonable to change nixpkgs' handling at this point,
so this commit replicates the special-case hack when unparsing, in
order to ensure that `(unparse . parse)==id`.
@ghost ghost requested review from Ericson2314, alyssais and matthewbauer as code owners May 31, 2023 16:47
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 31, 2023
@roberth roberth added the 6.topic: lib The Nixpkgs function library label Jul 8, 2023
Copy link
Copy Markdown
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I wrote in the main PR (I missed this one before, whoops) I don't think we should do this.

windows-gnu I already fixed in GNU config, and with https://lists.gnu.org/archive/html/config-patches/2023-08/msg00011.html window-cygnus will be accepted too.

I would rather we keep on normalizing things in the way we do, and instead add these cases as tests where we explicitly choose to normalize in a different way (like x86_64-linux-gnu).

After a deprecation cycle, and fixing any downstream bugs in GCC etc., we can stop accepting ...-cygwin and ...-mingw32 if you like, so our deviation from GNU config is reduced.

Copy link
Copy Markdown
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll also add that since I made GNU config support ...-windows-gnu, this PR in fact does not get our parser closer to GNU config:

  • This PR normalizes ...-windows-gnu to ...-mingw32
  • GNU config does not, not normalizing either one to the other.

@ghost ghost closed this Oct 22, 2023
@ghost ghost deleted the pr/lib/systems/unparse-roundtrip branch October 22, 2023 06:38
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants