Re: Remote usage script updated
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 5 Feb 2011 07:38:33 +0000 (08:38 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:52 +0000 (09:37 -0800)
f9/dcac77de940154825dc45bc6f840328778baa9 [new file with mode: 0644]

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