From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eNbqEYTO3F9QOwAA0tVLHw (envelope-from ) for ; Fri, 18 Dec 2020 15:45:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 8NHBDYTO3F/SWQAA1q6Kng (envelope-from ) for ; Fri, 18 Dec 2020 15:45:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 90A70940366 for ; Fri, 18 Dec 2020 15:45:07 +0000 (UTC) Received: from localhost ([::1]:41210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqHwI-0005L6-GH for larch@yhetil.org; Fri, 18 Dec 2020 10:45:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqHmW-0002rO-On for guix-devel@gnu.org; Fri, 18 Dec 2020 10:35:00 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34027) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqHmW-0004PD-FG; Fri, 18 Dec 2020 10:35:00 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53390 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kqHmU-000819-Gr; Fri, 18 Dec 2020 10:34:58 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Magali Subject: Re: [outreachy] Walk through the Git history (guix git {authenticate,log}) References: <86r1nwfdeu.fsf@gmail.com> <86lfe3fc0t.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 Frimaire an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 18 Dec 2020 16:34:57 +0100 In-Reply-To: (Magali's message of "Tue, 15 Dec 2020 12:20:09 -0300") Message-ID: <87sg839lge.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Devel , Mathieu Othacehe Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.82 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 90A70940366 X-Spam-Score: -2.82 X-Migadu-Scanner: scn0.migadu.com X-TUID: DaUFh6yWnQui Hi Magali, Magali skribis: > scheme@(guix-user)> (let* ((repo (repository-open cache)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (latest-commit > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (commit-lookup rep= o (reference-target (repository-head repo))))) > =C2=A0=C2=A0=C2=A0 (let loop ((commit latest-commit) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (res (list latest-commit))) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (match (commit-parents commit) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = (() (reverse res)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = ((head . tail) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (loop head (cons head res)))))) > Segmentation fault (core dumped) I can reproduce the bug; the C backtrace looks like this: --8<---------------cut here---------------start------------->8--- (gdb) bt #0 0x00007fabfa9d31ee in git_oidmap_get () from /gnu/store/zchrrs2zf4l06cszbadqsk18329q78sg-libgit2-1.1.0/lib/libgi= t2.so #1 0x00007fabfa98d516 in cache_get () from /gnu/store/zchrrs2zf4l06cszbadq= sk18329q78sg-libgit2-1.1.0/lib/libgit2.so #2 0x00007fabfa9cbef7 in git_object_lookup_prefix () from /gnu/store/zchrrs2zf4l06cszbadqsk18329q78sg-libgit2-1.1.0/lib/libgi= t2.so #3 0x00007fac01b8866d in ffi_call_unix64 () from /gnu/store/bw15z9kh9c65ycc2vbhl2izwfwfva7p1-libffi-3.3/lib/libffi.s= o.7 #4 0x00007fac01b86ac0 in ffi_call_int () from /gnu/store/bw15z9kh9c65ycc2v= bhl2izwfwfva7p1-libffi-3.3/lib/libffi.so.7 #5 0x00007fac01e54f2e in scm_i_foreign_call (cif_scm=3D, po= inter_scm=3D,=20 errno_ret=3Derrno_ret@entry=3D0x7ffe5fc1f95c, argv=3D0x7fabfe2e4980) at= foreign.c:1073 #6 0x00007fac01ec3a84 in foreign_call (thread=3D0x7fac014a8d80, cif=3D, pointer=3D) at vm.c:1282 --8<---------------cut here---------------end--------------->8--- Could it be that, if you keep =E2=80=98repo=E2=80=99 in a global variable l= ike in the example zimoun posted, segfault no longer occurs? I believe that what happens is a bug in Guile-Git: =E2=80=98repo=E2=80=99 i= s =E2=80=9Cfinalized=E2=80=9D (freed) before Guile inspects the commit objects to print them, and when Guile gets around to printing those commit objects, they now refer to a repo that has been freed, hence the crash. Until the bug is fixed, the workaround is to arrange your code so that the repository object outlives commit objects. We can discuss this further here or on IRC if you want. Hope this helps! Ludo=E2=80=99.