From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id yFQSA+2TG2QwngAASxT56A (envelope-from ) for ; Thu, 23 Mar 2023 00:49:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SDziAu2TG2TyDAEA9RJhRA (envelope-from ) for ; Thu, 23 Mar 2023 00:49:01 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 AED322716F for ; Thu, 23 Mar 2023 00:49:00 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 58DD15F70D; Wed, 22 Mar 2023 23:48:58 +0000 (UTC) Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by mail.notmuchmail.org (Postfix) with ESMTPS id ADDBF5F3E7 for ; Wed, 22 Mar 2023 23:48:55 +0000 (UTC) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-53d277c1834so366587857b3.10 for ; Wed, 22 Mar 2023 16:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679528934; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ulODEnBNAMwHxqzqkkFJfCdOnG27QMndi0GbS4fDuqc=; b=ZpVXYFDuFGDz2JlLNhYdR/HW3/SWjLifcXSrBSn+zvFEQ040j7NZd84E2e6K3fDUda XhJYJSKlmDL4AyHJ6lpJBXNsWO+4QcTAJKBpxmLtSaXjsyZIWsxXmgGASQLf65KAjS7n 6GhrHzVO8CCMyOvCBMzFJUeQ0311/+U+010YiEupx1japE+ilHGnIAOaDV9lvtK+cCOs FT/DR5f44S8cBypYaUs0ng8oGAOTw1zHGivngIaO1QpYXsqjX3xEtTVEHGApL6qB7y7h PmEJrwk/ncnSkyZ/LD9HKvzzwFFZwayXHsZyZnrh5FKDiZ1xKMmabmTyRnjF6R/6IqYu 61Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679528934; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ulODEnBNAMwHxqzqkkFJfCdOnG27QMndi0GbS4fDuqc=; b=JZNVIUAH+yQCk+Enixr62nWPIN3jG+PrhxWdEx0I3409K+YNoc26YxD78YEK6urOu2 8wziCV+/Pr4fG9TOdVoPr4to3NTFtB0ouxYz2MEoTo3ueAsx+zTwawxAnsIXpxYEVXXu igb/cNHXGuhSPdMAKhgZFmlH/Bc/eYzyR1A5UUktFsbAki/et3NWBnqezoBTP2GWJpfA +mmWXEvC3xxKMRo3erjoCdHHLnEMOVv+4b1fM/dQ/MUEE1MmgugVFZS5XKdmAOWZQG2V DGWHuX+lmRtyzdbKXx0PzoI7oxZtHKM7wAzH8er1ErADwkixUTtCRoq2Cyf9dfzfX5lQ RkJQ== X-Gm-Message-State: AAQBX9dkMxMHjzi/x9oQwCaR7OLS/iGZ9CZxooZEvMZq+I7XZd9+b7RM gB3Pt4T8QxGrn+Oh8R6apUcrDOFNGQJgI3ggP0I= X-Google-Smtp-Source: AKy350bPBL3ZRAUE/PWKTP9+5xnzUeuNxu2wljM5beD06fx2UXivSGO/cJYMD3txgfoBhwlUCSTBB2wxh+PuDeMnJE4= X-Received: by 2002:a81:b603:0:b0:545:883a:544d with SMTP id u3-20020a81b603000000b00545883a544dmr151356ywh.9.1679528934400; Wed, 22 Mar 2023 16:48:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Felipe Contreras Date: Wed, 22 Mar 2023 17:48:43 -0600 Message-ID: Subject: Re: BUG: ruby segfault in notmuch_rb_tags_each To: arcnmx Content-Type: multipart/mixed; boundary="00000000000086a6d405f785cde2" Message-ID-Hash: O6BZRD4E3TXGQHWR5TCGOAD34PBZF724 X-Message-ID-Hash: O6BZRD4E3TXGQHWR5TCGOAD34PBZF724 X-MailFrom: felipe.contreras@gmail.com 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 CC: notmuch@notmuchmail.org 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: X-Migadu-Country: DE X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679528940; a=rsa-sha256; cv=none; b=mrQa1fKrPdf+QCLnh2f1Fb5CEus6OQ/zoRToe7sAOOVjUJhqSO+hjXmGeC3VKJudgfMTzr Euz1r5VPljDhcMV3W8yhpjm8+YoKeDTwChm2cjYsauqqX8jd0UNwLqWsqA4LO8+qrt6jBd CFvDDvdFdNHmdSZOriPjZKU75N40Uew5qy2x6/S2YbseOLgdgBrmhlZ5urR4JteVvXkN3a H0+cu9BLCGuGsMGVczKu4Jy4sxetLlY4TNZk/gqPmatqg1r5KpEa5t3fhVh0c3+yyr+wPd AVAjyfKDeB7MtKkPoTW4XEIFOJYxfd7zD+a6ds4qmHTXqSwEszHR/jpeE1tizQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=ZpVXYFDu; 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 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679528940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=XYbwd9fTuAEv998SmnrJWLyj2arX7rIBDfxo0xTw9c8=; b=ZP/2upk893Dmnvs2btLRvUAxACvLrVdiM0JsrE+WwEKCm3LzjsCrC/hftQ90jC16DVuoio m6kkNEHJWJbchFInbXiSvmsi2FIaz855UvWa4sTnnjtJD94fOcesXEJeg1FOrHU5ZmXEn0 ZFqq6HY/IaC+HUpaeWGS/nX/Z+NEAL5xZn97ov3iwZsArmqSP6DXIYhJE0ZfJA6OhnrYr2 njFwx0jVqxU2jYE8Rkv0MwzkAyPWFhsxicDBjBiGRveFKj9IVRaUTuaX/hs4Yf6cWeMyS8 QM+7pfI8lhxKpPJsSZabXeq4PQR5T7nSvTLtPDTwzQqdKm1zx2iWgwXDXJiDog== Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=ZpVXYFDu; 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 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 0.47 X-Spam-Score: 0.47 X-Migadu-Queue-Id: AED322716F X-TUID: 05F9G+fUbsx6 --00000000000086a6d405f785cde2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 30, 2022 at 5:09=E2=80=AFPM arcnmx wrote: > > Hi, I've been running into rare crashes via notmuch-vim for a while now a= nd finally got around to tracking down the problem. I apologize for the siz= e of the reproduction case, but at least it can be reproduced! Thanks for the reproduction case, I setted up nix and indeed I was able to reproduce the issue, I narrowed it down to a much simpler test-case. The problem is that Notmuch::Tags is mapped to notmuch_tags_t which in the past was a standalone iterator, but later on could only be used once, in particular I think this commit broke the assumption of the Ruby bindings: d19c5de1 (Add the tag list to the unified message metadata pass., 2010-12-09). The code of notmuch-vim stores this tags iterable, traverses it, and then afterwards tries to traverse it again, even after the original parent (notmuch_message_t) might have been destroyed. The crash can be reproduced in C with something like: tags_0 =3D notmuch_message_get_tags(message); // Store it for later tags_1 =3D notmuch_message_get_tags(message); // Traverse it I've sent the patches that fix this in the Ruby bindings, but in the meantime you can try this workaround in the Message constructor of notmuch-vim: @tags =3D msg.tags.map(&:to_s) I'm attaching a simple script that reproduces the issue. Cheers. --=20 Felipe Contreras --00000000000086a6d405f785cde2 Content-Type: application/x-ruby; name="simple.rb" Content-Disposition: attachment; filename="simple.rb" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lfkc5fd40 cmVxdWlyZSAnbm90bXVjaCcKCiRkYiA9IE5vdG11Y2g6OkRhdGFiYXNlLm5ldyhBUkdWLmZpcnN0 IHx8IERpci5ob21lICsgJy9tYWlsJykKCnEgPSAkZGIucXVlcnkoJ3RocmVhZDowMDAwMDAwMDAw MDAwMDAxJykKCm1zZ3MgPSBxLnNlYXJjaF9tZXNzYWdlcwp0YWdzX2FycmF5ID0gW10KbXNncy5l YWNoIGRvIHxtc2d8CiAgR0Muc3RhcnQKICBwIG1zZy50YWdzCiAgdGFnc19hcnJheSA8PCBtc2cu dGFncwogIHB1dHMgbXNnLnRhZ3MudG9fYS50b19zCmVuZAoKcHV0cyAnPScgKiA4MAoKdGFnc19h cnJheS5lYWNoIGRvIHx0YWd8CiAgcHV0cyB0YWcudG9fYS50b19zCmVuZAo= --00000000000086a6d405f785cde2 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --00000000000086a6d405f785cde2--