unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Bug in remote use of notmuch
@ 2010-11-10 19:34 Mark Walters
  2010-11-18 21:08 ` Michal Sojka
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Walters @ 2010-11-10 19:34 UTC (permalink / raw)
  To: notmuch

I am experimenting with using notmuch remotely over ssh (as in the
NEWS file; i.e. with a script containing ssh user@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)

If you search for "*" you get the expected results.

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in remote use of notmuch
  2010-11-10 19:34 Bug in remote use of notmuch Mark Walters
@ 2010-11-18 21:08 ` Michal Sojka
  2010-11-19  1:30   ` Austin Clements
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Sojka @ 2010-11-18 21:08 UTC (permalink / raw)
  To: Mark Walters, notmuch

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@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in remote use of notmuch
  2010-11-18 21:08 ` Michal Sojka
@ 2010-11-19  1:30   ` Austin Clements
  2010-11-19  9:06     ` Michal Sojka
  0 siblings, 1 reply; 4+ messages in thread
From: Austin Clements @ 2010-11-19  1:30 UTC (permalink / raw)
  To: Michal Sojka; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

Unfortunately, expansion *is* performed by the remote shell, which is why
your shell quoting approach works (and is necessary).  There's really no way
around this, since the ssh client simply joins all of its trailing arguments
with spaces and sends this single string to the ssh server, which exec()s
$SHELL -c <string>.
On Nov 18, 2010 4:09 PM, "Michal Sojka" <sojkam1@fel.cvut.cz> wrote:
> 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@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
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: Type: text/html, Size: 2380 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in remote use of notmuch
  2010-11-19  1:30   ` Austin Clements
@ 2010-11-19  9:06     ` Michal Sojka
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Sojka @ 2010-11-19  9:06 UTC (permalink / raw)
  To: Austin Clements; +Cc: notmuch

On Fri, 19 Nov 2010, Austin Clements wrote:
> Unfortunately, expansion *is* performed by the remote shell, which is why
> your shell quoting approach works (and is necessary).  There's really no way
> around this, since the ssh client simply joins all of its trailing arguments
> with spaces and sends this single string to the ssh server, which exec()s
> $SHELL -c <string>.

Yes, your're right. I was confused by ssh(1) which says that server
executes either login shell or the command.

-M

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-19  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-10 19:34 Bug in remote use of notmuch Mark Walters
2010-11-18 21:08 ` Michal Sojka
2010-11-19  1:30   ` Austin Clements
2010-11-19  9:06     ` Michal Sojka

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).