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 4EZlLUWWzl5LSQAA0tVLHw (envelope-from ) for ; Wed, 27 May 2020 16:33: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 mp0 with LMTPS id wO5UKUWWzl4qagAA1q6Kng (envelope-from ) for ; Wed, 27 May 2020 16:33:09 +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 2D5AD9403EE for ; Wed, 27 May 2020 16:33:09 +0000 (UTC) Received: from localhost ([::1]:38474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdyzK-0007Nh-Vb for larch@yhetil.org; Wed, 27 May 2020 12:33:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdyzI-0007LZ-6I for guix-patches@gnu.org; Wed, 27 May 2020 12:33:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jdyzG-0003rY-AA for guix-patches@gnu.org; Wed, 27 May 2020 12:33:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jdyzG-0004tW-6k for guix-patches@gnu.org; Wed, 27 May 2020 12:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41425] [PATCH 0/5] Have 'guix pull' protect against downgrade attacks Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 27 May 2020 16:33:02 +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: zimoun Cc: 41425@debbugs.gnu.org Received: via spool by 41425-submit@debbugs.gnu.org id=B41425.159059714918770 (code B ref 41425); Wed, 27 May 2020 16:33:02 +0000 Received: (at 41425) by debbugs.gnu.org; 27 May 2020 16:32:29 +0000 Received: from localhost ([127.0.0.1]:49835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdyyj-0004sf-0w for submit@debbugs.gnu.org; Wed, 27 May 2020 12:32:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdyyf-0004sO-4F for 41425@debbugs.gnu.org; Wed, 27 May 2020 12:32:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39932) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdyyZ-0003Bn-QT; Wed, 27 May 2020 12:32:19 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35654 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jdyyZ-0001oT-4q; Wed, 27 May 2020 12:32:19 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200520213802.2170-1-ludo@gnu.org> <87r1vc9iqb.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 Prairial an 228 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: Wed, 27 May 2020 18:32:17 +0200 In-Reply-To: (zimoun's message of "Mon, 25 May 2020 16:36:52 +0200") Message-ID: <87v9khjq3y.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) 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=none; dmarc=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: -1.01 X-TUID: Xd3AAXa5lFI6 Hi, zimoun skribis: > (use-modules (guix git) (guix channels) (guix tests git) (git)) > (define url-cache-directory (@@ (guix git) url-cache-directory)) > (define dir (url-cache-directory (channel-url (car %default-channels)))) > (define merge (with-repository dir repo (find-commit repo "Merge"))) > merge > ;; $1 =3D # > (define left (car (commit-parents merge))) > left > ;; $2 =3D # > (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-relatio= n=E2=80=99, and thus the commit objects are invalid. It works if you keep =E2=80=98repo=E2=80=99 al= ive: --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 git= ) (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-cac= he-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--- 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-own= ers=E2=80=99 in (git submodule). Could you make an issue over at ? Thanks, Ludo=E2=80=99.