From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id AA6YCXYS7mbDSAAAqHPOHw:P1 (envelope-from ) for ; Sat, 21 Sep 2024 00:25:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id AA6YCXYS7mbDSAAAqHPOHw (envelope-from ) for ; Sat, 21 Sep 2024 02:25:26 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=pengjiz.com header.s=fm3 header.b=x+sglbz+; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm2 header.b=cZzPrTNS; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726878326; 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=YUhOggr8c2d8nyGt207c4YlLaG/HumGpxiGK9pagsJc=; b=TCAFsNQEZJS7aQpcc2UEZfBbezevsa/L7K/CvgG6HmeSWUSSrqicYYTqn+HDqMSaxKT42u +Ev+G4bw8EdMpHZT3x1IBhnxDniAmLoIvz6Xw3bCQjKh5metJWGbcjWDwBZerZ3bxtBfIt CnSzxK9QfVERN5r5R8OZXi4atUh9dZ4Rpy535ZiZqYDVpJ8D+PJTXCaM31aXzWRjgj2bBZ sf63Z44mMpTQoEY33qhrWzZrhsW7sGkYby1CeB49TlJr+CtB+y9O6XZcWjX2Eo9QrnQIWw bm5AENK5txGyL3+tmrRgekIHVWKDBGkd/UVJ93sn1DpfrBhsjEQ22fu/fgalcA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726878326; a=rsa-sha256; cv=none; b=QyLyE8gTrscNqf7p3JIhgBFGHlFux1be8l87bDrAUjiBedXp1ksi9ygh21471qJl3iatw8 YTWVTkdw8X06gWzq9qC9CpOEZafg3aqfxVZvDQgA1KCv04eojxaSc2i7lame1TM3huepo6 TBM5VsdQBFLK26ecV3qIqe6XB0gfL/f2XuqhCB8U+nRJSUQUc46wWG9KTXdBjTzFbKA417 WKse1Nnw/DCsEjl44Kms8IaRgU9nC7voGlFRhvln/srZ9gKd6W37cnznrkfBWp63wtBJaE h5lbj7U6uqBaRDGHtEd4tVQAx5r/Tqhd7U+i9QGbqCt22+p30MWYaqcBxDwFqg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=pengjiz.com header.s=fm3 header.b=x+sglbz+; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm2 header.b=cZzPrTNS; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (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 0477279154 for ; Sat, 21 Sep 2024 02:25:23 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 393C25F7EB; Sat, 21 Sep 2024 00:25:20 +0000 (UTC) Received: from fout8-smtp.messagingengine.com (fout8-smtp.messagingengine.com [103.168.172.151]) by mail.notmuchmail.org (Postfix) with ESMTPS id B16D15E2A4 for ; Sat, 21 Sep 2024 00:25:16 +0000 (UTC) Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id 1C8EC1380225; Fri, 20 Sep 2024 20:25:15 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Fri, 20 Sep 2024 20:25:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1726878315; x=1726964715; bh=aXLWyM8mdr 3pDrgCwkYDDdesNuaOjEig7IHFpydwCMQ=; b=x+sglbz+Y5mwCRPfgou2UmvlKy eZVlhGi2EWit3EEQU34tU3av8bpAdGU69gKGVrB95o7Cy0NrgB40brMUDazep0tw tGWAwe0oEugWrGokDKZ5z0cbEguM8Afb8+T/wfDPEEBMXzT78HXyJjx9oUeGysmh hbg0PNh8h2eqgntRCnVgZSt3+XEbo6VaRjVFl68EB0TpTznU1Ugy0KNvEsjsjR9g L/DHq3zp+fXGfm/bE88LKn9ToxM9Ft4TPbhVfVtOVBUUaC9anoC9MD/lltwQNPLA cJyA3MZvARB0gDJ5U/dtT4B5hR4UW/+PD3XKdt/ZFei/p5y1ZxNNMQFGRiCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1726878315; x=1726964715; bh=aXLWyM8mdr3pDrgCwkYDDdesNuaO jEig7IHFpydwCMQ=; b=cZzPrTNSpv02W3mHlM+eUmnM6MvBaqD2QPD+/eIgEOCm f+za4o6LPqEeVxF3zWCe6Q6+ij5gDJi4crT0zBVPFCFNsBe6zvcC0829WySj/a7n ZVyIsRU2rwgEIllzqP/tjgl+1XKxZoAqR/mzqwlu/h/fBI9h8GuIoJ11PefVaV8O B+4p1M37awWaysxxVnxGfgs/G1sOesvmVPim3xk4hxEWeIBhbmaewwUM5TGxHO7t FOYSv8ClKVk+Wh3xmqu86pmmXAlLOBqaPP07PrWrQMK0gGOHHyKd6qzBrSZOJgNl LPokuaUepEdbJxMo7c7iMl3UHrRjOnMWRSo2a7cL4Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudelgedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecu hfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomheqne cuggftrfgrthhtvghrnhepgeefieeivddukeeitdegudeftdevtdeuteeifffhvdehffet gfeijeeileelheegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsggprhgtphhtthhopedvpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehnohhtmhhutghhsehnohhtmhhutghhmhgrih hlrdhorhhgpdhrtghpthhtohepfhhrvgguvghrihhksehofhgsrdhnvght X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Sep 2024 20:25:13 -0400 (EDT) From: Pengji Zhang To: notmuch@notmuchmail.org Subject: Re: searching for a message by path In-Reply-To: <20240920175232.zryeqyl76nbydiab@localhost> References: <20240920175232.zryeqyl76nbydiab@localhost> Date: Sat, 21 Sep 2024 08:25:10 +0800 Message-ID: <87zfo1dfa1.fsf@pengjiz.com> MIME-Version: 1.0 Message-ID-Hash: 6NXJTMDVCSZB6KJVEPCKJZGF7QUOZVWU X-Message-ID-Hash: 6NXJTMDVCSZB6KJVEPCKJZGF7QUOZVWU X-MailFrom: me@pengjiz.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Frederick Eaton 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-Transfer-Encoding: 7bit Content-Type: text/plain; format="flowed"; charset="us-ascii" X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -2.58 X-Migadu-Queue-Id: 0477279154 X-Spam-Score: -2.58 X-TUID: JsuFo4tjRCNh Hi Frederick, Frederick Eaton writes: > I am trying to figure out how to adapt a script I wrote for > filtering messages, to apply notmuch tags to each message. A > difficulty is that the messages are already in the Notmuch > database, because another tool has delivered them to a maildir > and run "notmuch new". > > Now, Notmuch can provide me with the paths of all the new > (unfiltered) messages, which I can give to my script. The > question I have is, once the filter is done, how can the script > tell Notmuch which message to apply the tags to? I am not sure if I understand you correctly. If the problem here is to distinguish existing messages and new messages, would the config option 'new.tags' work? For example, use notmuch config set new.tags new to give all new messages a 'new' tag. > I've tentatively concluded that the best way to locate each > message in the Notmuch database is to extract the Message-ID and > search for it with "id:"? But the FAQ says that multiple > messages can have the same Message-ID (and some spam messages > don't have one at all). IIRC, in the Notmuch database tags are associated with message IDs, so you probably do not need to worry about this. > If I could access the message using the filename that the script > is processing, it would seem slightly more reliable. It seems > like there should be some way to allow a Notmuch database entry > to be accessed directly by filename, without even creating a > Notmuch-style search query containing that filename, but rather > by passing the filename as a command-line argument to "notmuch". > It would be nice not to have to worry about quoting and > unquoting. I am not sure if this is useful, given that (presumably) Notmuch uses message IDs as keys. Besides, those filenames are usually generated automatically and quite cryptic. > When I try to search for a message using "path:", nothing seems > to work. > > [...] > > There were no results for any of the "path:" searches, although > the "id:" search worked. I am using version 0.32.2 and can > update if this may be related to a bug that was fixed in the > past few years. I have never used 0.32.2 so I am not sure if there are any differences, but for version 0.38.3, the prefix "path:" is used to search for messages in some *directory*, and the query should be *relative* to the maildir. I highly recommend the manual page 'notmuch-search-terms(7)' and also other pages if you have time. They are informative and well written, and very helpful for writing message processing scripts. Regards, Pengji