netatalk: replace gsettings with dconf keyfile for indexer config#2902
netatalk: replace gsettings with dconf keyfile for indexer config#2902
Conversation
🤖 Augment PR SummarySummary: This PR improves Spotlight indexer configuration by generating a system dconf database keyfile instead of issuing per-run Changes:
Technical Notes: Spotlight is now gated on 🤖 Was this summary useful? React with 👍 or 👎 |
2adafe0 to
1f55edf
Compare
1f55edf to
16d8ab0
Compare
16d8ab0 to
4914b28
Compare
e77b771 to
d3ee288
Compare
d3ee288 to
b3c165d
Compare
|
augment review |
|
🔥 Spectest (AFP 3.4) - Flamegraph (AFP_ASSERT active)Commit: 🔥 Open interactive Flamegraph (SVG) 🔝 Top 10 leaf functions
|
|
|
||
| vollist->entry[vollist->qty] = volnamequot; | ||
| vollist->qty++; | ||
| fprintf(fp, "'%s'", vol->v_path); |
There was a problem hiding this comment.
| } | ||
|
|
||
| fprintf(fp, "[" INDEXER_DCONF_PATH "]\n"); | ||
| fprintf(fp, "index-recursive-directories=["); |
There was a problem hiding this comment.
set_sl_volumes() can emit index-recursive-directories=[] when no volumes have AFPVOL_SPOTLIGHT; an empty array in GVariant text typically needs an explicit type (e.g., @as []) or dconf update may fail to parse it. Consider ensuring the generated value is valid even when the list is empty.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
|
||
| vollist->entry[vollist->qty] = volnamequot; | ||
| vollist->qty++; | ||
| fprintf(fp, "'%s'", vol->v_path); |
There was a problem hiding this comment.
vol->v_path is written into a GVariant string literal via '%s' without escaping; paths containing a single quote or backslash can produce an invalid dconf keyfile and cause dconf update/reads to fail. Consider escaping vol->v_path according to GVariant string rules before writing.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| " index-single-directories \"[]\""); | ||
| fprintf(fp, "]\n"); | ||
| fprintf(fp, "index-single-directories=@as []\n"); | ||
| fclose(fp); |
There was a problem hiding this comment.
The return values of the preceding fprintf() calls and fclose(fp) aren’t checked, so write/flush errors (e.g., disk full) could go unnoticed while still proceeding to dconf update. Consider checking the stream error state before assuming the keyfile was written successfully.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
The gsettings set approach was broken at runtime because gsettings requires a dconf-service on the session bus, which netatalk's private dbus-daemon does not auto-activate. Replace set_sl_volumes() with a dconf keyfile writer: it creates /etc/dconf/db/netatalk.d/10-spotlight and runs dconf update, which works without any session bus. Add DCONF_PROFILE env so the indexer reads from the netatalk-specific database. Ship config/dconf/netatalk (system-db:netatalk) as the dconf profile, installed to sysconfdir/dconf/profile/. Detect the dconf binary at build time and gate have_spotlight on it instead of gsettings.
b3c165d to
b6921ac
Compare




The gsettings set approach was broken at runtime because gsettings requires a dconf-service on the session bus, which netatalk's private dbus-daemon does not auto-activate.
Replace set_sl_volumes() with a dconf keyfile writer: it creates /etc/dconf/db/netatalk.d/10-spotlight and runs dconf update, which works without any session bus. Add DCONF_PROFILE env so the indexer reads from the netatalk-specific database. Ship config/dconf/netatalk (system-db:netatalk) as the dconf profile, installed to sysconfdir/dconf/profile/. Detect the dconf binary at build time and gate have_spotlight on it instead of gsettings.
In meson, decouple indexer binary detection from GSettings schema detection:
On Debian Trixie, the localsearch binary is present but ships the Tracker3 GSettings schema rather than LocalSearch3. Decouple binary and schema selection so that any available binary (localsearch preferred, tracker3 as fallback) is paired with whichever schema is actually installed.