Thank you for reporting this with such clear reproduction steps. Made it very easy to triage. There were actually three separate defects in LocalSearch, fixed by,
https://gitlab.gnome.org/GNOME/localsearch/-/commit/1a1560bcb066ab40c9d59420179ec2a5e7520634 ** Description changed: - $ localsearch --version - LocalSearch 3.11.0 + [ Impact ] - Executive summary: localsearch generates GLib-CRITICAL errors, - intermittently fails to remove added paths + * "localsearch index --remove PATH" silently fails to remove the path. The + command exits 0, says nothing about the failure, and the path is still + listed by "localsearch index" afterwards. The user has to repeat it until + an attempt happens to land. The reporter needed three attempts on one + machine and five on another. - I am using ssh into this machine: + * On a machine with no graphical session it fails every time, so the path + cannot be removed at all by anyone following the documented command. - Distributor ID: Ubuntu - Description: Ubuntu 26.04 LTS - Release: 26.04 - Codename: resolute + * The failure is silent, which is the part that matters. A user who removes a + directory from indexing because it holds confidential material is told it + worked. It did not. The content stays in the index and keeps being returned + by search in Files and the Shell overview. - The machine is running with the Lubuntu GUI shut down (systemctl isolate - multi-user.target). + * Every "localsearch index --add" and "--remove" also prints one or more GLib + criticals, which makes the tool look broken and buries any real diagnostic. - 1. localsearch removes a path correctly (with GLib-CRITICAL errors) - after a fresh install: + * Cause. See upstream commit 931cf93ef ("cli: Use g_auto* more + extensively") - $ localsearch index - Path Recursive - /home/idallen * + [ Test Plan ] - $ localsearch index --remove /home/idallen - (localsearch index:1920529): GLib-CRITICAL **: 17:42:28.840: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + On resolute, over ssh to a machine with no graphical session running. Nothing + needs to be installed beyond localsearch itself. - $ localsearch index - Path Recursive + 1. Record the current setting so it can be restored: - 2. It adds back the path correctly (with GLib-CRITICAL errors): + gsettings get org.freedesktop.Tracker3.Miner.Files \ + index-recursive-directories - $ localsearch index --add --recursive /home/idallen - (localsearch index:1925002): GLib-CRITICAL **: 17:45:31.435: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + On a stock Ubuntu install this is ['$HOME']. - $ localsearch index - Path Recursive - /home/idallen * + 2. Add a scratch directory and confirm it is listed: - 3. It adds a second path correctly (with GLib-CRITICAL errors): + mkdir -p /tmp/sru-2164265 + localsearch index --add --recursive /tmp/sru-2164265 + localsearch index - $ localsearch index --add --recursive /tmp - (localsearch index:1925917): GLib-CRITICAL **: 17:46:08.953: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1925917): GLib-CRITICAL **: 17:46:08.953: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1925917): GLib-CRITICAL **: 17:46:08.953: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + /tmp/sru-2164265 must appear in the output. - $ localsearch index - Path Recursive - /home/idallen * - /tmp * + 3. Make sure dconf-service is not running, which is what a machine with no + graphical session looks like: - 4. Now, it won't remove any paths at all (and has lots of GLib-CRITICAL - errors): + pkill -x dconf-service - $ localsearch index --remove /tmp - (localsearch index:1926916): GLib-CRITICAL **: 17:46:47.665: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1926916): GLib-CRITICAL **: 17:46:47.666: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1926916): GLib-CRITICAL **: 17:46:47.666: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + 4. Remove the directory and look at the result: - $ localsearch index - Path Recursive - /home/idallen * - /tmp * + localsearch index --remove /tmp/sru-2164265 + localsearch index - $ localsearch index --remove /home/idallen - (localsearch index:1929533): GLib-CRITICAL **: 17:48:36.042: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1929533): GLib-CRITICAL **: 17:48:36.042: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + Bad, 3.11.0-1ubuntu1.1: /tmp/sru-2164265 is still listed, and step 4 + printed "g_atomic_ref_count_dec: assertion 'old_value > 0' failed". - $ localsearch index - Path Recursive - /home/idallen * - /tmp * + Good, 3.11.2-0ubuntu0.1: /tmp/sru-2164265 is gone, and nothing is printed + on stderr. - 5. I tried adding a third path /home/idallen/bin/. I couldn't remove - it. + 5. Sample the bug, - $ localsearch index --add --recursive /home/idallen/bin - (localsearch index:1991588): GLib-CRITICAL **: 18:30:55.814: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1991588): GLib-CRITICAL **: 18:30:55.814: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1991588): GLib-CRITICAL **: 18:30:55.815: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1991588): GLib-CRITICAL **: 18:30:55.815: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1991588): GLib-CRITICAL **: 18:30:55.815: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + for i in $(seq 20); do + localsearch index --add --recursive /tmp/sru-2164265 >/dev/null + pkill -x dconf-service + localsearch index --remove /tmp/sru-2164265 + localsearch index | grep -q sru-2164265 && echo "LOST $i" + done - $ localsearch index - Path Recursive - /home/idallen * - /tmp * - /home/idallen/bin * + Bad: "LOST" on all 20 iterations, plus criticals throughout. + Good: no output at all. - $ localsearch index --remove /home/idallen/bin - (localsearch index:1992504): GLib-CRITICAL **: 18:31:29.995: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992504): GLib-CRITICAL **: 18:31:29.995: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992504): GLib-CRITICAL **: 18:31:29.995: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992504): GLib-CRITICAL **: 18:31:29.995: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992504): GLib-CRITICAL **: 18:31:29.995: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + 6. Regression check on the entry resolution the fix touches. Ubuntu's + default list holds a "$HOME" envvar entry, the upstream default holds + "&ALIAS" entries, and users add plain paths. All three kinds must still + resolve and still be removable by their real path: - $ localsearch index - Path Recursive - /home/idallen * - /tmp * - /home/idallen/bin * + gsettings set org.freedesktop.Tracker3.Miner.Files \ + index-recursive-directories "['\$HOME', '&DOWNLOAD', '/tmp/sru-2164265']" + localsearch index - 6. I tried removing /tmp again, and it worked this time: + The home directory, the real Downloads path and /tmp/sru-2164265 must all + be shown. Then remove each by its real path: - $ localsearch index --remove /tmp - (localsearch index:1992731): GLib-CRITICAL **: 18:31:38.219: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992731): GLib-CRITICAL **: 18:31:38.219: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992731): GLib-CRITICAL **: 18:31:38.219: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1992731): GLib-CRITICAL **: 18:31:38.219: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + for p in "$HOME" "$(xdg-user-dir DOWNLOAD)" /tmp/sru-2164265; do + pkill -x dconf-service + localsearch index --remove "$p" + done + gsettings get org.freedesktop.Tracker3.Miner.Files \ + index-recursive-directories - $ localsearch index - Path Recursive - /home/idallen * - /home/idallen/bin * + Bad: all three entries are still there, and the removals printed + "g_file_test: assertion 'filename != NULL' failed" as well. + Good: @as [], and nothing on stderr. - 6. I tried removing /home/idallen/bin, and it worked this time: + Restore the value recorded in step 1 afterwards. - $ localsearch index --remove /home/idallen/bin - (localsearch index:1993171): GLib-CRITICAL **: 18:31:55.741: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1993171): GLib-CRITICAL **: 18:31:55.741: g_file_test: assertion 'filename != NULL' failed - (localsearch index:1993171): GLib-CRITICAL **: 18:31:55.741: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + 7. On a desktop install, add and remove a location in Settings > Search > + Search Locations and confirm it appears in and disappears from + "localsearch index". The panel writes the same keys. - $ localsearch index - Path Recursive - /home/idallen * + [ Where problems could occur ] - 6. I tried removing /home/idallen repeatedly, and it took three - consecutive tries before it actually worked: + * g_settings_sync() blocks. "localsearch index --remove" now waits for the + dconf write to be dispatched where it previously returned immediately. If + dconf-service cannot be activated or is wedged, the regression presents as + the command hanging rather than returning at once, and scripts that call it + in a loop would stall. The blast radius is bounded by the fact that + index_add() has called g_settings_sync() on the same keys in every shipped + version, so a hang would have to be reproducible on --add as well. Test both + sub-commands, not just --remove. - $ localsearch index --remove /home/idallen - (localsearch index:1993928): GLib-CRITICAL **: 18:32:24.842: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + * The "$" and "&" guards change what elem_equals() will match. If some + configured entry legitimately needs resolving but does not begin with either + character, it would stop matching, and "localsearch index --remove + <resolved path>" would silently fail to remove it. That is the original bug + again, in a narrower form, and it would look identical to the user. The + schema documents only "&" aliases and the code only reads "$" envvars, so no + third form should exist, but that is the assumption these guards bet on. + Ubuntu's own default is the "$HOME" form, so a mistake here would hit stock + installs first. Step 6 covers all three kinds together. - $ localsearch index - Path Recursive - /home/idallen * + * g_steal_pointer() moves ownership of the GArray that becomes the new + GSettings value. If that were wrong the visible results are a crash on + --add/--remove, or a corrupted index-recursive-directories or + index-single-directories. Those two keys drive the indexer's crawl, so + corruption presents as localsearch re-crawling the whole home directory + (sustained CPU and disk, battery drain on laptops) or as files silently + disappearing from search results in Files and the Shell overview. Check the + two keys still hold sensible values after a few --add/--remove cycles, and + watch localsearch-3 CPU afterwards. - $ localsearch index --remove /home/idallen - (localsearch index:1994023): GLib-CRITICAL **: 18:32:29.194: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + * The Settings > Search panel writes the same keys from a different code path. + A bad value written by the CLI is read back by both the indexer and the + panel, so a regression could surface as the panel showing wrong locations or + failing to load, without the CLI itself looking wrong. - $ localsearch index - Path Recursive - /home/idallen * + [ Other Info ] - $ localsearch index --remove /home/idallen - (localsearch index:1994122): GLib-CRITICAL **: 18:32:32.087: g_atomic_ref_count_dec: assertion 'old_value > 0' failed + * Development series. stonking has 3.11.2-1, a sync from Debian, which does + not have the fix. 3.11.2-1ubuntu1 carries the same cherry-pick and must + reach stonking before this SRU lands. - $ localsearch index - Path Recursive - - I tried this on a different machine running the same O/S and it took - five tries to remove /home/idallen before it worked. - - Something is intermittently wrong with localsearch index. - - ProblemType: Bug - DistroRelease: Ubuntu 26.04 - Package: localsearch 3.11.0-1ubuntu1.1 - ProcVersionSignature: Ubuntu 7.0.0-29.29-generic 7.0.12 - Uname: Linux 7.0.0-29-generic x86_64 - ApportVersion: 2.34.1-0ubuntu0.1 - Architecture: amd64 - CasperMD5CheckResult: unknown - CurrentDesktop: LXQt - Date: Tue Aug 18 16:10:32 2026 - InstallationDate: Installed on 2020-09-08 (2170 days ago) - InstallationMedia: Ubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731) - SourcePackage: localsearch - UpgradeStatus: Upgraded to resolute on 2026-07-27 (23 days ago) + * Regression window. 931cf93ef (defects 1 and 3) first released in 3.10.alpha. + d9702ae74 ("cli: Fix inconsistencies in 'localsearch index' envvar/alias + handling", defect 2) first released in 3.11.alpha. noble ships tracker-miners + 3.7.1 and jammy 3.3.x, both of which predate the two commits and are + unaffected. resolute is the only stable series that needs this. ** Summary changed: - localsearch index --remove silently discards the removal when dconf-service is not already running + [SRU] localsearch index --remove silently discards the removal when dconf-service is not already running ** Changed in: localsearch (Ubuntu Stonking) Status: Confirmed => In Progress ** Changed in: localsearch (Ubuntu Resolute) Status: Triaged => In Progress ** Changed in: localsearch (Ubuntu Resolute) Importance: Undecided => High ** Changed in: localsearch (Ubuntu Stonking) Importance: Undecided => High -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2164265 Title: [SRU] localsearch index --remove silently discards the removal when dconf-service is not already running To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/localsearch/+bug/2164265/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
