Re: [PATCH] Properly handle short writes in sigint handlers
authorAustin Clements <amdragon@MIT.EDU>
Sun, 25 Dec 2011 00:38:42 +0000 (19:38 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:16 +0000 (09:41 -0800)
1d/ad95d55a272ab51de3afd9d4ae79e610af825c [new file with mode: 0644]

diff --git a/1d/ad95d55a272ab51de3afd9d4ae79e610af825c b/1d/ad95d55a272ab51de3afd9d4ae79e610af825c
new file mode 100644 (file)
index 0000000..c6098e9
--- /dev/null
@@ -0,0 +1,104 @@
+Return-Path: <amdragon@mit.edu>\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 6B876431FD0\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Dec 2011 16:37:47 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 qnyl769rCpqY for <notmuch@notmuchmail.org>;\r
+       Sat, 24 Dec 2011 16:37:47 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id EFB9B431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Dec 2011 16:37:46 -0800 (PST)\r
+X-AuditID: 12074424-b7fae6d000000906-ac-4ef6705ad774\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 7E.6E.02310.A5076FE4; Sat, 24 Dec 2011 19:37:46 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id pBP0bkPM002719; \r
+       Sat, 24 Dec 2011 19:37:46 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBP0biaB027329\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 24 Dec 2011 19:37:45 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Rec6s-00049M-OY; Sat, 24 Dec 2011 19:38:42 -0500\r
+Date: Sat, 24 Dec 2011 19:38:42 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: David Edmondson <dme@dme.org>\r
+Subject: Re: [PATCH] Properly handle short writes in sigint handlers\r
+Message-ID: <20111225003842.GA15906@mit.edu>\r
+References: <20111222201553.GK10376@mit.edu>\r
+       <1324584948-8009-1-git-send-email-amdragon@mit.edu>\r
+       <cunhb0rvhc6.fsf@hotblack-desiato.hh.sledj.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <cunhb0rvhc6.fsf@hotblack-desiato.hh.sledj.net>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IR4hTV1o0q+OZn8H6TlMW+O1uYLK7fnMns\r
+       wOSx6/lfJo9nq24xBzBFcdmkpOZklqUW6dslcGV8XMJR8IujYsqlhUwNjD3sXYycHBICJhJf\r
+       dx1mgrDFJC7cW8/WxcjFISSwj1Hi1+QvUM4GRol1D9YyQzgnmSRmXb/LDuEsYZS4fH4GM0g/\r
+       i4CqxMXlrYwgNpuAhsS2/cvBbBEBRYn/31aA7WMWkJb49rsZaB8Hh7CAi8TBE1EgYV4BHYmj\r
+       254yQcycwiixcPFyNoiEoMTJmU9YIHq1JG78ewnWCzJn+T8OkDCngI1E15s1YCWiAioSU05u\r
+       Y5vAKDQLSfcsJN2zELoXMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXXy80s0UtNKd3ECApr\r
+       dheVHYzNh5QOMQpwMCrx8DYu/eInxJpYVlyZe4hRkoNJSZQ3P/+bnxBfUn5KZUZicUZ8UWlO\r
+       avEhRgkOZiURXs0koHLelMTKqtSifJiUNAeLkjivhtY7PyGB9MSS1OzU1ILUIpisDAeHkgTv\r
+       c5ChgkWp6akVaZk5JQhpJg5OkOE8QMMPgNTwFhck5hZnpkPkTzHqcixeteEsoxBLXn5eqpQ4\r
+       716QIgGQoozSPLg5sHT0ilEc6C1h3uUgVTzAVAY36RXQEiagJTFGIB8UlyQipKQaGD26LJw1\r
+       PQw1jWR49yV2yE1hvr84dWJ08tT4us9/c/NSmLvWtN089v1CTZX0eXWZxPQ0MUWDGcuzP+5f\r
+       9D5A/Lpm/IavzzyjfYN+bD5a9yr05bHUf9eu9a5Wqm3f+byjxVk+QffTl4RszsV1R2qXir0o\r
+       Pah4sXt2TPH78+U31D1fMrO6WH1pUWIpzkg01GIuKk4EADjf7HwiAwAA\r
+Cc: notmuch@notmuchmail.org\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: Sun, 25 Dec 2011 00:37:47 -0000\r
+\r
+Quoth David Edmondson on Dec 23 at  8:10 am:\r
+> Sorry for being slow.\r
+> \r
+> Can you describe the situation in which you expect a write to stderr to\r
+> be a short write? (Without error.)\r
+\r
+If the PTY buffer is nearly full because, say, my terminal emulator is\r
+a little behind or my SSH session is slow, I believe POSIX allows this\r
+to be a short write (though Linux appears to treat PTYs like pipes and\r
+will block rather than doing a short write, so it's completely\r
+possible I'm misinterpreting POSIX).\r
+\r
+> In that situation, what guarantee is there that the loop you've written\r
+> will terminate?\r
+\r
+There isn't, but for the same reason there's also no guarantee that a\r
+single write will terminate.\r
+\r
+> We're not talking about safeguarding a users' data here - this is a\r
+> short message to indicate that a tool is terminating due to a signal.\r
+> I'm concerned that the solution is worse than the problem.\r
+\r
+As a user I'd be confused to see just part of the "Stopping" message\r
+jammed in the middle of other output, but you're definitely right that\r
+the consequences of this would not extend beyond a little bit of\r
+harmless confusion.\r