From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SFNiLx89CWKEHAAAgWs5BA (envelope-from ) for ; Sun, 13 Feb 2022 18:17:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SIiALB89CWI2TAAA9RJhRA (envelope-from ) for ; Sun, 13 Feb 2022 18:17:19 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7397D146E0 for ; Sun, 13 Feb 2022 18:17:19 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 35DC85F6B5; Sun, 13 Feb 2022 17:17:17 +0000 (UTC) Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by mail.notmuchmail.org (Postfix) with ESMTPS id A2E875F401 for ; Sun, 13 Feb 2022 17:17:15 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1644772631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ctKDQJe9S+rQk2ok5pFWu8EmJAAQnpt4eTordH0bEQ4=; b=hEgu+lj8QR+MVDfiKVjofkdw7s1ae9Q4i8HgLVq8lX7ti1AsdLHkE7epJrbFBizIyXSl2z TSoVCYUtLQhSNwJ6LEJVsvmhuxIL+/m8yiZNSFr+D9YZteUaaIZ8hQLB9rU2vsp+pHMcxc k5TFoDLMs/UO+kaXPlLyhJCyyURvZwKoVXVaVAEVCWAvjGSeaCsuc0K3UFRb0e/xaId59y nJWzTRiHFWmppHNszuysXRAwk/7i0nwTCfS2QvtKMXcgf4/Tgwbc1gHBZCnivpjTZngQVv ZLcKSs4T1wxFlnfSmvj08PcIll7u3ce68P83zzdbqQy7tx9ViaHYlvLF9AncAw== From: Kyle Meyer To: Sean Whitton Subject: Re: [PATCH v2] nmbug: write tags out to a temporary file, not 'nmbug.index' In-Reply-To: <20220213165408.972859-1-spwhitton@spwhitton.name> References: <20220213165408.972859-1-spwhitton@spwhitton.name> Date: Sun, 13 Feb 2022 12:17:09 -0500 Message-ID: <87y22ebsa2.fsf@kyleam.com> MIME-Version: 1.0 Message-ID-Hash: 3BJPRS7NHPRET4UEK67URKI4O77PUUPH X-Message-ID-Hash: 3BJPRS7NHPRET4UEK67URKI4O77PUUPH X-MailFrom: kyle@kyleam.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 CC: notmuch@notmuchmail.org X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644772639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=LgrXVVA+PajgDa3TwY5M2RvrOQiEmuX5oCc3SO5q1rU=; b=rY9qS/35q2KEufYLVIz4aRORGXKleXoMbpInMJSkFOR/Khf0ZeBhH1uf6nBZdln29xzghO 4zl63iSWW48xQl8XJOqxnAJgw/gDOiuFsOj5PtJAkvYe2G4Gcmt94hlDlC9HKe6i4TUKUP 3ApxNYaAyEutUp3VihcTWq8zZ3qjHZ/srueBDaFk7+vnk4dsgt4URE/IsDYSoqurCOf+Gr o3E6fpIJ5ACHDAKbNDuIEuVnqWSSroCFaxFH/jI6+HyxfG6QtFvSfsEGKOoW4aCG2IWkbQ BBtQmdIFtzxbERnOfYS7rDrpadocmnPfK47rP2tg+/KtLPJlhqp69Nl3207mRg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644772639; a=rsa-sha256; cv=none; b=qer5ow61rQ6RgPuGHvWE2dJEYxduVsB9ay78GxPxDe3dTNaJSn/WSw+GaCIEijlIGIAgOQ ljw3EVYQnh7uoAkoREFuE5uLpvhEncKTghyhjE/QhiCix/UtmRZupiD1rzsYpIRql4iF3+ zeFSogM0EYRuPHoJPm0LV8qYD4g/ryc8gW1P88venP44kl/C0VFW9tSDTsV+xWVcXpNPBL oLQjqy0U/wDd8K1qRswLb50as8zPHc5XoYovQsPYlxl8gb93g60BHpCHw91+Jn1MQIAA+9 pSo/uLD54U0cRPyDJSt/DHFtCp87GsVTdH6NdlirhZrUGgBRWAXmlI86abHWZQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=kyleam.com header.s=key1 header.b=hEgu+lj8; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.44 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=kyleam.com header.s=key1 header.b=hEgu+lj8; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 7397D146E0 X-Spam-Score: -1.44 X-Migadu-Scanner: scn1.migadu.com X-TUID: HA9sSdc4AHvZ [ drive-by comment based on a past mistake :/ ] Sean Whitton writes: > -def _index_tags(): > - "Write notmuch tags to the nmbug.index." > - path = _os.path.join(NMBGIT, 'nmbug.index') > + (_, index) = _tempfile.mkstemp() [...] > _git( > args=['read-tree', '--empty'], > - additional_env={'GIT_INDEX_FILE': path}, wait=True) > + additional_env={'GIT_INDEX_FILE': index}, wait=True) It's better to put the temporary index in $GIT_DIR due to this bit noted in git-read-tree(1): The file must allow to be rename(2)ed into from a temporary file that is created next to the usual index file; typically this means it needs to be on the same filesystem as the index file itself, and you need write permission to the directories the index file and index output file are located in. So, assuming NMBGIT matches $GIT_DIR, perhaps change the above mkstemp call to something like _tempfile.mkstemp(dir=NMBGIT, prefix="nmbug", suffix=".index")