Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2A6C240DEF3 for ; Thu, 18 Nov 2010 13:09:14 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VW94ckHkw7pq for ; Thu, 18 Nov 2010 13:09:03 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 9AFA340DEEB for ; Thu, 18 Nov 2010 13:09:03 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 078C819F3364; Thu, 18 Nov 2010 22:09:02 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id oWGtCYzT8YFx; Thu, 18 Nov 2010 22:09:00 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id BA17419F3340; Thu, 18 Nov 2010 22:09:00 +0100 (CET) Received: from wsheee.2x.cz (unknown [213.29.198.144]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id B6396FA005; Thu, 18 Nov 2010 22:09:00 +0100 (CET) Received: from wsh by wsheee.2x.cz with local (Exim 4.72) (envelope-from ) id 1PJBj2-0004n8-3Y; Thu, 18 Nov 2010 22:09:00 +0100 From: Michal Sojka To: Mark Walters , notmuch@notmuchmail.org Subject: Re: Bug in remote use of notmuch In-Reply-To: References: User-Agent: Notmuch/0.5-11-g48b5e00 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Thu, 18 Nov 2010 22:08:59 +0100 Message-ID: <87wroa49w4.fsf@wsheee.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Nov 2010 21:09:14 -0000 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