From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kH55Oy9xz14TUAAA0tVLHw (envelope-from ) for ; Thu, 28 May 2020 08:07:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0OhGNy9xz15sRAAAbx9fmQ (envelope-from ) for ; Thu, 28 May 2020 08:07:11 +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 155CD940C76 for ; Thu, 28 May 2020 08:07:10 +0000 (UTC) Received: from localhost ([::1]:46220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeDZE-0003W6-Ah for larch@yhetil.org; Thu, 28 May 2020 04:07:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeDZ8-0003Vr-B4 for guix-patches@gnu.org; Thu, 28 May 2020 04:07:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39333) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jeDZ8-0001M6-2U for guix-patches@gnu.org; Thu, 28 May 2020 04:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jeDZ7-00051B-Tb for guix-patches@gnu.org; Thu, 28 May 2020 04:07:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41425] [PATCH 0/5] Have 'guix pull' protect against downgrade attacks Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 May 2020 08:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41425 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 41425@debbugs.gnu.org Received: via spool by 41425-submit@debbugs.gnu.org id=B41425.159065320219259 (code B ref 41425); Thu, 28 May 2020 08:07:01 +0000 Received: (at 41425) by debbugs.gnu.org; 28 May 2020 08:06:42 +0000 Received: from localhost ([127.0.0.1]:50879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeDYZ-0004zr-Oa for submit@debbugs.gnu.org; Thu, 28 May 2020 04:06:42 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:44756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeDYW-0004zb-QY for 41425@debbugs.gnu.org; Thu, 28 May 2020 04:06:26 -0400 Received: by mail-qk1-f194.google.com with SMTP id b6so2243233qkh.11 for <41425@debbugs.gnu.org>; Thu, 28 May 2020 01:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zsEBEL3tVKTlXNc3/gNQk46no7tVOBCsEVSEpDpQNug=; b=dcDLPxX2YEQfpNS6TZA/loFGG+hlGBi/0lo45bXfnoOdxLtNWCvXeJu//mjYRQc/yJ 9LguGyYE7pNtiIW5pdoY6X1MxMp9B3dEYGXDsA2jEGF5Wt3U55iBWjmTfUFvbpvVQ+3Q ZY/i5Fo5fPmWqxGDkvbxdRfZUn9COfsXsjLuuR5AU0arTyI44WkYa2C0QSWxWhoX0hON pnQxA+hm9avvRdfpBD8X54pcahyyZrkMDngYffQ8bIvyYV15WunyQ3OIhgyr9gGseZso 0RsPTzWeiUx3Pee5JYh/nAdgt7u0Xp/zhk9mNG4EzgSWF/Xj37zhlP4la1uw0L1rQJi6 sBVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zsEBEL3tVKTlXNc3/gNQk46no7tVOBCsEVSEpDpQNug=; b=JYpXYzPMHA5dw6SLYv7Zzlo/T2+hjq9VyS5MCaiLdIGOeh2CLfrX52cgiNGOdA0qgQ AzzAXJGT7lMBGPesjORRj1XrogYE/6Z4f8PanGeX2Nqld4kt/vUjhydh2Upi7jEm96Dy JuJce5LOAVPCgez/saXFGoCSpiY8GL9541lFy2gxIRteDA0ld//pDvEGLnPxREdNZ3Sf ibb42cvoJJSvfOYFn4NgCuTk2pP2KzjzIoH/mSYrlU4TgS5h4+lNY8EE9JPukCxTO9SM iLZ5JVy8jdX+rtTb0GwTtwAhpmWdKZ/9kMJtwChXIhAWoQHGY4CClLln21nstpeVIXyb PlPw== X-Gm-Message-State: AOAM530/R4x3KuJjuN39bwZUTdwghJGVyg2x7HHcgsgsXWfgIbU3NTqA HX2lHZPyysNSrzcBF9GIhl0CpfU0tSEWeQxA5x2IF0Wi X-Google-Smtp-Source: ABdhPJxd19Uz/fh5UEJfBLw8r6Ba2/kfkQitFgni1h4VbnTPVeqJSJvK23jMCOacG23gxS0TI0WhEZJQvymf5hR9N0I= X-Received: by 2002:a37:4b88:: with SMTP id y130mr1582202qka.80.1590653179100; Thu, 28 May 2020 01:06:19 -0700 (PDT) MIME-Version: 1.0 References: <20200520213802.2170-1-ludo@gnu.org> <87r1vc9iqb.fsf@gnu.org> <87v9khjq3y.fsf@gnu.org> In-Reply-To: <87v9khjq3y.fsf@gnu.org> From: zimoun Date: Thu, 28 May 2020 10:06:07 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=dcDLPxX2; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: EkTVDFlV6YX7 Hi Ludo, On Wed, 27 May 2020 at 18:32, Ludovic Court=C3=A8s wrote: > > (commit-relation left merge) > > Segmentation fault > > It took me a while to notice, but the problem with the code above is > that =E2=80=98repo=E2=80=99 is closed when you call =E2=80=98commit-relat= ion=E2=80=99, and thus the > commit objects are invalid. It works if you keep =E2=80=98repo=E2=80=99 = alive: It make totally sense. Thank you for the explanations. > --8<---------------cut here---------------start------------->8--- > $ guix describe > Generacio 145 May 25 2020 00:37:58 (nuna) > guix 9744cc7 > repository URL: https://git.savannah.gnu.org/git/guix.git > branch: master > commit: 9744cc7b4636fafb772c94adb8f05961b5b39f16 > $ guix repl > GNU Guile 3.0.2 > Copyright (C) 1995-2020 Free Software Foundation, Inc. > > Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. > This program is free software, and you are welcome to redistribute it > under certain conditions; type `,show c' for details. > > Enter `,help' for help. > scheme@(guix-user)> (use-modules (guix git) (guix channels) (guix tests g= it) (git)) > (define url-cache-directory (@@ (guix git) url-cache-directory)) > (define dir (url-cache-directory (channel-url (car %default-channels)))) > ;;; :2:0: warning: possibly unused local top-level variable `url-c= ache-directory' > ;;; :3:0: warning: possibly unused local top-level variable `dir' > scheme@(guix-user)> (define repo (repository-open dir)) > ;;; :4:0: warning: possibly unused local top-level variable `repo' > scheme@(guix-user)> (define merge (find-commit repo "Merge")) > ;;; :5:0: warning: possibly unused local top-level variable `merge= ' > scheme@(guix-user)> merge > $1 =3D # > scheme@(guix-user)> (define left (car (commit-parents merge))) > left > ;;; :7:0: warning: possibly unused local top-level variable `left' > $2 =3D # > scheme@(guix-user)> (commit-relation left merge) > $3 =3D ancestor > scheme@(guix-user)> (gc) > scheme@(guix-user)> (commit-relation left merge) > $4 =3D ancestor > --8<---------------cut here---------------end--------------->8--- Well, the '(gc)' has no effect here because 'repo' is still alive and thus the reference too. Instead, an example would be: --8<---------------cut here---------------start------------->8--- [...] scheme@(guix-user)> (commit-relation left merge) $3 =3D ancestor scheme@(guix-user)> (define repo 42) scheme@(guix-user)> (commit-relation left merge) $4 =3D ancestor scheme@(guix-user)> (gc) scheme@(guix-user)> (commit-relation left merge) Segmentation fault --8<---------------cut here---------------end--------------->8--- isn't? Which is somehow the same than the initial example. > The solution in such cases is to synchronize the object lifetimes. In > this case, commits would keep a reference to the repository object to > prevent it from being GC=E2=80=99d, as is done with =E2=80=98%submodule-o= wners=E2=80=99 in (git > submodule). I think I understand. > Could you make an issue over at > ? I will. Thank you for the explanation.