Skip to content
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

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

ghost
Copy link

@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`.
Copy link
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants