[PATCH] CLI/restore: handle missing keys and values in config data.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Feb 17 21:05:43 PST 2018

On Thu 2018-02-15 07:53:11 +0200, Tomi Ollila wrote:
> But to emphasize my desire (where I can contribute to) and something
> Carl was worried at that we'd lose capability to edit configuration
> file with an editor I think we sould have a way to export the configuration
> to easily editable file and then import it after modifications.

fwiw, if the config file went away, i think a bare-bones implemention
could be done using something like vipe (from the moreutils package):

    notmuch dump --include=config | vipe | notmuch restore

but i have not tested it heavily! :) (one additional problem here might
be the race for the lock; if the tail of the pipeline is initialized
first, and it grabs a read/write lock on the notmuch db, it might block
the head of the pipeline, but a less-bare-bones implementation doesn't
need to be strictly a shell pipeline)

What's missing in this trivial implementation is:

 a) if a config variable is deleted from the interstitial editor, it is
    not removed from the database config (though we currently have no
    way to clear variables from the database either)

 b) comments added by the user will be thrown away

As i said on IRC, i think preserving user comments while still
facilitating automated/programmatic access to the variables in question
is the stickiest part of trying to make a human-editable file that maps
to these configuration variables.

I'm not convinced that the complexity is worth the tradeoff, but i
wouldn't object to it if someone has a clear vision and wants to
implement it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20180217/fcba8f2e/attachment.sig>

More information about the notmuch mailing list