Loading pkgs/tools/package-management/lix/default.nix +0 −7 Original line number Diff line number Diff line Loading @@ -224,13 +224,6 @@ lib.makeExtensible ( hash = "sha256-rbf0ptj4BTSwsitKQu3FuaiJwhNDePGBeBJovm5HLdQ="; }; patches = [ # Bumping to toml11 ≥4.0.0 makes integer parsing throw (as it should) instead of saturate on overflow. # However, the updated version is not in nixpkgs yet, and the released versions still have the saturation bug. # Hence reverting the bump for now seems to be the least bad option. ./revert-toml11-bump.patch ]; cargoDeps = rustPlatform.fetchCargoVendor { name = "lix-${version}"; inherit src; Loading pkgs/tools/package-management/lix/revert-toml11-bump.patchdeleted 100644 → 0 +0 −192 Original line number Diff line number Diff line diff --git a/doc/manual/rl-next/toml-number-overflow.md b/doc/manual/rl-next/toml-number-overflow.md deleted file mode 100644 index 1522213cb4..0000000000 --- a/doc/manual/rl-next/toml-number-overflow.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -synopsis: Reject overflowing TOML integer literals -issues: [] -cls: [3916] -category: "Breaking Changes" -credits: [emilazy] ---- - -The toml11 library used by Lix was updated. The new -version aligns with the [TOML v1.0.0 specification’s -requirement](https://toml.io/en/v1.0.0#integer) to reject integer -literals that cannot be losslessly parsed. This means that code like -`builtins.fromTOML "v=0x8000000000000000"` will now produce an error -rather than silently saturating the integer result. diff --git a/lix/libexpr/primops/fromTOML.cc b/lix/libexpr/primops/fromTOML.cc index 9d4b5e6abf..3e26773eac 100644 --- a/lix/libexpr/primops/fromTOML.cc +++ b/lix/libexpr/primops/fromTOML.cc @@ -65,10 +65,13 @@ val, toml::parse( tomlStream, - "fromTOML", /* the "filename" */ + "fromTOML" /* the "filename" */ +#if HAVE_TOML11_4 + , toml::spec::v( 1, 0, 0 ) // Be explicit that we are parsing TOML 1.0.0 without extensions +#endif ) ); } catch (std::exception & e) { // NOLINT(lix-foreign-exceptions) // TODO: toml::syntax_error diff --git a/meson.build b/meson.build index 7b229ccefb..d4a36eb285 100644 --- a/meson.build +++ b/meson.build @@ -363,7 +363,10 @@ dependency('gmock_main', required : enable_tests, include_type : 'system'), ] -toml11 = dependency('toml11', version : '>=4.0.0', required : true, method : 'cmake', include_type : 'system') +toml11 = dependency('toml11', version : '>=3.7.0', required : true, method : 'cmake', include_type : 'system') +configdata += { + 'HAVE_TOML11_4': toml11.version().version_compare('>= 4.0.0').to_int(), +} pegtl = dependency( 'pegtl', diff --git a/misc/toml11.nix b/misc/toml11.nix deleted file mode 100644 index c53be3da1b..0000000000 --- a/misc/toml11.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - cmake, -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "toml11"; - version = "4.4.0"; - - src = fetchFromGitHub { - owner = "ToruNiina"; - repo = "toml11"; - rev = "v${finalAttrs.version}"; - hash = "sha256-sgWKYxNT22nw376ttGsTdg0AMzOwp8QH3E8mx0BZJTQ="; - }; - - nativeBuildInputs = [ - cmake - ]; - - meta = with lib; { - homepage = "https://github.com/ToruNiina/toml11"; - description = "TOML for Modern C++"; - longDescription = '' - toml11 is a C++11 (or later) header-only toml parser/encoder depending - only on C++ standard library. - - - It is compatible to the latest version of TOML v1.0.0. - - It is one of the most TOML standard compliant libraries, tested with - the language agnostic test suite for TOML parsers by BurntSushi. - - It shows highly informative error messages. - - It has configurable container. You can use any random-access containers - and key-value maps as backend containers. - - It optionally preserves comments without any overhead. - - It has configurable serializer that supports comments, inline tables, - literal strings and multiline strings. - - It supports user-defined type conversion from/into toml values. - - It correctly handles UTF-8 sequences, with or without BOM, both on posix - and Windows. - ''; - license = licenses.mit; - maintainers = with maintainers; [ ]; - platforms = platforms.unix ++ platforms.windows; - }; -}) diff --git a/package.nix b/package.nix index eb0e5c602a..c1c948ee7e 100644 --- a/package.nix +++ b/package.nix @@ -55,8 +55,6 @@ rustc, sqlite, systemtap-lix ? __forDefaults.systemtap-lix, - # FIXME: remove default after dropping NixOS 25.05 - toml11-lix ? __forDefaults.toml11-lix, toml11, util-linuxMinimal ? utillinuxMinimal, utillinuxMinimal ? null, @@ -117,9 +115,6 @@ build-release-notes = callPackage ./maintainers/build-release-notes.nix { }; passt-lix = callPackage ./misc/passt.nix { }; - - toml11-lix = - if lib.versionOlder toml11.version "4.4.0" then callPackage ./misc/toml11.nix { } else toml11; }, }: @@ -344,7 +339,7 @@ libarchive boost lowdown - toml11-lix + toml11 pegtl capnproto dtrace-headers diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-fail-overflow.err.exp b/tests/functional2/lang/fromTOML-overflowing/eval-fail-overflow.err.exp deleted file mode 100644 index 0c90e85edf..0000000000 --- a/tests/functional2/lang/fromTOML-overflowing/eval-fail-overflow.err.exp +++ /dev/null @@ -1,13 +0,0 @@ -error: - … while calling the 'fromTOML' builtin - at /pwd/in.nix:1:1: - 1| builtins.fromTOML ''attr = 9223372036854775808'' - | ^ - 2| - - error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63 - --> fromTOML - | - 1 | attr = 9223372036854775808 - | ^-- must be < 2^63 - diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-fail-underflow.err.exp b/tests/functional2/lang/fromTOML-overflowing/eval-fail-underflow.err.exp deleted file mode 100644 index a287e18655..0000000000 --- a/tests/functional2/lang/fromTOML-overflowing/eval-fail-underflow.err.exp +++ /dev/null @@ -1,13 +0,0 @@ -error: - … while calling the 'fromTOML' builtin - at /pwd/in.nix:1:1: - 1| builtins.fromTOML ''attr = -9223372036854775809'' - | ^ - 2| - - error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63 - --> fromTOML - | - 1 | attr = -9223372036854775809 - | ^-- must be < 2^63 - diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-okay-overflow.out.exp b/tests/functional2/lang/fromTOML-overflowing/eval-okay-overflow.out.exp new file mode 100644 index 0000000000..e241ca9ba4 --- /dev/null +++ b/tests/functional2/lang/fromTOML-overflowing/eval-okay-overflow.out.exp @@ -0,0 +1,1 @@ +{ attr = 9223372036854775807; } diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-okay-underflow.out.exp b/tests/functional2/lang/fromTOML-overflowing/eval-okay-underflow.out.exp new file mode 100644 index 0000000000..83b822591f --- /dev/null +++ b/tests/functional2/lang/fromTOML-overflowing/eval-okay-underflow.out.exp @@ -0,0 +1,1 @@ +{ attr = -9223372036854775808; } Loading
pkgs/tools/package-management/lix/default.nix +0 −7 Original line number Diff line number Diff line Loading @@ -224,13 +224,6 @@ lib.makeExtensible ( hash = "sha256-rbf0ptj4BTSwsitKQu3FuaiJwhNDePGBeBJovm5HLdQ="; }; patches = [ # Bumping to toml11 ≥4.0.0 makes integer parsing throw (as it should) instead of saturate on overflow. # However, the updated version is not in nixpkgs yet, and the released versions still have the saturation bug. # Hence reverting the bump for now seems to be the least bad option. ./revert-toml11-bump.patch ]; cargoDeps = rustPlatform.fetchCargoVendor { name = "lix-${version}"; inherit src; Loading
pkgs/tools/package-management/lix/revert-toml11-bump.patchdeleted 100644 → 0 +0 −192 Original line number Diff line number Diff line diff --git a/doc/manual/rl-next/toml-number-overflow.md b/doc/manual/rl-next/toml-number-overflow.md deleted file mode 100644 index 1522213cb4..0000000000 --- a/doc/manual/rl-next/toml-number-overflow.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -synopsis: Reject overflowing TOML integer literals -issues: [] -cls: [3916] -category: "Breaking Changes" -credits: [emilazy] ---- - -The toml11 library used by Lix was updated. The new -version aligns with the [TOML v1.0.0 specification’s -requirement](https://toml.io/en/v1.0.0#integer) to reject integer -literals that cannot be losslessly parsed. This means that code like -`builtins.fromTOML "v=0x8000000000000000"` will now produce an error -rather than silently saturating the integer result. diff --git a/lix/libexpr/primops/fromTOML.cc b/lix/libexpr/primops/fromTOML.cc index 9d4b5e6abf..3e26773eac 100644 --- a/lix/libexpr/primops/fromTOML.cc +++ b/lix/libexpr/primops/fromTOML.cc @@ -65,10 +65,13 @@ val, toml::parse( tomlStream, - "fromTOML", /* the "filename" */ + "fromTOML" /* the "filename" */ +#if HAVE_TOML11_4 + , toml::spec::v( 1, 0, 0 ) // Be explicit that we are parsing TOML 1.0.0 without extensions +#endif ) ); } catch (std::exception & e) { // NOLINT(lix-foreign-exceptions) // TODO: toml::syntax_error diff --git a/meson.build b/meson.build index 7b229ccefb..d4a36eb285 100644 --- a/meson.build +++ b/meson.build @@ -363,7 +363,10 @@ dependency('gmock_main', required : enable_tests, include_type : 'system'), ] -toml11 = dependency('toml11', version : '>=4.0.0', required : true, method : 'cmake', include_type : 'system') +toml11 = dependency('toml11', version : '>=3.7.0', required : true, method : 'cmake', include_type : 'system') +configdata += { + 'HAVE_TOML11_4': toml11.version().version_compare('>= 4.0.0').to_int(), +} pegtl = dependency( 'pegtl', diff --git a/misc/toml11.nix b/misc/toml11.nix deleted file mode 100644 index c53be3da1b..0000000000 --- a/misc/toml11.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - cmake, -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "toml11"; - version = "4.4.0"; - - src = fetchFromGitHub { - owner = "ToruNiina"; - repo = "toml11"; - rev = "v${finalAttrs.version}"; - hash = "sha256-sgWKYxNT22nw376ttGsTdg0AMzOwp8QH3E8mx0BZJTQ="; - }; - - nativeBuildInputs = [ - cmake - ]; - - meta = with lib; { - homepage = "https://github.com/ToruNiina/toml11"; - description = "TOML for Modern C++"; - longDescription = '' - toml11 is a C++11 (or later) header-only toml parser/encoder depending - only on C++ standard library. - - - It is compatible to the latest version of TOML v1.0.0. - - It is one of the most TOML standard compliant libraries, tested with - the language agnostic test suite for TOML parsers by BurntSushi. - - It shows highly informative error messages. - - It has configurable container. You can use any random-access containers - and key-value maps as backend containers. - - It optionally preserves comments without any overhead. - - It has configurable serializer that supports comments, inline tables, - literal strings and multiline strings. - - It supports user-defined type conversion from/into toml values. - - It correctly handles UTF-8 sequences, with or without BOM, both on posix - and Windows. - ''; - license = licenses.mit; - maintainers = with maintainers; [ ]; - platforms = platforms.unix ++ platforms.windows; - }; -}) diff --git a/package.nix b/package.nix index eb0e5c602a..c1c948ee7e 100644 --- a/package.nix +++ b/package.nix @@ -55,8 +55,6 @@ rustc, sqlite, systemtap-lix ? __forDefaults.systemtap-lix, - # FIXME: remove default after dropping NixOS 25.05 - toml11-lix ? __forDefaults.toml11-lix, toml11, util-linuxMinimal ? utillinuxMinimal, utillinuxMinimal ? null, @@ -117,9 +115,6 @@ build-release-notes = callPackage ./maintainers/build-release-notes.nix { }; passt-lix = callPackage ./misc/passt.nix { }; - - toml11-lix = - if lib.versionOlder toml11.version "4.4.0" then callPackage ./misc/toml11.nix { } else toml11; }, }: @@ -344,7 +339,7 @@ libarchive boost lowdown - toml11-lix + toml11 pegtl capnproto dtrace-headers diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-fail-overflow.err.exp b/tests/functional2/lang/fromTOML-overflowing/eval-fail-overflow.err.exp deleted file mode 100644 index 0c90e85edf..0000000000 --- a/tests/functional2/lang/fromTOML-overflowing/eval-fail-overflow.err.exp +++ /dev/null @@ -1,13 +0,0 @@ -error: - … while calling the 'fromTOML' builtin - at /pwd/in.nix:1:1: - 1| builtins.fromTOML ''attr = 9223372036854775808'' - | ^ - 2| - - error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63 - --> fromTOML - | - 1 | attr = 9223372036854775808 - | ^-- must be < 2^63 - diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-fail-underflow.err.exp b/tests/functional2/lang/fromTOML-overflowing/eval-fail-underflow.err.exp deleted file mode 100644 index a287e18655..0000000000 --- a/tests/functional2/lang/fromTOML-overflowing/eval-fail-underflow.err.exp +++ /dev/null @@ -1,13 +0,0 @@ -error: - … while calling the 'fromTOML' builtin - at /pwd/in.nix:1:1: - 1| builtins.fromTOML ''attr = -9223372036854775809'' - | ^ - 2| - - error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63 - --> fromTOML - | - 1 | attr = -9223372036854775809 - | ^-- must be < 2^63 - diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-okay-overflow.out.exp b/tests/functional2/lang/fromTOML-overflowing/eval-okay-overflow.out.exp new file mode 100644 index 0000000000..e241ca9ba4 --- /dev/null +++ b/tests/functional2/lang/fromTOML-overflowing/eval-okay-overflow.out.exp @@ -0,0 +1,1 @@ +{ attr = 9223372036854775807; } diff --git a/tests/functional2/lang/fromTOML-overflowing/eval-okay-underflow.out.exp b/tests/functional2/lang/fromTOML-overflowing/eval-okay-underflow.out.exp new file mode 100644 index 0000000000..83b822591f --- /dev/null +++ b/tests/functional2/lang/fromTOML-overflowing/eval-okay-underflow.out.exp @@ -0,0 +1,1 @@ +{ attr = -9223372036854775808; }