1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-08 01:51:01 +01:00

libexpr: Canonicalize TOML timestamps for toml11 > 4.0

This addresses several changes from toml11 4.0 bump in
nixpkgs [1].

1. Added more regression tests for timestamp formats.
   Special attention needs to be paid to the precision
   of the subsecond range for local-time. Prior versions select the closest
   (upwards) multiple of 3 with a hard cap of 9 digits.

2. Normalize local datetime and offset datetime to always
   use the uppercase separator `T`. This is actually the issue
   surfaced in [2]. This canonicalization is basically a requirement
   by (a certain reading) of rfc3339 section 5.6 [3].

3. If using toml11 >= 4.0 also keep the old behavior wrt
   to the number of digits used for subsecond part of the local-time.
   Newer versions cap it at 6 digits unconditionally.

[1]: https://www.github.com/NixOS/nixpkgs/pull/331649
[2]: https://www.github.com/NixOS/nix/issues/11441
[3]: https://datatracker.ietf.org/doc/html/rfc3339
This commit is contained in:
Sergei Zimmerman 2025-08-12 16:11:54 +03:00
parent d8fc55a46e
commit dc769d72cb
No known key found for this signature in database
2 changed files with 99 additions and 1 deletions

View file

@ -71,6 +71,12 @@ toml11 = dependency(
method : 'cmake',
include_type : 'system',
)
configdata_priv.set(
'HAVE_TOML11_4',
toml11.version().version_compare('>= 4.0.0').to_int(),
)
deps_other += toml11
config_priv_h = configure_file(