#1135526 notmuch: FTBFS: *ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)

Package:
gcc-15
Source:
gcc-15
Description:
GNU C compiler
Submitter:
Santiago Vila
Date:
2026-05-10 11:25:01 UTC
Severity:
normal
Tags:
#1135526#5
Date:
2026-05-01 23:13:46 UTC
From:
To:
Dear maintainer:

During a rebuild of all packages in unstable, this package failed to build.

Below you will find the last part of the build log (probably the most
relevant part, but not necessarily). If required, the full build log
is available here:

https://people.debian.org/~sanvila/build-logs/202605/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you cannot reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and add an affects on src:notmuch, so that this is still
visible in the BTS web page for this package.

Thanks.
--------------------------------------------------------------------------------
[...]
 debian/rules clean
dh clean --with python3,elpa,sphinxdoc
   debian/rules override_dh_auto_clean
make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_auto_clean
	make -j2 distclean
make[2]: Entering directory '/<<PKGBUILDDIR>>'
rm -rf  util/xutil.o util/error_util.o util/hex-escape.o uti [too-long-redacted] tamp notmuch-*.tar.gz.tmp .deps
rm -rf  performance-test/corpus performance-test/notmuch.cache.* bindings/python-cffi/_notmuch_config.py bindings/python-cffi/notmuch2.egg-info .first-build-message Makefile.config sh.config sphinx.config
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_clean --sourcedirectory bindings/ruby
/usr/bin/make -C contrib/notmuch-mutt clean
make[2]: Entering directory '/<<PKGBUILDDIR>>/contrib/notmuch-mutt'
rm -f notmuch-mutt.1 README.html
make[2]: Leaving directory '/<<PKGBUILDDIR>>/contrib/notmuch-mutt'

[... snipped ...]

        cls=cls, object_hook=object_hook,
        parse_float=parse_float, parse_int=parse_int,
        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.13/json/__init__.py", line 352, in loads
    return _default_decoder.decode(s)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/json/decoder.py", line 345, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/json/decoder.py", line 363, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

T351-pgpmime-mangling: Testing PGP/MIME message mangling
 FAIL   reply to 'Mixed-Up' mangled PGP/MIME message correctly


T355-smime: Testing S/MIME signature verification and decryption
 FAIL   reply to PKCS#7 SignedData message with proper quoting and attribution
	--- T355-smime.18.expected	2026-05-01 21:11:57.225002585 +0000
	+++ T355-smime.18.output	2026-05-01 21:11:57.225002585 +0000
	@@ -1 +1,16 @@
	+From: Notmuch Test Suite <test_suite@notmuchmail.org>
	+Subject: Re: The FooCorp contract
	+To: Alice Lovelace <alice@smime.example>, Bob Babbage <bob@smime.example>
	+In-Reply-To: <smime-onepart-signed@protected-headers.example>
	+References: <smime-onepart-signed@protected-headers.example>

	+On Tue, 26 Nov 2019 20:11:29 -0400, Alice Lovelace <alice@smime.example> wrote:
	+> Bob, we need to cancel this contract.
	+>
	+> Please start the necessary processes to make that happen today.
	+>
	+> Thanks, Alice
	+> --
	+> Alice Lovelace
	+> President
	+> OpenPGP Example Corp
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/test/json_check_nodes.py", line 55, in <module>
    data = json.load(sys.stdin)
  File "/usr/lib/python3.13/json/__init__.py", line 298, in load
    return loads(fp.read(),
        cls=cls, object_hook=object_hook,
        parse_float=parse_float, parse_int=parse_int,
        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.13/json/__init__.py", line 352, in loads
    return _default_decoder.decode(s)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/json/decoder.py", line 345, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/json/decoder.py", line 363, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

T356-protected-headers: Testing Message decryption with protected headers
 FAIL   protected subject does not leak by default in replies

Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/test/json_check_nodes.py", line 55, in <module>
    data = json.load(sys.stdin)
  File "/usr/lib/python3.13/json/__init__.py", line 298, in load
    return loads(fp.read(),
        cls=cls, object_hook=object_hook,
        parse_float=parse_float, parse_int=parse_int,
        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.13/json/__init__.py", line 352, in loads
    return _default_decoder.decode(s)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/json/decoder.py", line 345, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/json/decoder.py", line 363, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
 FAIL   indexed protected subject is not visible in reply header

Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/test/json_check_nodes.py", line 55, in <module>
    data = json.load(sys.stdin)
  File "/usr/lib/python3.13/json/__init__.py", line 298, in load
    return loads(fp.read(),
        cls=cls, object_hook=object_hook,
        parse_float=parse_float, parse_int=parse_int,
        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.13/json/__init__.py", line 352, in loads
    return _default_decoder.decode(s)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/json/decoder.py", line 345, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/json/decoder.py", line 363, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
 FAIL   when replying, avoid rendering legacy-display part


T357-index-decryption: Testing indexing decrypted mail
 FAIL   notmuch reply should show cleartext if session key is present
	--- T357-index-decryption.34.expected	2026-05-01 21:12:00.773002735 +0000
	+++ T357-index-decryption.34.output	2026-05-01 21:12:00.773002735 +0000
	@@ -1 +1 @@
	-> This is a top sekrit message.
	+

T358-emacs-protected-headers: Testing protected headers in emacs interface
 FAIL   Reply within emacs to a message with protected headers, not leaking subject
	--- T358-emacs-protected-headers.4.EXPECTED	2026-05-01 21:12:04.361002886 +0000
	+++ T358-emacs-protected-headers.4.OUTPUT	2026-05-01 21:12:04.361002886 +0000
	@@ -1,11 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: test_suite@notmuchmail.org
	-Subject: Re: Subject Unavailable
	-In-Reply-To: <protected-header@crypto.notmuchmail.org>
	-Fcc: /<<PKGBUILDDIR>>/test/tmp.T358-emacs-protected-headers/mail/sent
	-References: <protected-header@crypto.notmuchmail.org>
	---text follows this line--
	-<#secure method=pgpmime mode=signencrypt>
	-test_suite@notmuchmail.org writes:
	-
	-> This is the sekrit message
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
 FAIL   don't leak protected subject during reply, even if indexed
	--- T358-emacs-protected-headers.8.EXPECTED	2026-05-01 21:12:06.577002980 +0000
	+++ T358-emacs-protected-headers.8.OUTPUT	2026-05-01 21:12:06.577002980 +0000
	@@ -1,11 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: test_suite@notmuchmail.org
	-Subject: Re: Subject Unavailable
	-In-Reply-To: <protected-header@crypto.notmuchmail.org>
	-Fcc: /<<PKGBUILDDIR>>/test/tmp.T358-emacs-protected-headers/mail/sent
	-References: <protected-header@crypto.notmuchmail.org>
	---text follows this line--
	-<#secure method=pgpmime mode=signencrypt>
	-test_suite@notmuchmail.org writes:
	-
	-> This is the sekrit message
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
Error: database path '/<<PKGBUILDDIR>>/test/tmp.T400-hooks/database.85' does not exist or is not a directory.

T453-emacs-reply: Testing emacs reply
 FAIL   tar not inlined by default
	--- T453-emacs-reply.1.EXPECTED	2026-05-01 21:12:41.265004443 +0000
	+++ T453-emacs-reply.1.OUTPUT	2026-05-01 21:12:41.265004443 +0000
	@@ -1,13 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: Antoine Beaupré <anarcat@orangeseeds.org>
	-Subject: Re: bug: "no top level messages" crash on Zen email loops
	-In-Reply-To: <874llc2bkp.fsf@curie.anarc.at>
	-Fcc: MAIL_DIR/sent
	---text follows this line--
	-Antoine Beaupré <anarcat@orangeseeds.org> writes:
	-
	-> And obviously I forget the frigging attachment.
	->
	->
	-> PS: don't we have a "you forgot to actually attach the damn file" plugin
	-> when we detect the word "attachment" and there's no attach? :p
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
/<<PKGBUILDDIR>>/test/T453-emacs-reply.sh: line 31: OUTPUT.raw: No such file or directory
 FAIL   body, duplicate=1
	--- T453-emacs-reply.2.expected	2026-05-01 21:12:43.357004531 +0000
	+++ T453-emacs-reply.2.output	2026-05-01 21:12:43.357004531 +0000
	@@ -1 +1 @@
	-> # body 1
	+
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
grep: OUTPUT.raw: No such file or directory
 FAIL   body, duplicate=2
	--- T453-emacs-reply.3.expected	2026-05-01 21:12:45.397004617 +0000
	+++ T453-emacs-reply.3.output	2026-05-01 21:12:45.397004617 +0000
	@@ -1 +1 @@
	-> # body 2
	+
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
grep: OUTPUT.raw: No such file or directory
 FAIL   duplicate=3, subject
	--- T453-emacs-reply.4.expected	2026-05-01 21:12:47.509004706 +0000
	+++ T453-emacs-reply.4.output	2026-05-01 21:12:47.509004706 +0000
	@@ -1 +1 @@
	-Re: Bug#916807: Increase severity to 'serious'
	+
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
 FAIL   duplicate=4
	Missing or zero length file: OUTPUT
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
/<<PKGBUILDDIR>>/test/T453-emacs-reply.sh: line 68: OUTPUT.raw: No such file or directory

T454-emacs-dont-reply-names: Testing message-dont-reply-to-names in emacs replies
 FAIL   regular expression
	--- T454-emacs-dont-reply-names.1.EXPECTED	2026-05-01 21:12:52.769004928 +0000
	+++ T454-emacs-dont-reply-names.1.OUTPUT	2026-05-01 21:12:52.773004928 +0000
	@@ -1,6 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: Mikhail Gusarov <dottedmag@dottedmag.net>
	-Subject: Re: [notmuch] Working with Maildir storage?
	-In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu>
	-Fcc: MAIL_DIR/sent
	---text follows this line--
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
/<<PKGBUILDDIR>>/test/T454-emacs-dont-reply-names.sh: line 19: OUTPUT-FULL.raw: No such file or directory
head: cannot open 'OUTPUT-FULL' for reading: No such file or directory
 FAIL   predicate
	--- T454-emacs-dont-reply-names.2.EXPECTED-PRED	2026-05-01 21:12:54.805005014 +0000
	+++ T454-emacs-dont-reply-names.2.OUTPUT-PRED	2026-05-01 21:12:54.805005014 +0000
	@@ -1,7 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: Lars Kellogg-Stedman <lars@seas.harvard.edu>
	-Cc: notmuch@notmuchmail.org
	-Subject: Re: [notmuch] Working with Maildir storage?
	-In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu>
	-Fcc: MAIL_DIR/sent
	---text follows this line--
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
/<<PKGBUILDDIR>>/test/T454-emacs-dont-reply-names.sh: line 40: OUTPUT-FULL-PRED.raw: No such file or directory
head: cannot open 'OUTPUT-FULL-PRED' for reading: No such file or directory
 FAIL   nil value
	--- T454-emacs-dont-reply-names.3.EXPECTED-NIL	2026-05-01 21:12:56.837005100 +0000
	+++ T454-emacs-dont-reply-names.3.OUTPUT-NIL	2026-05-01 21:12:56.837005100 +0000
	@@ -1,7 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: Lars Kellogg-Stedman <lars@seas.harvard.edu>, Mikhail Gusarov <dottedmag@dottedmag.net>
	-Cc: notmuch@notmuchmail.org
	-Subject: Re: [notmuch] Working with Maildir storage?
	-In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu>
	-Fcc: MAIL_DIR/sent
	---text follows this line--
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)
/<<PKGBUILDDIR>>/test/T454-emacs-dont-reply-names.sh: line 61: OUTPUT-FULL-NIL.raw: No such file or directory
head: cannot open 'OUTPUT-FULL-NIL' for reading: No such file or directory

T520-show: Testing "notmuch show"
 BROKEN quoting in From

T570-revision-tracking: Testing database revision tracking
 BROKEN no warning from uuid as global option

T592-thread-breakage: Testing thread breakage during reindexing
 BROKEN No ghosts should remain after deletion of second message

T630-emacs-draft: Testing Emacs Draft Handling
 FAIL   Saving a draft keeps hidden headers
	--- T630-emacs-draft.6.EXPECTED	2026-05-01 21:13:38.577006860 +0000
	+++ T630-emacs-draft.6.OUTPUT.clean	2026-05-01 21:13:38.581006860 +0000
	@@ -1,14 +0,0 @@
	-References: <87d10042pu.fsf@curie.anarc.at> <87woy8vx7i.fsf@tesseract.cs.unb.ca> <87a7v42bv9.fsf@curie.anarc.at> <874llc2bkp.fsf@curie.anarc.at>
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-To: Antoine Beaupré <anarcat@orangeseeds.org>
	-Subject: draft-test-reply
	-In-Reply-To: <874llc2bkp.fsf@curie.anarc.at>
	-Fcc: MAIL_DIR/sent
	---text follows this line--
	-Antoine Beaupré <anarcat@orangeseeds.org> writes:
	-
	-> And obviously I forget the frigging attachment.
	->
	->
	-> PS: don't we have a "you forgot to actually attach the damn file" plugin
	-> when we detect the word "attachment" and there's no attach? :p
*ERROR*: notmuch exited with status Segmentation fault (see *Notmuch errors* for more details)

T670-duplicate-mid: Testing duplicate message ids
 BROKEN First subject preserved in notmuch-show (json)
 BROKEN Regexp search for second subject
 skip all tests in T810-tsan
Notmuch test suite complete.
2023/2129 tests passed.
13 broken tests failed as expected.
94 tests failed.
-1 tests skipped.
All tests in 1 file skipped.
ERROR: some tests failed; first failed returned error code 1
make[1]: *** [test/Makefile.local:69: test] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_test: error: make -j2 test TESTSUITEFLAGS="-j2 --verbose" VERBOSE=1 returned exit code 2
make: *** [debian/rules:9: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
--------------------------------------------------------------------------------

#1135526#18
Date:
2026-05-02 08:43:34 UTC
From:
To:
At optimization level -O1 (or with gcc-15 15.2.0-16), notmuch 0.40
builds and the test suite passes. At -O2, many segfaults occur when
running the test suite. I looked at one such segfault, and the code in
question starts at line 332 of notmuch-reply.c.

Element 0 of reply_to_map gets field get_header initialized properly
with O1 but set to 0x0 at level O2. The latter is of course fatal
when the code just below tries to call through this table.
The other elements of the table look OK.

    struct {
	InternetAddressList * (*get_header)(GMimeMessage *message);
	GMimeAddressType recipient_type;
    } reply_to_map[] = {
	{ get_sender,   GMIME_ADDRESS_TYPE_TO },
	{ get_to,       GMIME_ADDRESS_TYPE_TO },
	{ get_cc,       GMIME_ADDRESS_TYPE_CC },
	{ get_bcc,      GMIME_ADDRESS_TYPE_BCC },
    };

I guess in principle there could be some undefined behaviour here, but
e.g. there is no warnings from -Wall or cppcheck.

All 4 functions are declared static void in the same compilation unit.

I tried building with gcc-16, and the behaviour looks similar: O1 is
fine, O2 yields segfaults in the test suite.

#1135526#25
Date:
2026-05-03 00:19:37 UTC
From:
To:
David Bremner <david@tethera.net> writes:

I learned that declaring this array as static const seems to fix the
initialization, although I'm not really sure how to interpret that.

#1135526#30
Date:
2026-05-03 04:38:13 UTC
From:
To:
just for my understanding: -16 (20260321) doesn't show this behavior,
but -17 (20260423) does?  Do you have a test case smaller than building
the whoole notmuch package?

Probably needs bisecting the upstream commits (git-updates.diff) to find
the offending patch.

#1135526#35
Date:
2026-05-03 11:17:20 UTC
From:
To:
Matthias Klose <doko@debian.org> writes:

That is correct.

Unfortunately I don't have a smaller test case at this time.  For what
it is worth I can narrow down the test after notmuch is built; the
attach script should show the segfault if run in test/ after building.

#1135526#40
Date:
2026-05-10 11:23:49 UTC
From:
To:
Hi,

We hit this on the Gentoo side too and have filed
https://gcc.gnu.org/PR125252.

It happens with -std=c23/-std=gnu23 which 15 defaults to, and seems to
affect >=15 on the branch (as well as 16 and also trunk) because of a
backport upstream for another problem.

thanks,
sam