From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2K6gHpVJsF58FQAA0tVLHw (envelope-from ) for ; Mon, 04 May 2020 16:57:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id uOriJJ9JsF7OHgAAB5/wlQ (envelope-from ) for ; Mon, 04 May 2020 16:58:07 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 24C7694477C for ; Mon, 4 May 2020 15:17:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2FD696DE0222; Mon, 4 May 2020 08:17:09 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M36apBaRHYGI; Mon, 4 May 2020 08:17:08 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 328AF6DE0F88; Mon, 4 May 2020 08:17:07 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id ED2E16DE0F88 for ; Mon, 4 May 2020 08:17:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ofs_NGvMkshg for ; Mon, 4 May 2020 08:17:03 -0700 (PDT) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by arlo.cworth.org (Postfix) with ESMTPS id 968C36DE0222 for ; Mon, 4 May 2020 08:17:03 -0700 (PDT) Received: by mail-wr1-f66.google.com with SMTP id x17so21415872wrt.5 for ; Mon, 04 May 2020 08:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:in-reply-to:mime-version:date:message-id; bh=CTGGdafZCTyyogOxjIWVNETOfT9PYmSQTWO0AoRn1eM=; b=CD6wwp14uxUFZx2H8EpHnddDFVaRITcK0XEJ43jkwZdQ6EKznocqcfmi9jhzYY7YRg D/esB6H9GVq/B5ET9xlzdKIG7LXWTl/1TZeEG+VOSlH1C81gwEWvcNcokMfzeo4oTs5+ 3yOtJh4X11dI2K6MjII8R/C2yln65Mi6d5BSzoTaxj5Er5+ODXOG0DSdaqch8VDNNU0+ 3Z+XzBvZ/fXLV116E52f4M+b1hluu1q1n1OG+TuIxi65KFuv9Xtc6RGEfuWhdxSck66v wNLXm9KiLWdmqDD75LqsBmgngWjNcf7ljRX4MD8lOrXJHxNWWVteJukimoQpOCOTmxxN VHNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:in-reply-to :mime-version:date:message-id; bh=CTGGdafZCTyyogOxjIWVNETOfT9PYmSQTWO0AoRn1eM=; b=KHmzFuLMLPut+f9Bo0znNMRapIm7PKMEr2pX/CJ0Di0Fc9oHkKrJ2GeRDZqHxzXbxJ zhzdLKGyfe+Qb5ZSKIoBTmKdaGYdL3Uxvdq4YNmJCZB5baRAwZQk+1PjISr+ibutRoa2 KLfXZ+ruDPgnhS+U5GsWse3/GFUQ/Uabw8H8TjjGv8npRisVf0MplYggprjfQeLZAP/Q b/WWAcmmT5c/EgFpYBXK7QWRnJTpF7XyPJPpiYbvyZG/jKPDQoHuXqeN3LwwFhiKVkEU LjXIIV/DwvRFuJwjWuPJDIr/Oe7iHODa6KQ4JfOLW42tGx4HDO4bXTjDCaiMiZwRHXKf IdEQ== X-Gm-Message-State: AGi0PuZESsr/NsoBMNRpJL9tyR9PjP+W3YC0XXC21XSsHWPAF5X/1caQ 6V/GL08M3/LX02AUaYV1zRfCaciU X-Google-Smtp-Source: APiQypKUHQfSE17NvWsl0/YyLV7bJZr1JcaaKpYHyuif+AnU45mcdte10nI3SrLOn3ETXQVlehyenQ== X-Received: by 2002:a5d:6985:: with SMTP id g5mr20249137wru.398.1588605422024; Mon, 04 May 2020 08:17:02 -0700 (PDT) Received: from localhost ([79.116.154.70]) by smtp.gmail.com with ESMTPSA id g10sm7030725wrx.4.2020.05.04.08.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 08:17:01 -0700 (PDT) From: Franz Fellner Subject: Re: [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms To: David Bremner , David Bremner , notmuch@notmuchmail.org References: <87h7wvg6oq.fsf@tethera.net> <20200504140024.1617656-1-david@tethera.net> <20200504140024.1617656-2-david@tethera.net> In-Reply-To: <20200504140024.1617656-2-david@tethera.net> MIME-Version: 1.0 Date: Mon, 04 May 2020 18:16:54 +0300 Message-Id: <1588605414-ner-8.194@TPL520> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 0.59 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=CD6wwp14; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [0.59 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.46571425880698]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:c]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; DWL_DNSWL_FAIL(0.00)[50.126.95.6:server fail]; FREEMAIL_FROM(0.00)[gmail.com]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.18), country: US(-0.00), ip: 50.126.95.6(-0.47)]; DKIM_TRACE(0.00)[gmail.com:-]; MX_GOOD(-0.50)[cached: notmuchmail.org]; MAILLIST(-0.20)[mailman]; RCVD_IN_DNSWL_FAIL(0.00)[50.126.95.6:server fail]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[alpineartde@gmail.com,notmuch-bounces@notmuchmail.org]; RECEIVED_SPAMHAUS_PBL(0.00)[79.116.154.70:received]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[notmuchmail.org:email,tethera.net:email]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; HAS_LIST_UNSUB(-0.01)[]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: LMBHIoUHvxF3 Thank you very much. I confirm that the patch fixes the issue. Regards Franz On Mon May 4 11:00:24 2020, David Bremner wrote: > strncmp looks for a prefix that matches, which is very much not what > we want here. This fixes the bug reported by Franz Fellner in > id:1588595993-ner-8.651@TPL520 > --- > lib/message.cc | 6 +++--- > test/T700-reindex.sh | 1 - > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/lib/message.cc b/lib/message.cc > index 5c9b58b2..0fa0eb3a 100644 > --- a/lib/message.cc > +++ b/lib/message.cc > @@ -751,9 +751,9 @@ _notmuch_message_remove_indexed_terms (notmuch_message_t *message) > > const char *tag = notmuch_tags_get (tags); > > - if (STRNCMP_LITERAL (tag, "encrypted") != 0 && > - STRNCMP_LITERAL (tag, "signed") != 0 && > - STRNCMP_LITERAL (tag, "attachment") != 0) { > + if (strcmp (tag, "encrypted") != 0 && > + strcmp (tag, "signed") != 0 && > + strcmp (tag, "attachment") != 0) { > std::string term = tag_prefix + tag; > message->doc.add_term (term); > } > diff --git a/test/T700-reindex.sh b/test/T700-reindex.sh > index 7b7e52de..3d7c930d 100755 > --- a/test/T700-reindex.sh > +++ b/test/T700-reindex.sh > @@ -34,7 +34,6 @@ notmuch dump > OUTPUT > test_expect_equal_file initial-dump OUTPUT > > test_begin_subtest 'reindex preserves tags with special prefixes' > -test_subtest_known_broken > notmuch tag +attachment2 +encrypted2 +signed2 '*' > notmuch dump > EXPECTED > notmuch reindex '*' > -- > 2.26.2 > > > --