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 mFl/JW30VWAQagAA0tVLHw (envelope-from ) for ; Sat, 20 Mar 2021 13:11:09 +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 2N9xIW30VWArGwAAB5/wlQ (envelope-from ) for ; Sat, 20 Mar 2021 13:11:09 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (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 029EAD17D for ; Sat, 20 Mar 2021 14:11:09 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 795E026ACE; Sat, 20 Mar 2021 09:11:01 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 723711FBA6 for ; Sat, 20 Mar 2021 09:10:59 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 4BB145FA96; Sat, 20 Mar 2021 09:10:59 -0400 (EDT) Received: (nullmailer pid 2254342 invoked by uid 1000); Sat, 20 Mar 2021 13:10:57 -0000 From: David Bremner To: David Bremner , Gregor Zattler , notmuch Subject: [PATCH] lib/n_d_index_file: check return value from _n_m_add_filename Date: Sat, 20 Mar 2021 10:10:52 -0300 Message-Id: <20210320131052.2254248-1-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210318012509.1121007-1-david@tethera.net> References: <20210318012509.1121007-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: CWOFDILWGHQWNS7N6ODHU5BN7QMQY2W7 X-Message-ID-Hash: CWOFDILWGHQWNS7N6ODHU5BN7QMQY2W7 X-MailFrom: bremner@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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616245869; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WUzvQUKKK0D0VlfOgC5K1mGq/dxfh9360gwU2HoWf4g=; b=Z14/cdA+USA1BBfmXUHJXpBPtXhejSNzxqZP3zy9l3F4L+w02xDIvJ2FjdcmO6ye3k6JVF i+U4nCsAaa2lfmUEHL8Mwx/clC6A28QGeF1c2B3rNtlSy/LzBgADFreJb82IDmBVOTDISj 4YeHRu+JdUWVatHn+zThxL7BzJj1XMgg97E0PbmZGnHjIgNeR43C9/Cnba5Gk7gQ4oYwrc xftzFRyiibFJuFT0D+utprqgxN4GFc38FraV0XsLJEwE3aB8Nni2N1SdVdO/mxdM+LfdJa OAVr1b7bn9z7jzTttCG9AJqFps2rKFkab7tprp22lr1eZrISMGTDOqshjMpdXQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616245869; a=rsa-sha256; cv=none; b=IJuz/Rg7mGumJ+RhVU1qm5WfOePfsjUn5MP3KTX2Pk/zkRouzt7Cm8npriCPASVH+p6dN3 j0xvtNx7DcaUPwJhixq9rM9Ml3zugDBSCWbZ+qcXIg971QH3fmqk9+TVQzy6f63AC/gIqJ MgMLYo+EYUGaHN0t4Q7wur3cYc/32o0ULj07vx8PT1PSEZjbwrTHA4rfoSRq5yyiN/Vdy1 QYzQZQIgKAhxYrZ/3MpNG25G9dZHFsyXxQSQQ7uQB9bXPzx3D8D22zx2M/H4CoE3TPxKJR Buz7FewfD+QIaLML1iqtMe64j8m4ZWaLC2n0gUDlFn+PjcLvC5Bn+4V7wAo6Jg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.99 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 029EAD17D X-Spam-Score: -0.99 X-Migadu-Scanner: scn0.migadu.com X-TUID: zZtxf2TOoGM0 Ignoring this return value seems like a bad idea in general, and in particular it has been hiding one or more bugs related to handling long directory names. --- This is not a fix for the aforementioned bugs, but it at least makes clear part of the problem. The XDDIRENTRYnnnnn: terms are not checked for length in the same way as XDIRECTORY terms. It isn't clear the same hashing strategy will work, as the XDDIRECTORY terms are used to create lists of child directories. It may be the best we can do is enforce a limit on the length of path elements in trees indexed by notmuch. lib/add-message.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/add-message.cc b/lib/add-message.cc index 485debad..0c34d318 100644 --- a/lib/add-message.cc +++ b/lib/add-message.cc @@ -529,7 +529,9 @@ notmuch_database_index_file (notmuch_database_t *notmuch, goto DONE; } - _notmuch_message_add_filename (message, filename); + ret = _notmuch_message_add_filename (message, filename); + if (ret) + goto DONE; if (is_new || is_ghost) { _notmuch_message_add_term (message, "type", "mail"); -- 2.30.2