[PATCH] CLI/restore: handle missing keys and values in config data.
david at tethera.net
Sun Feb 18 03:37:10 PST 2018
Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:
> A few notes about the notmuch config as i'm wrapping my head back around
> * at least for config data stored in the database, a configuration
> entry with the value of the empty string is the same as an unset
> configuration value. is that right? is that the semantics we want?
That's correct. These are the semantics we inherited from Xapian. At the
time I implimented notmuch_database_config_*, that was the feedback I
got, I guess on the grounds of simplicity. It could be changed; I guess
not many people rely on the current semantics
> * we have no "unset" subsubcommand for "notmuch config", only "set"
> and "query". should we have "unset" ?
Perhaps. Although there is an existing possibility to clear a value from
the config by "notmuch set foo", which works for both values in the
config file and values in the database. In a sense this is consistent
with the proposed patch. Even if you care about the distinction between
unset and empty string, the proposed patch is consistent with this
behaviour; the ugly bit is the use of an empty string internally to
signal unset. Probably this deserves some kind of comment in case we
change the handling of empty strings.
> To be clear, there are situations where it's reasonable to have a config
> variable that you want to be the empty string, and you want that to be
> distinct from "unset".
Yes, I basically agree with that.
FWIW, it doesn't really make sense to me to put any substantial effort
into the database config functionality if the concensus is replace it
with a flat file backend, as you and Carl have been discussing. That's
probably a topic for another thread.
More information about the notmuch