X-Envelope-From: notmuch-bounces@notmuchmail.org  Sat Apr 18 06:54:00 2026
Return-Path: <notmuch-bounces@notmuchmail.org>
X-Original-To: nmbug@yantan.tethera.net
Delivered-To: nmbug@yantan.tethera.net
Received: from yantan.tethera.net (localhost [127.0.0.1])
	by mail.notmuchmail.org (Postfix) with ESMTP id B8BD95F5BA;
	Sat, 18 Apr 2026 06:54:00 +0000 (UTC)
X-Greylist: delayed 521 seconds by postgrey-1.36 at yantan; Sat, 18 Apr 2026 06:53:56 UTC
Received: from mail0.khirnov.net (mail0.khirnov.net [IPv6:2001:67c:1138:4304::3])
	by mail.notmuchmail.org (Postfix) with ESMTPS id D84FB5F5B3
	for <notmuch@notmuchmail.org>; Sat, 18 Apr 2026 06:53:56 +0000 (UTC)
Authentication-Results: mail0.khirnov.net;
	dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=IVVyv16n;
	dkim-atps=neutral
Received: from localhost (localhost [IPv6:::1])
	by mail0.khirnov.net (Postfix) with ESMTP id 5A21324AD60;
	Sat, 18 Apr 2026 08:45:13 +0200 (CEST)
Received: from mail0.khirnov.net ([IPv6:::1])
 by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP
 id vljG1T7A6xWV; Sat, 18 Apr 2026 08:45:12 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail;
	t=1776494712; bh=H2SIYt3euBWZK0CiUjB8vAM0VtYNuloxrf1/XSlWzXA=;
	h=Subject:From:To:In-Reply-To:References:Date:From;
	b=IVVyv16nWyJsCFk9otgufPf43FM1NZ42nEUfjnQn4DLnkr0YVbADrE14HrIIn/X+i
	 Ckr9Dsi9oTJ8oRVsT7exkqcXPKOj4Sf3G/1HRnej2wbgMF3hU0+onAueTQjRlpnUyR
	 C44NVFcmhQrk4aUPlQK7vvfoF5V6Mbv7xfVTWzS0gTwxRB7n7PXmdnUPVFHQklbWpD
	 8tTH1EFcuM25QxFjzAPxVP569cuAZ3Jt5ZfkxIxo7dZ6Bij3XRNynItmIvBdEnHym+
	 IJFuqM5Ba+SEqb65Dny0shEP19c6KXBBHJBxZxBVLZ9FFwPXBCq5qcTyA7caEUP3CB
	 u7WAzm20T/vIw==
Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3])
	(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
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK))
	by mail0.khirnov.net (Postfix) with ESMTPS id 52ED524AC1C;
	Sat, 18 Apr 2026 08:45:12 +0200 (CEST)
Received: by lain.khirnov.net (Postfix, from userid 1000)
	id 31AEE160036; Sat, 18 Apr 2026 08:45:12 +0200 (CEST)
Subject: Re: [PATCH v4 3/6] test: add tests for attachment filtering
From: Anton Khirnov <anton@khirnov.net>
To: notmuch@notmuchmail.org, David Bremner <david@tethera.net>
In-Reply-To: <875x679oph.fsf@tethera.net>
References: <20260307160342.16482-1-anton@khirnov.net>
 <20260307160342.16482-4-anton@khirnov.net> <875x679oph.fsf@tethera.net>
Date: Sat, 18 Apr 2026 08:45:12 +0200
Message-ID: <177649471218.3642.17560604114132265244@lain.khirnov.net>
User-Agent: alot/0.8.1
MIME-Version: 1.0
Message-ID-Hash: T3PFEPNAGCPGNSA73RQPVLUB7ZSUOMET
X-Message-ID-Hash: T3PFEPNAGCPGNSA73RQPVLUB7ZSUOMET
X-MailFrom: anton@khirnov.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." <notmuch.notmuchmail.org>
List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
List-Owner: <mailto:notmuch-owner@notmuchmail.org>
List-Post: <mailto:notmuch@notmuchmail.org>
List-Subscribe: <mailto:notmuch-join@notmuchmail.org>
List-Unsubscribe: <mailto:notmuch-leave@notmuchmail.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Quoting David Bremner (2026-04-04 09:20:10)
> > +
> > +test_begin_subtest 'input ignored'
> > +notmuch config set index.filter "/bin/sh -c 'echo secretstring'"
> > +notmuch reindex '*'
> > +notmuch search "secretstring" | notmuch_search_sanitize > OUTPUT
> > +test_expect_equal_file EXPECTED OUTPUT
> > +
> > +test_begin_subtest 'input consumed'
> > +notmuch config set index.filter "/bin/sh -c 'cat - > /dev/null; echo secretstring'"
> > +notmuch reindex '*'
> > +notmuch search "secretstring" | notmuch_search_sanitize > OUTPUT
> > +test_expect_equal_file EXPECTED OUTPUT
> 
> I'm curious here, how does a failure manifest?

The test hanging while waiting for the pipe to become writeable is a
typical failure I'd expect here.

> 
> > +
> > +test_begin_subtest 'interleaved IO'
> > +# this filter interleaves reads of increasingly large weird-sized blocks
> > +# with writes
> > +notmuch config set index.filter '/bin/sh -c "
> > +bs=53;
> > +while true; do
> > +    dd bs=\$bs count=1 2>&1 >/dev/null | grep -q \"^0+0 records in$\" >&2 && break;
> > +    echo \$bs;
> > +    bs=\$((\$bs+48));
> > +done;
> > +echo secretstring;
> > +"'
> > +notmuch reindex '*'
> > +notmuch search "secretstring" | notmuch_search_sanitize > OUTPUT
> > +test_expect_equal_file EXPECTED OUTPUT
> > +
> > +test_begin_subtest 'exit failure'
> > +notmuch config set index.filter "/bin/sh -c 'echo secretstring; exit 1'"
> > +notmuch reindex '*'
> > +notmuch search "secretstring" | notmuch_search_sanitize > OUTPUT
> > +test_expect_equal_file /dev/null OUTPUT
> > +
> 
> Is there some positive indication of error we can test for here? I have
> found that testing for empty output tends to hide things failing in
> unanticipated ways.

I don't see how. We do not want a filter failure to abort the whole
indexing run (imagine someone sent you a corrupted zip file) and there's
no other channel for propagating filter errors to the library caller.

There is _notmuch_database_log(), but AFAIU the log contents are not
made available to the user (IIRC we discussed that briefly on IRC last
year). That could of course be changed, but that seems beyond the scope
of this patchset to me.

Cheers,
-- 
Anton Khirnov
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org
