coqPackages_8_20: fix sort instability - #418946
Closed
trofi wants to merge 1 commit into
Closed
Conversation
Without the change `builtins.sort` is not guaranteed to produce stable results across `nix` implementations or even `std::sort` implementations. With a small patch from NixOS/nix#12106 (comment) `nix` shows predicate instability as: $ nix eval --impure --expr 'with import ./. {}; coqPackages_8_20' --show-trace error: … while evaluating the attribute 'coqPackages_8_20' ... … while calling the 'sort' builtin at pkgs/development/coq-modules/metacoq/default.nix:13:48: 12| owner = "MetaCoq"; 13| defaultVersion = lib.switch coq.coq-version (lib.lists.sort (x: y: lib.versions.isLe x.out y.out) ( | ^ 14| lib.mapAttrsToList (out: case: { inherit case out; }) { error: !(a < a) assert failed The fix is to use strict `<` comparison rather than non-strict `<=` one.
13 tasks
Contributor
|
The issue is rather theoretical since comparison keys come from an attrset, hence are all distinct, but why not. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without the change
builtins.sortis not guaranteed to produce stable results acrossniximplementations or evenstd::sortimplementations.With a small patch from NixOS/nix#12106 (comment)
nixshows predicate instability as:The fix is to use strict
<comparison rather than non-strict<=one.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.