Fix crash when boolean fields in sunshine_state.json are stored as strings#1286
Conversation
|
Weird, I have already changed the whole settings parsing to proper JSON handling and changing these fields never got me into problems. Were you upgraded from a very old version or have reverted to an old version? You should have noticed the format migration code and these kind of things should be handled there instead. |
|
@ClassicOldSong I can easily reproduce this on the fresh installation of version
After this operation content of {
"password": "[REDACTED]",
"root": {
"named_devices": [
{
"allow_client_commands": "true",
"always_use_virtual_display": "false",
"cert": "[REDACTED]",
"display_mode": "",
"enable_legacy_ordering": "true",
"name": "Mac",
"perm": "119480064",
"uuid": "9D2B43B6-AACC-510E-C417-029F89C51463"
}
],
"uniqueid": "C9E57A7A-04A9-ED0B-F71E-BAF1C6E09943"
},
"salt": "HM5xwNFijUhDEp2o",
"username": "apollo"
} |
|
On the other hand I think So Line 87 in fd059e3 |
Replace Boost property_tree with nlohmann::json in save_user_creds(). Boost property_tree does not preserve JSON types - it converts all values to strings when writing JSON. This caused boolean and integer fields in sunshine_state.json to become strings (e.g., true -> "true", 119480064 -> "119480064") after changing the password, leading to crashes on restart. nlohmann::json preserves the original types, matching the rest of the codebase which already uses it for JSON operations. Fixes ClassicOldSong#835
eb521c8 to
7ec7566
Compare
|
I think I have replaced all the occurrences of boost property tree... Anyway thanks for finding this out! |
Replace Boost property_tree with nlohmann::json in save_user_creds().
Boost property_tree does not preserve JSON types - it converts all values
to strings when writing JSON. This caused boolean and integer fields in
sunshine_state.json to become strings (e.g., true -> "true", 119480064 ->
"119480064") after changing the password, leading to crashes on restart.
nlohmann::json preserves the original types, matching the rest of the
codebase which already uses it for JSON operations.