Bug in remote use of notmuch

Michal Sojka sojkam1 at fel.cvut.cz
Thu Nov 18 13:08:59 PST 2010


On Wed, 10 Nov 2010, Mark Walters wrote:
> I am experimenting with using notmuch remotely over ssh (as in the
> NEWS file; i.e. with a script containing ssh user at host notmuch "$@")
> This is mostly excellent but it seems to get confused by some queries.
> For example those containing brackets or just consisting of *. I think
> this is a problem with ssh spawning a shell on the remote machine
> which doesn't like the brackets or *.
> 
> Explicitly to reproduce the problem start notmuch with a remote
> database using a script as above;
> type * in the search box;
> and emacs shows:
> End of search results. (process returned 1)

Hi Mark,

you are right, that there are problems with the queries containing shell
meta characters. AFAIK the probelm is not caused by the remote shell, as
 notmuch is there invoked directly by ssh, but by the shell invoking the
ssh. I do not know precisely why, but the following script seems to work
correctly even for the queries containing shell meta characters. It uses
bash's printf extension to print shell-quoted version of a string.

  #!/bin/bash
  printf -v args "%q " "$@"
  ssh example.org notmuch $args

-Michal


More information about the notmuch mailing list