int overflow in builtins.compareVersions
Author: yorickvPCreated Sep 26, 2026Updated Sep 29, 2026
Labelsbug
Describe the bug
nix-repl> builtins.compareVersions "0" "2147483647"
-1
nix-repl> builtins.compareVersions "0" "2147483648"
1Steps To Reproduce
Expected behavior
Version 2147483648 should not wrap to a negative version.
Metadata
Nix 2.34.8
Additional context
Found using https://github.com/yorickvP/nix-pbt (property based testing of nix builtins), assisted by claude-opus-5.5.
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
- reviewed the contributing guide
Add :+1: to issues you find important.
Source: NixOS/nix