From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 04:06:42 2020 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: Subject: Re: [bug#41425] [PATCH 0/5] Have 'guix pull' protect against downgrade attacks To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41425 Cc: 41425@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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.