From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EKHwITaU+WX2UwEAqHPOHw:P1 (envelope-from ) for ; Tue, 19 Mar 2024 14:33:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id EKHwITaU+WX2UwEAqHPOHw (envelope-from ) for ; Tue, 19 Mar 2024 14:33:42 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=b3xZrqbx; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1710855222; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vzyl/t1DwN8w2qlmLoqzMQcuqog/HEwoFOUSEET3H8o=; b=GuubraeG6u3o6j40ghk6fzmWvOQ27M+iX/GIJ+VgDTZUOb2Ygz0lPY1IvcS7rn6b2FGwZU DVEloOv6mW0ovuATN4vq+vQ3whYW2ekweYP+zrciFMpRodhL2Y1/YPRfhZZwPoooc0HaF8 lRujtYgLYdnioGPlNPzC5XBq6gMsbcdPF+VTVc22Z6SQ4agXwB1honlCAjS65TCytGFOh9 wQUIP5Z1vIPi0EXdSyIn15pF/YoqXTKXG928fEwbqX28ntLou/W9fZiSyN2B5kX4aCgnvl uB/LHrH9zGt0/vr9srhxUDiqhQQyha6sXibOJfic13giBapq26SrOCXLYTI0RA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=b3xZrqbx; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1710855222; a=rsa-sha256; cv=none; b=iDQ2ypMWjERCaQ7L3YfUTTjJDi9H6fgbr7kCqcUU2TqSeWaTTa8ZiSolvm5EhNKbCI/cX/ 7dSy5KtEL1eqNDmcytNlqhYVBxmDEVWxs12eAiiylG3lTDVjn/vMfR+hnkyRkM5rDBlGYP UDV/m2T3XoJYplu5GQbiNLZ/Oaxa05n+hu4k1Gq3h/9v7IcT8jQAAetOyUwlVIcwu9tSau qarTwtFV5luquAc/h8NqSO8nkSBA2ZEvszUJfB/vcvXzRC/XX7h3J9XMa2C+zyd6M8JM1o qNPVnFjc3F+zvoVG4XngXHKs5HzhifDzioMP9iEZxdeIk5gv6wmbwJyM+01qZg== 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 3C88E6002C for ; Tue, 19 Mar 2024 14:33:42 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmZao-0004GO-PZ; Tue, 19 Mar 2024 09:33:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmZam-0004EJ-RS for guix-patches@gnu.org; Tue, 19 Mar 2024 09:33:25 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmZam-0001X9-IR for guix-patches@gnu.org; Tue, 19 Mar 2024 09:33:24 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rmZbO-0000NU-Uq for guix-patches@gnu.org; Tue, 19 Mar 2024 09:34:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69780] [PATCH 1/4] git authenticate: Record introduction and keyring in =?UTF-8?Q?=E2=80=98.git/config=E2=80=99.?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 19 Mar 2024 13:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69780 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Tomas Volf <~@wolfsden.cz> Cc: 69780@debbugs.gnu.org Received: via spool by 69780-submit@debbugs.gnu.org id=B69780.17108552191311 (code B ref 69780); Tue, 19 Mar 2024 13:34:02 +0000 Received: (at 69780) by debbugs.gnu.org; 19 Mar 2024 13:33:39 +0000 Received: from localhost ([127.0.0.1]:49461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rmZb0-0000L5-TP for submit@debbugs.gnu.org; Tue, 19 Mar 2024 09:33:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rmZax-0000KA-IM for 69780@debbugs.gnu.org; Tue, 19 Mar 2024 09:33:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmZaE-0001Tx-KN; Tue, 19 Mar 2024 09:32:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=vzyl/t1DwN8w2qlmLoqzMQcuqog/HEwoFOUSEET3H8o=; b=b3xZrqbxYsOsgWbmH+3Z +Z30sniFluUjXMgHpcEA26j4rEDXErMV+bN1Kv7YbeoNKX9RGThG+Y+rCKBRfr9QphRLmkyvPNKQc TxV3/23en1b4WR89Q27H9HWZBiO7PTxcAQQT3wqEE0PyI7gnmnnSYOXGq2+6m6/IMZ0cgtre75LtF 322xpVs3in7Br6cZ64PcomABo3CI8hdcEX9/rWt5VedwU1SqRmbEGki3vdAbcxb90QenoEu+uTD6p w/6dj0yGLvtysyvfzekLuxA4P/r4xuNMW/c0YfTy8/zNoYz7Efb+GdzUxIRccnNXVSnlDUogJTUTT l/3Rzl+lrNBAGQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (Tomas Volf's message of "Sat, 16 Mar 2024 22:00:04 +0100") References: <40858e56cf55b27711d23add5f3cd2ccc6ea5c58.1710351278.git.ludo@gnu.org> Date: Tue, 19 Mar 2024 14:32:47 +0100 Message-ID: <87sf0m4a9s.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.21 X-Spam-Score: -7.21 X-Migadu-Queue-Id: 3C88E6002C X-Migadu-Scanner: mx13.migadu.com X-TUID: 8LTzvKeBD0kP Hi Tomas! Tomas Volf <~@wolfsden.cz> skribis: >> +(define* (record-configuration repository >> + #:key commit signer keyring-reference) >> + "Record COMMIT, SIGNER, and KEYRING-REFERENCE in the 'config' file of >> +REPOSITORY." >> + (define directory >> + (repository-directory repository)) >> + >> + (define config-file >> + (in-vicinity directory "config")) > > I do not think this will work with worktrees. It will create the config = file in > the worktree's git directory, but that file will be ignored by git. > > scheme@(guile-user)> (repository-discover "/home/xx/src/guix-wt/patch= -1") > $7 =3D "/home/xx/src/guix/.git/worktrees/orig/" > scheme@(guile-user)> (repository-open $7) > $8 =3D # > scheme@(guile-user)> (repository-directory $8) > $9 =3D "/home/xx/src/guix/.git/worktrees/orig/" > scheme@(guile-user)> (in-vicinity $9 "config") > $10 =3D "/home/xx/src/guix/.git/worktrees/orig/config" > > The $10 should be "/home/xx/src/guix/.git/config" instead. Damn it. So hmm, I can see two options: 1. Add more bindings to (git config) in Guile-Git so we can populate that file =E2=80=9Cthe right way=E2=80=9D. But then we=E2=80=99ll hav= e to require that newer version of Guile-Git. 2. Bail out when the =E2=80=98.git/config=E2=80=99 isn=E2=80=99t found, a= s in the case of worktrees; we can change that to use the proper (git config) eventually. Maybe we should go straight to #1 though. Thoughts? >> + (call-with-port (open-file config-file "a") >> + (lambda (port) >> + (format port " >> +# Added by 'guix git authenticate'. >> +[guix \"authentication\"] >> + introduction-commit =3D ~a >> + introduction-signer =3D ~a >> + keyring =3D ~a~%" >> + commit signer keyring-reference))) > > I guess these specific values might not need any escaping? But the escap= ing > (and the previous problem) would be solved by just shelling out to the `g= it > config --local ...' to set the value. Something to consider. No escaping is needed in this case. Things will be even clearer if/when we switch to (git config). >> + (unless (configured? repository) >> + (record-configuration repository >> + #:commit commit #:signer signer >> + #:keyring-reference keyring)) > > Hm, so this records the information only on the very first successful > authentication? Right. > So if I re-run with different values (e.g. I am creating a new channel > and `git commit --amend'-ed after checking the authorization), I am > stuck with the (now) invalid values forever until I edit the > .git/config by hand? You mean if you change the introduction? Yes. > Also (as Skyler Ferris already mentioned) this ignores the case of multip= le > branches with different authentication origins (I actually do have such u= se > case), so the suggested option of storing it per-branch might be nice. N= ot sure > how to deal with pruning of old values though (if at all?). Oh right. Needs some thought. Thanks for your feedback! Ludo=E2=80=99.