From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id cLooG/3A7WY6PgAAqHPOHw:P1 (envelope-from ) for ; Fri, 20 Sep 2024 18:37:49 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id cLooG/3A7WY6PgAAqHPOHw (envelope-from ) for ; Fri, 20 Sep 2024 20:37:49 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=ofb.net header.s=ofb header.b=neyaHSQP; 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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726857469; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=vvhob0jieWIQdRCACn6kg6rLA+QTs6/BRH58KRbVicY=; b=Kdd0wUYGCdJkkeNpfvwj0MiCsGNlJ6oBlCVXmsNGImic9ja2n9JeI0hoVxktMhwZQeO2EQ oHxCLEEBh3Nm1fNee01rHT+VuRRT2fpDx64yavRGZq47CQq0kSDRnSxSZsaqQ0/umA0LoT vdrC8o5+QBow33z2KC1sSkIlr/QiQ17DsZfw/blm48Z8NmEx6DBTgz68m90sHz7TUjSMwn H1bXRQ6nShTITGSoupjpxunERKxz/PMadVnpbcnX1JyPsHM2y2k5ge74cSPIklgfwbblXQ ynutV9wddevD2IaZrVjzsqrUL18dgxLdHMGymbCF7Gcfg5NadUy0ju0ivlFzaQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=ofb.net header.s=ofb header.b=neyaHSQP; 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; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726857469; a=rsa-sha256; cv=none; b=uyEtptJtMcs29qdiZ+uZnsRN6bh4WqMp/MUFrM9u+3id3rqNDAMD8Q8/ByRf+zH7+qzG2k 5/OVYoKBLAd6BVcB8BajrHdR6pvgYy6YitlNZGwVfH7xL4v06vOdLfko32yc1ZpTyf8h0U W4DVzpZ+XlG4+QEYWb0c7tViAkgY24Cz17SroIh28jkLbi1lE+/cZlyxIYfE0hx3Oco2gA sNSjiehuEtPwO74VwrZAlxENWYcz7prMan49kgeHAifTJxaFICCyHjtHCyELGEcQG3+FRb HCEE5jxuiKy5uaG1MovBaHL2wHsVaAH9mx7DlKDaK9AYlLBiiqdZ9MejmYhkGw== 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 16B957B624 for ; Fri, 20 Sep 2024 20:37:48 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7F1375F7EB; Fri, 20 Sep 2024 18:37:37 +0000 (UTC) X-Greylist: delayed 338 seconds by postgrey-1.36 at yantan; Fri, 20 Sep 2024 17:58:13 UTC Received: from egnor-2020.ofb.net (egnor-2020.ofb.net [IPv6:2600:3c01:e000:3d3::1]) by mail.notmuchmail.org (Postfix) with ESMTPS id CB23C5E510 for ; Fri, 20 Sep 2024 17:58:13 +0000 (UTC) Received: from ofb.net (ofb.net [104.197.242.163]) by egnor-2020.ofb.net (Postfix) with ESMTP id 78D284E3D5F for ; Fri, 20 Sep 2024 17:52:33 +0000 (UTC) Received: from localhost (unknown [50.247.104.190]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ofb.net (Postfix) with ESMTPSA id 0519A41202; Fri, 20 Sep 2024 10:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ofb.net; s=ofb; t=1726854753; bh=HzFiNeV/tofPJj8uhlWpKlGK9KfnfRoNskVkdlXbcqo=; h=Date:From:To:Subject:Reply-To:From; b=neyaHSQP+kZyyTKOVlk5UL1B/szmFA/6MWg78NaKdhSAY0vJNJTRHGeC5BDDec2tf LLvtWvS+PmM4y5KoYjkazywPk3mbvlbqN1lDs4qZ6SlKcC0YRu8rWovUzTEbcIt4Gm eBCuQRja0vqOEzkF7QhabTd8dLachVFGlVF9/qv/m09fZft9n6MqO6b0cLHxodzQwZ 6YE+bp4e+9S3iluFQLIrCzGa2rzUT5EQ5QGnza39dIUdC0liwyLbJkSiGeF7NE3lMf s2E28sqbYcFVmdZ31V4UohaUKjO76ey8kVpKftuYX5aHyot0WqN9+f+x2OVJHP9uN8 CpZdWBT/jDSpg== Date: Fri, 20 Sep 2024 10:52:32 -0700 From: Frederick Eaton To: notmuch@notmuchmail.org Subject: searching for a message by path Message-ID: <20240920175232.zryeqyl76nbydiab@localhost> MIME-Version: 1.0 Content-Disposition: inline X-MailFrom: frederik@ofb.net 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 Message-ID-Hash: RGPZIZOYAZWARPT3ZGL457NPSGFCIMFB X-Message-ID-Hash: RGPZIZOYAZWARPT3ZGL457NPSGFCIMFB X-Mailman-Approved-At: Fri, 20 Sep 2024 18:37:35 +0000 X-Mailman-Version: 3.3.3 Precedence: list Reply-To: frederik@ofb.net 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"; format="flowed" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Migadu-Queue-Id: 16B957B624 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -2.02 X-Migadu-Spam-Score: -2.02 X-TUID: I2A+IYj7lhIZ Dear Notmuch, 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'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). 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. When I try to search for a message using "path:", nothing seems to work. $ notmuch show id:"enwiki.66eda276579298.42329355@en.wikipedia.org" | grep filename message{ id:enwiki.66eda276579298.42329355@en.wikipedia.org depth:0 match:1 excluded:0 filename:/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2, $ notmuch search id:"enwiki.66eda276579298.42329355@en.wikipedia.org" thread:000000000003a7a9 33 mins. ago [1/1] Wikipedia; Wikipedia page SpaceX Raptor has been changed by Canterbury Tail (important inbox unread updates) $ notmuch search path:"/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2," notmuch search: A Xapian exception occurred A Xapian exception occurred parsing query: unmatched regex delimiter in '/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,' Query string was: path:/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2, [1]$ notmuch search path:"\/home\/me\/mail\/notmuch\/gmail-me\/mail\/cur\/1921042a466e0b3b:2," $ notmuch search path:"\/home\/me\/mail\/notmuch\/\/gmail-me\/mail\/cur\/1921042a466e0b3b:2," $ notmuch search path:"*1921042a466e0b3b*" $ notmuch search path:".*1921042a466e0b3b.*" $ notmuch search path:"/.*1921042a466e0b3b.*/" $ notmuch search path:"notmuch/gmail-me/mail/cur/1921042a466e0b3b:2," $ notmuch search path:"notmuch//gmail-me/mail/cur/1921042a466e0b3b:2," $ notmuch search path:"gmail-me/mail/cur/1921042a466e0b3b:2," $ notmuch search path:"mail/cur/1921042a466e0b3b:2," $ notmuch search path:"cur/1921042a466e0b3b:2," $ notmuch search path:"/\/home\/me\/mail\/notmuch\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,/" 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 am not subscribed so please kindly Cc me if you have any ideas. Thank you, Frederick