From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id +KgZIuufYWbsOAAAA41jLg (envelope-from ) for ; Thu, 06 Jun 2024 13:39:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WNrWGeufYWbBogAA62LTzQ (envelope-from ) for ; Thu, 06 Jun 2024 13:39:23 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=tethera.net header.s=2024 header.b="Z/D/mgDQ"; 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=1717673963; h=from:from: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=ait2i8rPTzQCZ4O7iRJTviKTkX5kb3A8zjWTjkSItHc=; b=QbULyavqB2rBCzB0gkf6gQAATJFEFP0rF5J/+zUfH5mp3OLfNsVzGJU7aBsnXlIFBOHfr6 StCjNwkQotoIdVMGHBbFjdnhokm+C1f79cV4DUSzV14wvImVkLRqLDoPCekZ6AiBFg6MLD yICJiVchYfM24XEDVEjTNWOr/L7Uoo+qBVvJSDb7YUkudDCMYKjEWiRRYBjXo/PNb6V14K 75/vGZrMCDzyvWt2RNWXOwTIL1yB4pkUIi7eRVOcDN1pt7+IJKtmHr5TCa1Gte5IXyg3vv 8CiU/ncfKOsVhNC0Tod/IJVm6wepH7kfdDUOlHQw9yGsSMSRO3AVYwxK7Xh2aA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=tethera.net header.s=2024 header.b="Z/D/mgDQ"; 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-Seal: i=1; s=key1; d=yhetil.org; t=1717673963; a=rsa-sha256; cv=none; b=oCWYC8rGT96+ZVdLFmeHMWuI0+S5sfea2ZjQGwIvrlMrmqDkww3l+7N7Ib/kYV9zVzGjKQ bDfMeodEUKy8ivFtLbR8dG7ixp7KXIVZARvlTxgkq3P7nKBWjMcQCK0siBsyS8eY1IvRTr Nilt13pi40RLyYS0JzhMfsplN87C0DU38wc4wKfWZyIcghRXs1GEHE20zWF8vhTK996tGJ TyMPQGFKXEYr8RCsoyEJr9UZNf8LdRaRg9Vd/93segL8y3a1NjX4pY48qbyyxIrqgVHLPX +Mv7a4UktPHnnKDcr0M7yCy/ZQzYuFVOFuG3TytdCB427Cq+m+K14SLd6G412w== 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 C70843A032 for ; Thu, 6 Jun 2024 13:39:22 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 0B58A5F7FE; Thu, 6 Jun 2024 11:39:14 +0000 (UTC) Received: from phubs.tethera.net (phubs.tethera.net [192.99.9.157]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8361A5E526 for ; Thu, 6 Jun 2024 11:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tethera.net; i=@tethera.net; q=dns/txt; s=2024; t=1717673948; h=from : to : subject : date : message-id : mime-version : content-type : from; bh=1k+aSIAT7Es7spuNT2fi+LSpJzACYORFM2p0+Y/H3R8=; b=Z/D/mgDQqtm8Aagqngplt3UNTbooxQ+mBY9xonG0vyZSKxZZAFSvpbcQ15MFFGD7KU3Iz V8skRrDOLss62sNcnUUqkHg++7H5rhg0TDV35Ubt3jpCaF1srAONnlDSuOFNmTIPiH0kIS9 b03M70IHCkI0o9pS5TQiWWOKRHBwFPb1EZKB4xeHC3M0d4Egr0tx+FVnkWZOdtKTcx7YExT wtpwVYRfhD3eHmtqwPQUHMO4DYQJKXbWuBmX0K360H0OGduuSX2Yjrau9jzzHI/sH2su0ch 92GbrmfTDQRG9IxjveWcIDa6GqNUlSy9TINTQLamMn3U9hfnWaMYPiBeI2eQ== Received: from tethera.net (fctnnbsc51w-159-2-211-58.dhcp-dynamic.fibreop.nb.bellaliant.net [159.2.211.58]) by phubs.tethera.net (Postfix) with ESMTPS id 70112180181 for ; Thu, 6 Jun 2024 08:39:08 -0300 (ADT) Received: (nullmailer pid 2546759 invoked by uid 1000); Thu, 06 Jun 2024 11:39:07 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: tags starting with / are effectively forbidden X-List-To: notmuch Date: Thu, 06 Jun 2024 08:39:07 -0300 Message-ID: <875xums3l0.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: OX5SXOG6QHMB2DUNRL5JWK36OPNASNSX X-Message-ID-Hash: OX5SXOG6QHMB2DUNRL5JWK36OPNASNSX X-MailFrom: david@tethera.net 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 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 X-Migadu-Spam-Score: 2.46 X-Spam-Score: 2.46 X-Migadu-Queue-Id: C70843A032 X-Migadu-Scanner: mx13.migadu.com X-TUID: Efl1+XTJp2xa Via ukleink on IRC % notmuch tag --batch +/foo -- id:87edveqpj6.fsf@tethera.net notmuch tag: A Xapian exception occurred A Xapian exception occurred parsing query: unmatched regex delimiter in '/foo' Query string was: ( id:87edveqpj6.fsf@tethera.net ) and (not tag:/foo) % notmuch tag +/foo -- id:87edveqpj6.fsf@tethera.net notmuch tag: A Xapian exception occurred A Xapian exception occurred parsing query: unmatched regex delimiter in '/foo' Query string was: ( id:87edveqpj6.fsf@tethera.net ) and (not tag:/foo) The problem here is the implicit query to avoid re-tagging things already tagged /foo. There is some unfortunate use of strings to construct a query in notmuch-tag.c. This string is parsed by same parser as other notmuch queries, which means it attempts to support regexes. In retrospect using strings to construct queries is pretty obviously a bad idea, but we don't currently have a C API for constructing queries. The closest is the sexp parse, but this would still require constructing a serialized query (as a sexp) and then parsing it again. Some potential solutions (roughly in order of effort and flexibility) include - pushing the query optimization code inside libnotmuch, using the Xapian API directly. This has the advantage that it makes it available to all bindings users. - extend the notmuch_query API to allow updating the underlying query using some operator and a single term, something like notmuch_query_modify(query, NOTMUCH_OP_ANDNOT, "tag", "/foo") - providing a low level wrapper around Xapian::Query, taking care of translating prefixes. At the moment I think only this last would allow the elimination of constructing strings in the CLI code to pass to libnotmuch. d