Repository navigation
Conversation
…lsenseai#15746) Signed-off-by: SIDDARTHA REDDY <75976672+SIDDARTHAREDDY8@users.noreply.github.com>
sysrsbuild-gh-agentic
left a comment
There was a problem hiding this comment.
Automated review by rs-agentic bot. Two bugs flagged below; please address before merge.
|
Thanks for the fix and the test. Some extra context on the root cause: The regression comes from commit f28d25c ("fix error 42 on unicode user names"). It is in v2.56.4 but not in v2.56.3, and it adds this line to setlocale(LC_ALL, ".UTF8");On Windows, This PR's classic-locale parsing is a good defensive change. However, the global locale switch is still there, and other locale-sensitive parsing remains exposed:
The proper fix is to remove the global |
sysrsbuild-gh-agentic
left a comment
There was a problem hiding this comment.
Reviewed the new commit. The two previously flagged bugs in json_loader.hpp (imbue-after-construction + unchecked parse at line 37; missing setprecision at line 171) are still unaddressed. One new bug noted below in the replacement Python test.
Nir-Az
left a comment
There was a problem hiding this comment.
Verified on Windows 11 with a D455 under a de-DE region: JSON round-trip truncates without the fix and is correct with it.
|
ok to test |
|
Can one of the admins verify this patch? |
Fixes #15746
Bug
Loading a D400 advanced-mode JSON on a system with a comma-decimal OS locale (German, Danish, ...) truncates every fractional parameter: "0.482143" comes back as "0" and "1.8125" as "1" after a load/save round-trip. Regression reported against 2.56.4 and reproduced by a second user on a Danish locale.
Root cause
In src/ds/advanced_mode/json_loader.hpp, json_struct_field::load() and json_invert_struct_field::load() converted the JSON string values with ::atof(). atof follows the process C locale, so under a comma-decimal locale it stops parsing at the '.' and returns only the integer part.
Fix
Testing
test_json_round_trip_keeps_fractionsin unit-tests/live/options/pytest-advanced-mode.py (replaces the earlier C++ test, which did not compile in the unit-test build): round-trips fractional advanced-mode values through load_json() under a comma-decimal locale. Verified on D455 / Windows 11 with Regional format de-DE: fails without the fix (values truncated to 0), the whole file passes 19/19 with the fix.This PR was prepared with AI assistance; every line was reviewed and the fix was verified locally as described above.