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 BDB25431FB6 for ; Fri, 4 Feb 2011 23:38:38 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled 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 noL2nvOFdrwv for ; Fri, 4 Feb 2011 23:38:37 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 91FA0431FB5 for ; Fri, 4 Feb 2011 23:38:37 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id C19F819F3390; Sat, 5 Feb 2011 08:38:35 +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 39pCIaKKc5yf; Sat, 5 Feb 2011 08:38:34 +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 32DD219F338E; Sat, 5 Feb 2011 08:38:34 +0100 (CET) Received: from steelpick.2x.cz (note-sojka.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id 2F37215C031; Sat, 5 Feb 2011 08:38:33 +0100 (CET) Received: from wsh by steelpick.2x.cz with local (Exim 4.72) (envelope-from ) id 1Plcj3-00077w-Hx; Sat, 05 Feb 2011 08:38:33 +0100 From: Michal Sojka To: Jesse Rosenthal , notmuch@notmuchmail.org Subject: Re: Remote usage script updated In-Reply-To: <87oc72xs35.fsf@lucky.home> References: <87oc72xs35.fsf@lucky.home> User-Agent: Notmuch/0.5-103-g1253785 (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Sat, 05 Feb 2011 08:38:33 +0100 Message-ID: <87aaibylqe.fsf@steelpick.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: Sat, 05 Feb 2011 07:38:38 -0000 On Thu, 27 Jan 2011, Jesse Rosenthal wrote: > Dear all, > > Just a note to say that I finally got around to updating the remote > usage script on the wiki to what I'm using now. With "--format=raw" in, > it's all pretty straightforward. Hi Jesse, thanks for this. I wanted to do this since the --format=raw was merged, but didn't find the time for it. I have a few comments: > The only things the script does now are: > > 1. Produces a slight pause in the "notmuch show" output to avoid that > weird bug where emacs leaves off every tenth message or so. I added a comment to the script to explain the sleep there. Otherwise, people may delete the command because they think it is not needed. > 2. Locally caches raw messages (i.e. when --format=raw) is called. This > usually happens when getting attachments, so this is a nice way to > avoid having to download large attachments repeatedly. This is a good idea. > Note this just caches based on msg-id (or a hash thereof, to avoid > strange characters in file names). That means that if an attachment > is deleted on the server, the cache will be out of date. An easy way > to fix this would be to make the cache file name a concatenation of > the msg-id hash (check that first) and the hash of the actual message > (check that if the msg-id hash is there). I might put this in in the > future, especially if anyone else is using the script. > > 3. Escapes dollar signs in the msg-id to make shell-quoting over ssh > work. I think that quoting with printf -v args "%q " "$@" instead of sed would work more reliably (see bash(1)). > I've actually switched over to keeping my messages on my IMAP server and > using this remote script on all of my computers. It avoids any need for > syncing. It's been working very well for me so far. > > A future feature might be to integrate the ControlMaster feature of > openssh into the script, instead of having to open a connection > manually, but there are some complications there (dead sockets still > around if you go offline, etc.). In another project I worked around the dead sockets this way: sshgw() { local socket="$HOME/.ssh/cangw-connection" if [[ ! -S $socket ]] || ! ssh -x -a -S $socket root@192.168.2.3 true; then # Create master connection to speed up subsequent commands. ssh -N -f -M -S $socket root@192.168.2.3 >/dev/null 2>&1 fi ssh -x -a -S $socket root@192.168.2.3 "$@" } I guess this should work even for notmuch. -Michal