From 3f280486bde12bc13fe0733f97e1a0da4c83e28b Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 19 Jul 2026 17:21:51 +0200 Subject: [PATCH] Fix regression with both touch and threshold active at the same time --- HISTORY | 8 ++++++++ cmdline/snapraid.c | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index 1e1491e6..c6852620 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,14 @@ SnapRAID HISTORY ================ +14.9 2026/07 +============ + * Fix a regression when both the '--gui-touch-before' and + '--gui-threshold' options are selected at the same time, which may + prevent the thresholds from working correctly. Now, the content file + is unconditionally saved before scanning for differences if any touch + is performed. + 14.8 2026/06 ============ * Avoid spinning up standby disks on Windows in some machines during diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index 607c8c87..09798d81 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -1832,20 +1832,21 @@ int snapraid_main(int argc, char* argv[]) if (state.opt.force_realloc) state_locate_mark_tail_blocks_for_resync(&state, opt.parity_tail); - if (opt.gui_touch_before) + if (opt.gui_touch_before) { state_touch(&state); + /* save the new state if required */ + if (state.need_write) + state_write(&state); + } + state_scan(&state); if (opt.gui_threshold_removes != 0 && state.removed_files >= opt.gui_threshold_removes) { - if (state.need_write) - state_write(&state); log_fatal(EUSER, "Too many files were removed (%u, limit is %u). Sync aborted.\n", state.removed_files, opt.gui_threshold_removes); exit(EXIT_SYNC_NEEDED); } if (opt.gui_threshold_updates != 0 && state.updated_files >= opt.gui_threshold_updates) { - if (state.need_write) - state_write(&state); log_fatal(EUSER, "Too many files were updated (%u, limit is %u). Sync aborted.\n", state.updated_files, opt.gui_threshold_updates); exit(EXIT_SYNC_NEEDED); }