From f02dbb375513bd17db7a343c3ef56f8434f5554d Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 27 Jul 2020 16:25:36 +0200 Subject: [PATCH] Fix TOML parsing with large unsigned integers The parser parses everything as signed integers so the configuration file will fail to parse large numbers that don't fit in an i64. https://github.com/alexcrichton/toml-rs/issues/256 --- CHANGELOG.md | 6 ++++++ tools/yabridgectl/src/config.rs | 8 +++++++- tools/yabridgectl/src/utils.rs | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7720543..9173d08e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ Versioning](https://semver.org/spec/v2.0.0.html). ### yabridgectl +- Fixed regression where the configuration file failed to parse after running + `yabridgectl sync` caused by + [alexcrichton/toml-rs#256](https://github.com/alexcrichton/toml-rs/issues/256) + 4.0. If you have already run `yabridgectl sync` under yabridge 1.4.0, then + you'll have to manually remove the `[last_known_config]` section from + `~/.config/yabridgectl/config.toml`. - Fixed issue with overwriting broken symlinks during `yabridgectl sync`. ## [1.4.0] - 2020-07-26 diff --git a/tools/yabridgectl/src/config.rs b/tools/yabridgectl/src/config.rs index 8f56ed10..bb8829e3 100644 --- a/tools/yabridgectl/src/config.rs +++ b/tools/yabridgectl/src/config.rs @@ -108,7 +108,13 @@ pub struct KnownConfig { /// The results from running the contents of `yabridge-host.exe.so` through /// [`DefaultHasher`](std::collections::hash_map::DefaultHasher). Hash collisions aren't really /// an issue here since we mostly care about the version of Wine. - pub yabridge_host_hash: u64, + /// + /// This should have been stored as a `u64`, but the TOML library parses all integers as signed + /// so even though it will be able to serialize all values correctly some values will fail to + /// parse: + /// + /// https://github.com/alexcrichton/toml-rs/issues/256 + pub yabridge_host_hash: i64, } impl Config { diff --git a/tools/yabridgectl/src/utils.rs b/tools/yabridgectl/src/utils.rs index 5e02b3ac..12880112 100644 --- a/tools/yabridgectl/src/utils.rs +++ b/tools/yabridgectl/src/utils.rs @@ -183,7 +183,7 @@ pub fn verify_wine_setup(config: &mut Config) -> Result<()> { yabridge_host_exe_so_path.display() ) })?); - let yabridge_host_hash = hasher.finish(); + let yabridge_host_hash = hasher.finish() as i64; // Since these checks can take over a second if wineserver isn't already running we'll only // perform them when something has changed