From: Austin Clements Date: Wed, 2 Apr 2014 02:07:13 +0000 (+2000) Subject: Re: [Patch v5 2/6] dump: when given output file name, write atomically X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d61031b5d4d8584cb523c51bb14104a6fef0474d;p=notmuch-archives.git Re: [Patch v5 2/6] dump: when given output file name, write atomically --- diff --git a/21/a5272c874e64187549037145839ca80daa2c00 b/21/a5272c874e64187549037145839ca80daa2c00 new file mode 100644 index 000000000..51eb70322 --- /dev/null +++ b/21/a5272c874e64187549037145839ca80daa2c00 @@ -0,0 +1,136 @@ +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 1C376431FBF + for ; Tue, 1 Apr 2014 19:07:30 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 BF9vIeC9DQZ5 for ; + Tue, 1 Apr 2014 19:07:26 -0700 (PDT) +Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu + [18.7.68.36]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C84C0431FBD + for ; Tue, 1 Apr 2014 19:07:25 -0700 (PDT) +X-AuditID: 12074424-f79e26d000000c70-2c-533b70d9c94f +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP + id 47.9F.03184.9D07B335; Tue, 1 Apr 2014 22:07:21 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s3227Kbu013089; + Tue, 1 Apr 2014 22:07:21 -0400 +Received: from [10.165.238.236] (154.sub-70-192-13.myvzw.com [70.192.13.154]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s3227GLR015807 + (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); + Tue, 1 Apr 2014 22:07:18 -0400 +Message-Id: <201404020207.s3227GLR015807@outgoing.mit.edu> +Date: Tue, 01 Apr 2014 22:07:13 -0400 +Subject: Re: [Patch v5 2/6] dump: when given output file name, write + atomically +From: Austin Clements +To: David Bremner +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: base64 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFrrCIsWRmVeSWpSXmKPExsUixCmqrXuzwDrYYMMza4sbrd2MFtdvzmR2 + YPJ4tuoWs8eWQ++ZA5iiuGxSUnMyy1KL9O0SuDI2n1jHUvBEpeLV6ya2BsYXyl2MHBwSAiYS + H54VdzFyApliEhfurWfrYuTiEBKYzSTR2fKKFcLZwCjx58k1KGc/k8TMXf1MIC28AlYSN1av + ZAOxWQRUJfY/bAazhQUCJR49OssIYrMJaEhs278czBYBqrm6bTJYDTOQ3bj2IjPEHEGJkzOf + sEDE1SX+zLvEDGErSkzpfsg+gZFvFpKyWUjKZiEpW8DIvIpRNiW3Sjc3MTOnODVZtzg5MS8v + tUjXXC83s0QvNaV0EyMo8NhdVHYwNh9SOsQowMGoxMN74LxVsBBrYllxZe4hRkkOJiVRXo5g + 62AhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrzffYFyvCmJlVWpRfkwKWkOFiVx3rfWQJME0hNL + UrNTUwtSi2CyMhwcShK8//OBGgWLUtNTK9Iyc0oQ0kwcnCDDeYCGcxeADC8uSMwtzkyHyJ9i + VJQS53UBSQiAJDJK8+B6YYnhFaM40CvCvOIgVTzApALX/QpoMBPI4HVWIINLEhFSUg2MKyU8 + p7HYpBluFZIsnCjaPJX91UvfM7eTPAKq321ZwFpoXhpxz+bAZ5+jT9WcPU5tj/h+UyC/28F1 + ystlx4xlxfV2CUxfH7tqp5rhfB2uFc8WMFdP/Sc66cyGyXMvdpcd+Ga51r5JxfMyd5ypY6xX + iVOVfr65OJdkigTzT9OkllovDeMD7PVKLMUZiYZazEXFiQDmis0x5wIAAA== +Cc: notmuch +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: Wed, 02 Apr 2014 02:07:30 -0000 + +KFBhcmRvbiB0aGUgbW9iaWxlIHJldmlldykKCk9uIEFwciAxLCAyMDE0IDk6MTYgUE0sIERhdmlk +IEJyZW1uZXIgPGRhdmlkQHRldGhlcmEubmV0PiB3cm90ZToKPgo+IEl0IGlzIHVzZWZ1bCB0byBh +YmxlIHRvIHRlbGwgd2hldGhlciBhIGR1bXAgY29tcGxldGVkIHN1Y2Nlc3NmdWxseSBpbiAKPiBz +aXR1dGlvbnMgd2hlcmUgd2UgZG9uJ3QgaGF2ZSBhY2Nlc3MgdG8gdGhlIHJldHVybiBjb2RlLgoK +IlNpdHVhdGlvbnMuIsKgIFRoaXMgY29tbWl0IG1lc3NhZ2UgZG9lc24ndCBzZWVtIHZlcnkgcmVs +YXRlZCB0byBhdG9taWNpdHk/Cgo+IC0tLSAKPiBub3RtdWNoLWR1bXAuYyB8IDYxICsrKysrKysr +KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKy0tLS0tLS0tLS0tLS0gCj4gMSBm +aWxlIGNoYW5nZWQsIDQ4IGluc2VydGlvbnMoKyksIDEzIGRlbGV0aW9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