#16526·nix

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"
1

Steps 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


Add :+1: to issues you find important.