| 26 Dec 2024 |
Sergei Zimmerman (xokdvium) | Yeah, that makes more sense. Though I hope there could be a better way to find the broken usages in nixpkgs. Unspecified result makes the eval non-deterministic by nature. Does this mean that if this bug gets fixed and replaced with unspecified order instead of C++ UB nixpkgs would suddenly eval differently? | 10:37:58 |
@aloisw:julia0815.de | I don't think it is possible to determine in general whether a given comparator is broken. And I think literally depending on C++ UB is one of the cases where breaking evaluation compatibility is acceptable. | 10:40:06 |
Sergei Zimmerman (xokdvium) | At the very least we could first trace the problematic usages with a custom cppnix build and evaluate the scope of the disaster. Checking strict weak order properties by hand + random shuffling before the sort should surface at least some problems. | 10:43:29 |
Sergei Zimmerman (xokdvium) | Though random shuffling would have to preserve the order, since the sort is stable. | 10:44:30 |
@aloisw:julia0815.de | How do you know what the problematic usages are in the first place? | 10:44:43 |
Sergei Zimmerman (xokdvium) | See the original https://github.com/NixOS/nix/issues/12106#issue-2759417825 issue. I just reproduced the problem on my end on nixpkgs master (9a90c6b6218860ab29f79ecd6213c3a547c15c7e):
../nixpkgs-check-strict-weak-order/result/bin/nix-env -qa --json --arg config 'import pkgs/top-level/packages-config.nix'
/nix/store/4KRAB2H0HD4WVXXMSCXRW21PL77J4I7J-gcc-13.3.0/include/c++/13.3.0/bits/stl_algo.h:5117:
In function:
void std::stable_sort(_RAIter, _RAIter, _Compare) [with _RAIter =
nix::Value**; _Compare = nix::prim_sort(EvalState&, PosIdx, Value**,
Value&)::<lambda(nix::Value*, nix::Value*)>]
Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
Objects involved in the operation:
instance "functor" @ 0x7ffff3cb8c90 {
type = nix::prim_sort(nix::EvalState&, nix::PosIdx, nix::Value**, nix::Value&)::{lambda(nix::Value*, nix::Value*)#1};
}
iterator::value_type "ordered type" {
type = nix::Value*;
}
[1] 2675868 abort (core dumped) ../nixpkgs-check-strict-weak-order/result/bin/nix-env -qa --json --arg config
| 11:14:58 |
Sergei Zimmerman (xokdvium) | I'm not sure that if that actually explodes with normal usage though | 11:26:03 |
Sergei Zimmerman (xokdvium) | A quick glance also shows that this gets triggered in tests.coq, so this is not a one-off problem:
nix-instantiate -A tests.coq
/nix/store/4KRAB2H0HD4WVXXMSCXRW21PL77J4I7J-gcc-13.3.0/include/c++/13.3.0/bits/stl_algo.h:5117:
In function:
void std::stable_sort(_RAIter, _RAIter, _Compare) [with _RAIter =
nix::Value**; _Compare = nix::prim_sort(EvalState&, PosIdx, Value**,
Value&)::<lambda(nix::Value*, nix::Value*)>]
Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
Objects involved in the operation:
instance "functor" @ 0x7ffc7a9bef10 {
type = nix::prim_sort(nix::EvalState&, nix::PosIdx, nix::Value**, nix::Value&)::{lambda(nix::Value*, nix::Value*)#1};
}
iterator::value_type "ordered type" {
type = nix::Value*;
}
[1] 2713634 abort (core dumped) nix-instantiate -A tests.coq
| 11:44:28 |
trofi | https://bpa.st/raw/JNGQ allows a bit better exception reporting. like https://bpa.st/raw/NBNQ | 11:52:31 |
Sergei Zimmerman (xokdvium) | Thanks! I guess it's just up to someone to rain nixmas gifts of bugfixes on nixpkgs. | 11:59:34 |
| elikoga changed their display name from elikoga to elikoga (@38c3 📞448{0,1}. | 15:21:56 |
| elikoga changed their display name from elikoga (@38c3 📞448{0,1} to elikoga (@38c3 📞448{0,1}). | 15:26:08 |
| elikoga changed their display name from elikoga (@38c3 📞448{0,1}) to elikoga (@38c3 📞488{0,1}). | 15:26:50 |
trofi | Example fix: https://github.com/NixOS/nixpkgs/pull/368366 | 15:49:49 |
| @interacsion:matrix.org joined the room. | 18:59:31 |
| Carter Zhang[M] joined the room. | 22:55:39 |
Carter Zhang[M] | Hello everyone, I just sudo apt install nix-bin and followed the steps mentioned in cat /usr/share/doc/nix-bin/README.Debian. What's next? | 22:56:56 |
trofi | * Example fix: https://github.com/NixOS/nixpkgs/pull/368366 (and also https://github.com/NixOS/nixpkgs/pull/368429 and https://github.com/NixOS/nixpkgs/pull/368433). | 23:15:07 |
| 27 Dec 2024 |
Perchun Pak [don't ping; dm instead] | In reply to @czl92783719:mozilla.org Hello everyone, I just sudo apt install nix-bin and followed the steps mentioned in cat /usr/share/doc/nix-bin/README.Debian. What's next? Nix pills are a good way to learn nix
https://nixos.org/guides/nix-pills/ | 06:36:02 |
Carter Zhang[M] | In reply to @perchun:matrix.org Nix pills are a good way to learn nix
https://nixos.org/guides/nix-pills/ Thanks | 06:36:39 |
| raitobezarius changed their display name from raitobezarius to raitobezarius (DECT: 3538 / EPVPN 2681). | 07:30:29 |
| tilpner changed their display name from tilpner to tilpner (38c3 3209). | 09:40:23 |
| garbas left the room. | 10:29:05 |
| Dimitar set a profile picture. | 11:41:07 |
| Dimitar changed their display name from dimitarnestorov to Dimitar. | 11:42:17 |
| 28 Dec 2024 |
| @ronnypfannschmidt:matrix.org left the room. | 17:57:34 |
| matthewcroughan changed their display name from matthewcroughan to matthewcroughan (DECT: 56490). | 18:55:44 |
| 29 Dec 2024 |
| anund_ joined the room. | 04:43:12 |
| sinan changed their profile picture. | 07:27:55 |
| elikoga changed their display name from elikoga (@38c3 📞488{0,1}) to elikoga (@38c3 📞488{0,1,9}). | 11:03:22 |