--- /dev/null
+Return-Path: <too@guru-group.fi>\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 178D9431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 28 May 2013 11:39:21 -0700 (PDT)\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 ULnSPZl382Yn for <notmuch@notmuchmail.org>;\r
+ Tue, 28 May 2013 11:39:12 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 6D013431FC2\r
+ for <notmuch@notmuchmail.org>; Tue, 28 May 2013 11:39:04 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id B3FDA10014D; Tue, 28 May 2013 21:38:59 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: v3 of --stderr=FILE patches\r
+Date: Tue, 28 May 2013 21:38:51 +0300\r
+Message-Id: <1369766335-26733-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+Cc: tomi.ollila@iki.fi\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: Tue, 28 May 2013 18:39:21 -0000\r
+\r
+This is v3 of id:1369557954-13439-1-git-send-email-tomi.ollila@iki.fi\r
+\r
+In id:m2a9nfr4tb.fsf@guru.guru-group.fi I suggested to use 0600 as\r
+permission bits so that files written to /tmp would not have write\r
+bits set in any case. That would have been inconsistent what is\r
+normally expected in redirection cases. The problem I described\r
+is easily avoided in emacs as (make-temp-file "nmerr") will create\r
+file "/tmp/nmerrXXXXXX" with permissions 0600 -- and writing to\r
+that already-created file will not change its permissions. Writing\r
+elsewhere is usually covered with directory permissions.\r
+\r
+\r
+Diffdiff from v2 is shown below.\r
+\r
+diff --git a/NEWS b/NEWS\r
+index 990b038..80abd97 100644\r
+--- a/NEWS\r
++++ b/NEWS\r
+@@ -38,8 +38,7 @@ Top level option to specify configuration file\r
+ Top level option to redirect writes to stderr\r
+ \r
+ With `notmuch --stderr=FILE` all writes to stderr are redirected to\r
+- the specified file. If the file name is a plain '-', stderr is\r
+- written to stdout.\r
++ the specified file. If FILE is '-', stderr is redirected to stdout.\r
+ \r
+ Deprecated commands "part" and "search-tags" are removed.\r
+ \r
+diff --git a/man/man1/notmuch.1 b/man/man1/notmuch.1\r
+index fbd575a..f5ca0ad 100644\r
+--- a/man/man1/notmuch.1\r
++++ b/man/man1/notmuch.1\r
+@@ -83,7 +83,7 @@ configuration file specified by ${NOTMUCH_CONFIG}.\r
+ .B \-\-stderr=FILE\r
+ \r
+ Redirect all writes to stderr to the specified file.\r
+-If the file name is a plain '-', stderr is written to stdout.\r
++If FILE is '-', stderr is redirected to stdout.\r
+ .RE\r
+ \r
+ .SH COMMANDS\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 654a568..15e90c8 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -260,7 +260,7 @@ redirect_stderr (const char * stderr_file)\r
+ return 1;\r
+ }\r
+ } else {\r
+- int fd = open (stderr_file, O_WRONLY|O_CREAT|O_APPEND, 0644);\r
++ int fd = open (stderr_file, O_WRONLY|O_CREAT|O_TRUNC, 0666);\r
+ if (fd < 0) {\r
+ fprintf (stderr, "Error: Cannot redirect stderr to '%s': %s\n",\r
+ stderr_file, strerror (errno));\r
+\r
+\r
+>From Tomi Ollila <tomi.ollila@iki.fi> # This line is ignored.\r
+\r