Received: (at 66592) by debbugs.gnu.org; 12 Jan 2024 12:51:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 12 07:51:29 2024 Received: from localhost ([127.0.0.1]:35156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rOH0S-0004C4-QN for submit <at> debbugs.gnu.org; Fri, 12 Jan 2024 07:51:29 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:38931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1rOH0M-0004AJ-0s for 66592 <at> debbugs.gnu.org; Fri, 12 Jan 2024 07:51:22 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-33686565c35so1131866f8f.0 for <66592 <at> debbugs.gnu.org>; Fri, 12 Jan 2024 04:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705063878; x=1705668678; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=oGh5+ImILUt/53jfdo8eFv80wgF4Be882afc0O8DkZM=; b=WZVXWAyOQot+yH99KWueyouIUSXzcOkKFXzZMmsWFXT8toECZ339SBJr4s3uuEesCh CdSWJSEMOdA6yaKZvy83ARbSPBk2aH5t1c9T5FBxcQLtPRDDPxutrgyFWWswP38JB4uN qrH2VE607ufLAAHSjncjP5G6VoWYy7XPq8jxuVI1FmKuECxpQWN11IoYMxZTa/+2pwuf f5s44Xg7VuPsXDDmf4Scx4hLRjjOhg1yjAABHWF6AtuIybFjVxqhZCKqIbWjkUDh9EgZ dk1undLMcfvEBDqs+8lwPc6iN3dFOvUa4Uf01z1iicTmo12Yw7FfniM+PvohcDUvmdp9 qIew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705063878; x=1705668678; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oGh5+ImILUt/53jfdo8eFv80wgF4Be882afc0O8DkZM=; b=jQOtbYPWA1WDDopgu1uW6V6IITn6WU06bOZh0qdzUBOubOoj4KHFQPPx7LgbKb3qNv N4b8u/1ZQz+y2DNWowvabzjiI/GQkEgV0dH7zlwMgVDbAFD8G4e3+WvxaTmYQpihqrro FPYSoRfEdGD9f+zkkrZ4dMcmez/VH2V0JpSRBDaYKS8xt+oiK73Ej2IXG1Qe8aZfyLmu qjPp7nBhqqU6M1rsVOGz6YHoFK4IQxp1jcTQ4l6qnioNasvhWO2+NN1G59wwjSVdtBaC PY0Na28B+UEzGoVs7ZFkosMzJN9IVSgJNm2c4rxWLKvJyJJYbHsz5nsH9XnGASXWSuZZ A/xQ== X-Gm-Message-State: AOJu0YzmG30untezq8H7+TElJekhwXubtokvVI5Tp1J9pw8u80vj1MwP SB64CUePmxzLARk/ZfT3yqdGw6j9k9k= X-Google-Smtp-Source: AGHT+IG/DErG1lJLwYIqSH8y9/xkXxmxU3q8IglJUTJ4t1a8Q9LEirp4mIdj8BDc4Fj/8PMB7p/rIw== X-Received: by 2002:a05:6000:1c1:b0:337:476f:9964 with SMTP id t1-20020a05600001c100b00337476f9964mr1505785wrx.3.1705063878249; Fri, 12 Jan 2024 04:51:18 -0800 (PST) Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id o12-20020a5d474c000000b00336aac53e75sm3790474wrs.97.2024.01.12.04.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 04:51:18 -0800 (PST) From: Simon Tournier <zimon.toutoune@HIDDEN> To: Maxim Cournoyer <maxim.cournoyer@HIDDEN> Subject: Re: [bug#66592] [PATCH v3] scripts: archive: Check compatibility of command line options. In-Reply-To: <87r0k1r44u.fsf@HIDDEN> References: <fb2bfb115372a037e22df39dc194deabf290a58f.1697549017.git.zimon.toutoune@HIDDEN> <9f5c22f6fe1f4feba5d3561cef011b0c3f55df06.1701340510.git.zimon.toutoune@HIDDEN> <87r0k1r44u.fsf@HIDDEN> Date: Fri, 12 Jan 2024 11:16:38 +0100 Message-ID: <87frz2yhyx.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66592 Cc: Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN>, 66592 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Maxim, On Mon, 04 Dec 2023 at 17:31, Maxim Cournoyer <maxim.cournoyer@HIDDEN> w= rote: >> + (define* (compatible-option options #:key actions) >> + "Return the OPTIONS if it is compatible with the list of ACTIONS." > > Sorry for not mentioning this in my first review, but re-reading this > code, I think it should be named like: (check-compatibility options > actions). There's no point making actions an optional argument since > the only point of using this procedure is when you have actions to check > compatibility with, right? Well, the point was not about an optional argument but about a key argument =E2=80=93 I find easier at call-location. I do not know. (BTW, I have not raised the issue for other commands, but this =E2=80=99check-compatibility=E2=80=99 could be also applied. Let as an exe= rcise for future potential contributor. ;-)) > Would you mind sending a v4 with the above suggestion? Then I think > we'd be good. I will. Cheers, simon
guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.Received: (at 66592) by debbugs.gnu.org; 4 Dec 2023 22:32:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 04 17:32:06 2023 Received: from localhost ([127.0.0.1]:36017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rAHTx-0007ew-R2 for submit <at> debbugs.gnu.org; Mon, 04 Dec 2023 17:32:06 -0500 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]:57542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1rAHTv-0007eQ-RQ for 66592 <at> debbugs.gnu.org; Mon, 04 Dec 2023 17:32:04 -0500 Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-67ad5b37147so4416796d6.2 for <66592 <at> debbugs.gnu.org>; Mon, 04 Dec 2023 14:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701729107; x=1702333907; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GeE8l76Q/quL8FCAwZbdRu4NkVD0mbI5WOWd8FLcwMU=; b=HI3I3cUm+muTS0Er4XbI4IUltez0vqWc/I9SmaOLJQX5eR0FKyVdpL+5aDdATzEtRG S1YaCK/ladNGEGy+NpEFzzuamHP8c+RM0CS4djJif+YZEr266ffLk9L6vRhmfPAZaVGv AgY++XZGdg5bGLWmejoqVdt7ISJK9Y4bZrNxBaLiqs0tyTBcATLJxO5iOLiMbTzbO5vD IgHwaLrvj7kKeeycqqgi8/+76LXpebiTk83B/otFL+y+nRRXXBiGjktlKhCDinghQlN6 ltUv+KfqJNQlH6eTXKoNhQPol4lSJ8wtR+Kin67ulOE3GD3+9+2mG5q1m5wfUCWldAaH LTCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701729107; x=1702333907; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GeE8l76Q/quL8FCAwZbdRu4NkVD0mbI5WOWd8FLcwMU=; b=gPCTKP60Hrat62PJjQeVOVdUihKrd1tH77nLOPdU+ebZcQUDScOLRUGmWZED5yXlxq VdAFO/91KI710I5Ffxb7NSy762SPUU+0ZgVEBRIhxssm5y+/ci/QlI6Rl4/BcrLdQubs COB24RLtNcRb4WM1S+4p0rX9lPGuLHZMwtzq/fkts7fGUW+X9ZDu5ILoUoAWnW0hXktl D4N3kuKqEop4TRZdXsNYFDFwJrgJyAh+2TE85FOWu2Djw7kqhnEPJPGAy3h+XmQf6x9k wx2MjPBM6Y0ErXIaZevXn2kZOuXPKwjGJplW+F1r+QlvCEODNcX95gtB43M44BSnBbGr +NHA== X-Gm-Message-State: AOJu0Yw2aJixDlaj/z+QBqvbtTUWhLI1OQdA78FSD3ngACwjUQJHyfYS bqE4JZ5lEhuFyyMQRk4LzVs= X-Google-Smtp-Source: AGHT+IGkTepzhSGRjEo1lPbhEHz0Zc2lq0+gbYEFJGtw5yyVNjMeks581olqtn402scsNVY8dsTtnQ== X-Received: by 2002:a0c:fa44:0:b0:67a:99fa:f8c9 with SMTP id k4-20020a0cfa44000000b0067a99faf8c9mr341594qvo.13.1701729107350; Mon, 04 Dec 2023 14:31:47 -0800 (PST) Received: from hurd (dsl-141-198.b2b2c.ca. [66.158.141.198]) by smtp.gmail.com with ESMTPSA id g12-20020a0cf08c000000b0067ab9aaaedcsm2064933qvk.9.2023.12.04.14.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:31:46 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Simon Tournier <zimon.toutoune@HIDDEN> Subject: Re: [bug#66592] [PATCH v3] scripts: archive: Check compatibility of command line options. In-Reply-To: <9f5c22f6fe1f4feba5d3561cef011b0c3f55df06.1701340510.git.zimon.toutoune@HIDDEN> (Simon Tournier's message of "Thu, 30 Nov 2023 11:46:13 +0100") References: <fb2bfb115372a037e22df39dc194deabf290a58f.1697549017.git.zimon.toutoune@HIDDEN> <9f5c22f6fe1f4feba5d3561cef011b0c3f55df06.1701340510.git.zimon.toutoune@HIDDEN> Date: Mon, 04 Dec 2023 17:31:45 -0500 Message-ID: <87r0k1r44u.fsf@HIDDEN> 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-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66592 Cc: Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN>, 66592 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, Simon Tournier <zimon.toutoune@HIDDEN> writes: > Fixes <https://issues.guix.gnu.org/66358>. > Reported by Perry, Daniel J <dperry45@HIDDEN>. > > * guix/scripts/archive.scm (guix-archive)[compatible-option]: New procedu= re. > and use it. > * tests/guix-archive.sh: Test it. > --- > guix/scripts/archive.scm | 18 +++++++++++++++++- > tests/guix-archive.sh | 5 +++++ > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm > index 2b5a55a23f..b9cf78f981 100644 > --- a/guix/scripts/archive.scm > +++ b/guix/scripts/archive.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludo= vic Court=C3=A8s <ludo@HIDDEN> > ;;; Copyright =C2=A9 2020 Tobias Geerinckx-Rice <me@HIDDEN> > +;;; Copyright =C2=A9 2023 Simon Tournier <zimon.toutoune@HIDDEN> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -375,8 +376,23 @@ (define-command (guix-archive . args) > (loop (read-line port) > (cons line result))))) >=20=20 > + (define* (compatible-option options #:key actions) > + "Return the OPTIONS if it is compatible with the list of ACTIONS." Sorry for not mentioning this in my first review, but re-reading this code, I think it should be named like: (check-compatibility options actions). There's no point making actions an optional argument since the only point of using this procedure is when you have actions to check compatibility with, right? The docstring should mention that it exits with a user message when the compatibility validation fails. > + (let ((some-actions (filter (lambda (action) > + (assoc-ref options action)) > + actions))) > + (match some-actions > + ((action) > + options) > + ((action other-actions ...) > + (leave (G_ "the options ~{'~s' ~}are exclusive~%") some-actions)) > + (_ > + options)))) > + > (with-error-handling > - (let ((opts (parse-command-line args %options (list %default-options= )))) > + (let* ((opts (parse-command-line args %options (list %default-option= s))) > + (opts (compatible-option opts > + #:actions (list 'authorize 'export '= import)))) > (parameterize ((%graft? (assoc-ref opts 'graft?))) > (cond ((assoc-ref opts 'generate-key) > =3D> > diff --git a/tests/guix-archive.sh b/tests/guix-archive.sh > index 0866b5a4d8..08c07684ad 100644 > --- a/tests/guix-archive.sh > +++ b/tests/guix-archive.sh > @@ -79,4 +79,9 @@ guix archive -t < "$archive" | grep "^r /share/guile.*/= boot-9\.scm" >=20=20 > echo foo | guix archive --authorize && false >=20=20 > +# Check incompatible command-line options > +guix archive --authorize --export --import && false > +guix archive --export guile-bootstrap --authorize > "$archive" && false > +guix archive --authorize --import < "$archive" && false I'm puzzled here, because that's the approach used in commit 37dd69b44511dc73eb04bdebe8d82c9a0386338e, but I don't understand how these checks work: if the command fails, it won't get to execute the part after && (&& only proceeds if the left part exited with status 0), and the test will report a failure even though this is the expected result, no? OK, it was explained by Eric in <https://issues.guix.gnu.org/62406#6>: --8<---------------cut here---------------start------------->8--- 'cmd && false' [...] has the desired semantics under 'set -e' [...] If 'cmd' fails, the return status is ignored by 'set -e', which considers only the return status of a command following the final '&&' or '||'. And because 'cmd' failed the statement short-circuits without executing the 'false. Otherwise, if 'cmd' succeeds, the 'false' is executed and the shell exits immediately. --8<---------------cut here---------------end--------------->8--- Interesting (yet confusing) shell hack. Would you mind sending a v4 with the above suggestion? Then I think we'd be good. --=20 Thanks, Maxim
guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.Received: (at 66592) by debbugs.gnu.org; 30 Nov 2023 18:09:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 30 13:09:08 2023 Received: from localhost ([127.0.0.1]:54457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r8lTI-00061u-LB for submit <at> debbugs.gnu.org; Thu, 30 Nov 2023 13:09:08 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:41445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1r8lTG-00061K-Fu for 66592 <at> debbugs.gnu.org; Thu, 30 Nov 2023 13:09:06 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40b2a628c25so1374405e9.1 for <66592 <at> debbugs.gnu.org>; Thu, 30 Nov 2023 10:08:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701367732; x=1701972532; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=WmkHuLweSAsN9u2gBReRmOQCPij4fzh9j2JKjgJI+pA=; b=aBMYYGImOfr3GhM+qiC1h9Rj58MgaCGhSFxJhyxWcCATcgoQ71hp2FglMoVbfAnykd v8+S8223K/iqS6rjuE9fb5Fvs3tFf2ftRk4Dhg87Y7RnO1peTISxziOktKmwsAlSdiqt Bm0OWytjPakmOki+Qy74ykyt1ryEwrWQydDUmG+PRigM2GhHDWhjXZGwOG/b3UAN0Ae7 Fu7cJwab8Ga468CVjRj2stZbcCeGzJKsqfr/kfdr8u5hb/Zy4ozxQIu3qMhMzT4x3wtV /daHY78DAq9jrchTghAvq7pNMxFQYng4y2LOFv1EIDAaqgk/iJhBgaYOm6njOv1dmVtD jpVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701367732; x=1701972532; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WmkHuLweSAsN9u2gBReRmOQCPij4fzh9j2JKjgJI+pA=; b=DfcPGwCw+YqQISjzRgqRFTrT4ztmq0ZGWGJAiDUWaVUr30Ed+4z75ukrHANYzuFRta 436FEpeH3TUaRF0oScxvmzbwt2Z/44VE/lJ/ezTxHSbTZ6Q5y0IsNdhZLt8KQkBisYiQ a2ROpm290kVbLZIsZ9ntkqTjVf8nk4pwnBAOWF1uzBxafT6j2XrW0JlwGNgdUZ5WIkUP Krfg1U9PiLG+WYOZANTxMmXel1naeHphjakSREtVzFHSc3Jht7ur23Reg5/CVCr1tqPR tl2yuY6DwiZt7tTcsvUtNSGYQon0D9OXGyGLg3Y1SXH9BGV+S5HMWy2TAGNkcYHvH0mX oRYQ== X-Gm-Message-State: AOJu0YygAZAl8snZ5TQxsn4WJaD3T/Q0BcS+deVpaID9U2Js/vL9nbbj m2bwRTu+6D08rtID+CpEL4ajtpq3I88= X-Google-Smtp-Source: AGHT+IH3Vj8ShIRtvV1ghHFePog0aQeWG3I4+rl7D5x1qWa0Sa3vM0eV5KnFuvZ9dTq5yDGe+ruTbQ== X-Received: by 2002:a7b:c7d6:0:b0:40b:5547:76a0 with SMTP id z22-20020a7bc7d6000000b0040b554776a0mr3409815wmk.0.1701367731821; Thu, 30 Nov 2023 10:08:51 -0800 (PST) Received: from lili (roam-nat-fw-prg-194-254-61-40.net.univ-paris-diderot.fr. [194.254.61.40]) by smtp.gmail.com with ESMTPSA id r13-20020adfe68d000000b00333040a4752sm2142278wrm.114.2023.11.30.10.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 10:08:51 -0800 (PST) From: Simon Tournier <zimon.toutoune@HIDDEN> To: Maxim Cournoyer <maxim.cournoyer@HIDDEN> Subject: Re: [bug#66592] [PATCH v2] scripts: archive: Check compatibility of command line options. In-Reply-To: <87ttq6pt7g.fsf@HIDDEN> References: <fb2bfb115372a037e22df39dc194deabf290a58f.1697549017.git.zimon.toutoune@HIDDEN> <5c26f17bbf1b4cf9872b4a782295260ce337d3fd.1698165008.git.zimon.toutoune@HIDDEN> <87ttq6pt7g.fsf@HIDDEN> Date: Thu, 30 Nov 2023 11:46:55 +0100 Message-ID: <87leaf5xi8.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, On mar., 31 oct. 2023 at 14:01, Maxim Cournoyer wrote: > Could you please send a v3 with some tests for it? Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32c listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zimon.toutoune[at]gmail.com) 1.1 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 66592 Cc: 66592 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.1 (/) Hi, On mar., 31 oct. 2023 at 14:01, Maxim Cournoyer <maxim.cournoyer@HIDDEN> wrote: > Could you please send a v3 with some tests for it? Done. WDYT? Cheers, simon
guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.Received: (at 66592) by debbugs.gnu.org; 30 Nov 2023 10:46:35 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 30 05:46:35 2023 Received: from localhost ([127.0.0.1]:52416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r8eZ1-0004CN-4n for submit <at> debbugs.gnu.org; Thu, 30 Nov 2023 05:46:35 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:39295) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1r8eYy-0004C8-HD for 66592 <at> debbugs.gnu.org; Thu, 30 Nov 2023 05:46:33 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40b4ff0f254so805255e9.1 for <66592 <at> debbugs.gnu.org>; Thu, 30 Nov 2023 02:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701341178; x=1701945978; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IamyVjjN+6839Sy++oozXEYY2aXcZnw4TPp2FYwBqAU=; b=dHFHsA+O1SgNxBlssoM4lzXex9NZyaX9OVZlf6y3j2SAL7SUsqLcWFQKn3VXeeF5hW 0cahodOklQmFuYUlCnubcO2sWiPcViaoS9kcp+DdPgj5J6Nr5OLGbVWNgxiIFVamngNI mqJ/huQIiYcL0XZHYvPVGWjNVbfkznGEZwsC2yCzzE0mTV1+h5/alUjOB4ND/SN+/Ck2 dKLly5LhLB3O4QvXZnMEtgvoqZTNGGoZw7txQppjUkIaZh2UXyIR8KWoh/U/x/Dt/wC8 02AgIzudF698FZy1zzV2EjJ3I7iLzfpPBCdi6ZurM41Sqt8LqdW1wRorMgelbptmJOYp Slrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701341178; x=1701945978; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IamyVjjN+6839Sy++oozXEYY2aXcZnw4TPp2FYwBqAU=; b=vxlyjUdRJO/9wlk6MAasdV5Qg4dmxtGf2aWCsUFwzkYU7gGYaKA87LxpggDZKQg2zx C83Suza0de9x6TxbbdJL7IelgPm+00Uo+XfIDiMPQxunWB0qNUfaPnTcgny4HDNw1DQG /C0/qv9iZkf13GPu+0iIx91++TU01BktV06C+0dm7Sz2L6gvpIse3LEj7hYNjrhKLAOd zqGz3pSvANt7OkeKCN82AxHONb7NH/4Ua+bsrDB3HOUo+m7UJ1F+nOA6iLa5tIU4joLT +M1l5P4oZqd+PvrxrASjhC4QPj1O8MiD/8+U8iHkxith3k4Hus5R9Y0JlC/hK8TVfZSD pEuQ== X-Gm-Message-State: AOJu0Yx7MXEZJO85EPr3ZVfWMMyn0RAYJ2m7G1xuCuMwEPANSO/qBtdJ 4gg+FH2ALP8f3jc1eQiNEC88+vm5EQI= X-Google-Smtp-Source: AGHT+IEUWcbwgrHHXq5ttLQCToUPe6XWNLA7UK522SVt3Snq+LQGcTezzhzYSUlekxfGyb7gqObpYA== X-Received: by 2002:a05:600c:1c97:b0:3fe:d637:7b25 with SMTP id k23-20020a05600c1c9700b003fed6377b25mr983250wms.0.1701341178138; Thu, 30 Nov 2023 02:46:18 -0800 (PST) Received: from lili.univ-paris-diderot.fr (roam-nat-fw-prg-194-254-61-45.net.univ-paris-diderot.fr. [194.254.61.45]) by smtp.gmail.com with ESMTPSA id p36-20020a05600c1da400b0040b478da760sm1522557wms.48.2023.11.30.02.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:46:17 -0800 (PST) From: Simon Tournier <zimon.toutoune@HIDDEN> To: 66592 <at> debbugs.gnu.org Subject: [PATCH v3] scripts: archive: Check compatibility of command line options. Date: Thu, 30 Nov 2023 11:46:13 +0100 Message-ID: <9f5c22f6fe1f4feba5d3561cef011b0c3f55df06.1701340510.git.zimon.toutoune@HIDDEN> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 66592 Cc: Simon Tournier <zimon.toutoune@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fixes <https://issues.guix.gnu.org/66358>. Reported by Perry, Daniel J <dperry45@HIDDEN>. * guix/scripts/archive.scm (guix-archive)[compatible-option]: New procedure. and use it. * tests/guix-archive.sh: Test it. --- guix/scripts/archive.scm | 18 +++++++++++++++++- tests/guix-archive.sh | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index 2b5a55a23f..b9cf78f981 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@HIDDEN> ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@HIDDEN> +;;; Copyright © 2023 Simon Tournier <zimon.toutoune@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -375,8 +376,23 @@ (define-command (guix-archive . args) (loop (read-line port) (cons line result))))) + (define* (compatible-option options #:key actions) + "Return the OPTIONS if it is compatible with the list of ACTIONS." + (let ((some-actions (filter (lambda (action) + (assoc-ref options action)) + actions))) + (match some-actions + ((action) + options) + ((action other-actions ...) + (leave (G_ "the options ~{'~s' ~}are exclusive~%") some-actions)) + (_ + options)))) + (with-error-handling - (let ((opts (parse-command-line args %options (list %default-options)))) + (let* ((opts (parse-command-line args %options (list %default-options))) + (opts (compatible-option opts + #:actions (list 'authorize 'export 'import)))) (parameterize ((%graft? (assoc-ref opts 'graft?))) (cond ((assoc-ref opts 'generate-key) => diff --git a/tests/guix-archive.sh b/tests/guix-archive.sh index 0866b5a4d8..08c07684ad 100644 --- a/tests/guix-archive.sh +++ b/tests/guix-archive.sh @@ -79,4 +79,9 @@ guix archive -t < "$archive" | grep "^r /share/guile.*/boot-9\.scm" echo foo | guix archive --authorize && false +# Check incompatible command-line options +guix archive --authorize --export --import && false +guix archive --export guile-bootstrap --authorize > "$archive" && false +guix archive --authorize --import < "$archive" && false + exit 0 base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767 -- 2.41.0
guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.Received: (at 66592) by debbugs.gnu.org; 31 Oct 2023 18:01:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 31 14:01:51 2023 Received: from localhost ([127.0.0.1]:49128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qxt3n-0006O1-7Q for submit <at> debbugs.gnu.org; Tue, 31 Oct 2023 14:01:51 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]:53271) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1qxt3k-0006Nn-Es for 66592 <at> debbugs.gnu.org; Tue, 31 Oct 2023 14:01:50 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-586ba7cdb6bso3091041eaf.2 for <66592 <at> debbugs.gnu.org>; Tue, 31 Oct 2023 11:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698775268; x=1699380068; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mk/zKzIoX0ooR00I072QxoEHyphAjWktVftXkv6pFRg=; b=L1DKd5ALUA/Lzq2sjnpUz5F7fBL5spXDs38/Vxuk2nmS2sdbZ+cAj4fi5UhclvyuUt 8KoeKt2y98y8qj0Ad6SvXlvN2J4igl0GYDPkrQhXOqklEV1JvpbrDjNVuaIxPnqdx+31 cRWIJwIhRsVmpajASM+EFF1m+Ii6oMKXxi2VyAg+tsFFN1MRYO9KNXg+wfmSxm8DFuYg ZKVFUMgV1axrKwDGho5QqhlrdVoJlk1uObAmAk1xA+PJzTq5S1njtsBuFiv0pHCB7OpN GnmGSml7WjTqPb1w87tObSP5/0IAjGSGYCSP2Ix4qsq0umOt/yiWbeAmFLGqAQ7Ies/M JqWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698775268; x=1699380068; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mk/zKzIoX0ooR00I072QxoEHyphAjWktVftXkv6pFRg=; b=jyh0mZBYpETUyFwzIXZNjosfmLhlgVPEl4FCrlUbjMbT43qShM7lL8izYuIfgkiKgi wNmpDBJ9xap7QgJ9VLMmezjK7Pl3TE0HqqPX+LyJzFJGJ+6QEi7ANqBffs1rW14TTaPW a2uUFA7llZc2iuzDddh/oNfhQ5ESaDFH5ioDwoDUfe4tAPYBRElW6equ4t+IUuSvBaqP q/LjtmiMsKqqf+8jIBNWY59mgcTpPL1Kj1d4Ev67kCfrcSU9my8xQw3FwCaMcKXkSdgb 6oaNOnqsBgat+iwSxfKaLyIVGFJrvo7op8fDEjREB0bBFyMQxm/OPFuXAejH0GWEXmU9 yKrA== X-Gm-Message-State: AOJu0YwGwYr43ou1sfqC/k7J1npHImLi1DUmK/AXtzvWGceqKZKHitXm T8FvcHQqLw3kZfbNkkQVOn81gCztZVjuhg== X-Google-Smtp-Source: AGHT+IEmhcNKCPf1KTPS2Y9ZTURJ52HrLp7LNMRpTJS1Aj46TRceEszpFYyMD0dDJ8bdV82muDl6GQ== X-Received: by 2002:a05:6359:2884:b0:168:ba46:d9dd with SMTP id qa4-20020a056359288400b00168ba46d9ddmr10948583rwb.17.1698775268312; Tue, 31 Oct 2023 11:01:08 -0700 (PDT) Received: from hurd (dsl-10-128-239.b2b2c.ca. [72.10.128.239]) by smtp.gmail.com with ESMTPSA id ez2-20020ad45902000000b0066cf06339bcsm745619qvb.0.2023.10.31.11.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 11:01:07 -0700 (PDT) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: Simon Tournier <zimon.toutoune@HIDDEN> Subject: Re: [bug#66592] [PATCH v2] scripts: archive: Check compatibility of command line options. In-Reply-To: <5c26f17bbf1b4cf9872b4a782295260ce337d3fd.1698165008.git.zimon.toutoune@HIDDEN> (Simon Tournier's message of "Tue, 24 Oct 2023 18:33:10 +0200") References: <fb2bfb115372a037e22df39dc194deabf290a58f.1697549017.git.zimon.toutoune@HIDDEN> <5c26f17bbf1b4cf9872b4a782295260ce337d3fd.1698165008.git.zimon.toutoune@HIDDEN> Date: Tue, 31 Oct 2023 14:01:07 -0400 Message-ID: <87ttq6pt7g.fsf@HIDDEN> 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-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66592 Cc: 66592 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Simon, Simon Tournier <zimon.toutoune@HIDDEN> writes: > Fixes <https://issues.guix.gnu.org/66358>. > Reported by Perry, Daniel J <dperry45@HIDDEN>. > > * guix/scripts/archive.scm (guix-archive)[compatible-option]: New procedu= re. > and use it. > --- > guix/scripts/archive.scm | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm > index 2b5a55a23f..466aa9c4d7 100644 > --- a/guix/scripts/archive.scm > +++ b/guix/scripts/archive.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludo= vic Court=C3=A8s <ludo@HIDDEN> > ;;; Copyright =C2=A9 2020 Tobias Geerinckx-Rice <me@HIDDEN> > +;;; Copyright =C2=A9 2023 Simon Tournier <zimon.toutoune@HIDDEN> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -375,8 +376,24 @@ (define-command (guix-archive . args) > (loop (read-line port) > (cons line result))))) >=20=20 > + (define* (compatible-option options #:key actions) > + "Return the OPTIONS if it is compatible with the list of ACTIONS." > + (let ((some-actions (fold (lambda (action answers) > + (if (assoc-ref options action) > + (cons action answers) > + answers)) > + '() > + actions))) > + (match some-actions > + ((action) > + options) > + ((action other-actions ...) > + (leave (G_ "the options ~{'~s' ~}are exclusive~%") some-actions))= ))) > + > (with-error-handling > - (let ((opts (parse-command-line args %options (list %default-options= )))) > + (let* ((opts (parse-command-line args %options (list %default-option= s))) > + (opts (compatible-option opts > + #:actions (list 'authorize 'export '= import)))) > (parameterize ((%graft? (assoc-ref opts 'graft?))) > (cond ((assoc-ref opts 'generate-key) > =3D> Looks good from a cursory look, but it seems a nice to test in tests/guix-archive.sh. Could you please send a v3 with some tests for it? --=20 Thanks, Maxim
guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.Received: (at 66592) by debbugs.gnu.org; 24 Oct 2023 16:34:03 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 24 12:34:03 2023 Received: from localhost ([127.0.0.1]:56521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qvKLy-0005d9-8e for submit <at> debbugs.gnu.org; Tue, 24 Oct 2023 12:34:02 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:41067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1qvKLr-0005cS-7q for 66592 <at> debbugs.gnu.org; Tue, 24 Oct 2023 12:34:01 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-408363c2918so5483645e9.0 for <66592 <at> debbugs.gnu.org>; Tue, 24 Oct 2023 09:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698165199; x=1698769999; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iEUF6/dJuicCvIQ+Fgil+mE1yc6VnjQGnYAZcplVaxQ=; b=NRbXeeOgm2jrrovamkxZFvYuk3ZkArNqCvniiSTaYSA4d0mdI8pXzRN0sVTEWGDwqi LYGz+Z2THuAnscUD3GtjMr+Uj0qYozdP/qe3ox/0lquFkZL8ndguCuyfnyFLI/NtUFP9 xs5IP8mUKawIE3Bx1TuslhDvMuI6KNeVNYvouS9LZj+OTtgrryaH4YbVmB/fYc0Ca++X q9l5bGB6CRkqKZo0tPLB93Nd/x7rvfqo9IgwqGzOKh63FV8XSKNt4djH5V6xwz10d1XF FbOEg8WFQ25FLmIKRLPDd/As/FPP0f7+uRIULfBdBFqhWTgp5YQTEq8oB6uYyYPsb07k nJSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698165199; x=1698769999; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iEUF6/dJuicCvIQ+Fgil+mE1yc6VnjQGnYAZcplVaxQ=; b=xUp2Nj69nWIfH/xICwJkCw9RpyySfdAlMuO/MfdRWA8np+RafpMlPkwxbW4EievzQi GyqDfKWXdTckoDnNAsR4NwMUPzk5WQZmvO8Q+3p34yGdUocLAM3/Bn4sSmIM4wnp1jnQ GZqz/efZBP8sa41Ap3TvFjS9cHr4gg9HfuvmwFjHornBytQmsMy9NzZxHh0Nw9cDbVM3 rE0jqX5WSGF+mNWnzsNtHMgcGrsOHyvbHtukQh6Nr8XkwsJDjuBKYi2LfyLsPJ2lp4Cd bJwThXtpqX9KVwIUQqwPYoWLhelaEfG5LSvhEjqXKuluMgqebSLjuI4jtzOTEEqgUzeB 7obw== X-Gm-Message-State: AOJu0Yy502mgsOHwDbFbo0tK+VQkVTBayaaEickeot36/1C1egKscQlh WjOk5zn7qU8NgdFq8BIDAAxPrJFhsBw= X-Google-Smtp-Source: AGHT+IFJrn9qebrbhlidIzGQ4cgXeXDDr4E7aL47GP94mjS7ahtj6aASB6fp4TwOWpUL3aGBRHmfqg== X-Received: by 2002:a05:600c:3392:b0:404:72f9:d59a with SMTP id o18-20020a05600c339200b0040472f9d59amr9519364wmp.0.1698165199225; Tue, 24 Oct 2023 09:33:19 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id l4-20020a05600c4f0400b003fee53feab5sm12547581wmq.10.2023.10.24.09.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:33:18 -0700 (PDT) From: Simon Tournier <zimon.toutoune@HIDDEN> To: 66592 <at> debbugs.gnu.org Subject: [PATCH v2] scripts: archive: Check compatibility of command line options. Date: Tue, 24 Oct 2023 18:33:10 +0200 Message-Id: <5c26f17bbf1b4cf9872b4a782295260ce337d3fd.1698165008.git.zimon.toutoune@HIDDEN> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66592 Cc: Simon Tournier <zimon.toutoune@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fixes <https://issues.guix.gnu.org/66358>. Reported by Perry, Daniel J <dperry45@HIDDEN>. * guix/scripts/archive.scm (guix-archive)[compatible-option]: New procedure. and use it. --- guix/scripts/archive.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index 2b5a55a23f..466aa9c4d7 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@HIDDEN> ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@HIDDEN> +;;; Copyright © 2023 Simon Tournier <zimon.toutoune@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -375,8 +376,24 @@ (define-command (guix-archive . args) (loop (read-line port) (cons line result))))) + (define* (compatible-option options #:key actions) + "Return the OPTIONS if it is compatible with the list of ACTIONS." + (let ((some-actions (fold (lambda (action answers) + (if (assoc-ref options action) + (cons action answers) + answers)) + '() + actions))) + (match some-actions + ((action) + options) + ((action other-actions ...) + (leave (G_ "the options ~{'~s' ~}are exclusive~%") some-actions))))) + (with-error-handling - (let ((opts (parse-command-line args %options (list %default-options)))) + (let* ((opts (parse-command-line args %options (list %default-options))) + (opts (compatible-option opts + #:actions (list 'authorize 'export 'import)))) (parameterize ((%graft? (assoc-ref opts 'graft?))) (cond ((assoc-ref opts 'generate-key) => base-commit: f3714b3d5f51aced4b31447c42d5e89c75e3079f -- 2.38.1
guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.Received: (at submit) by debbugs.gnu.org; 17 Oct 2023 13:29:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 17 09:29:57 2023 Received: from localhost ([127.0.0.1]:58883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qsk8z-0000Fk-4y for submit <at> debbugs.gnu.org; Tue, 17 Oct 2023 09:29:57 -0400 Received: from lists.gnu.org ([2001:470:142::17]:46918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1qsk8w-0000FW-Sy for submit <at> debbugs.gnu.org; Tue, 17 Oct 2023 09:29:56 -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 <zimon.toutoune@HIDDEN>) id 1qsk8N-00019H-0t for guix-patches@HIDDEN; Tue, 17 Oct 2023 09:29:19 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <zimon.toutoune@HIDDEN>) id 1qsk8K-0001Cs-82 for guix-patches@HIDDEN; Tue, 17 Oct 2023 09:29:18 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-507a3af69d8so1107960e87.0 for <guix-patches@HIDDEN>; Tue, 17 Oct 2023 06:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697549353; x=1698154153; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VuGaQVHTdZ3FK/nngsVRK43EdxfhroYPoQTb94Yq+fQ=; b=NvD7BRjrqlSm8GqDvV3ZEobgL0g9yvaV3VaiFsdcBh83da/5ZG1Y+9vs7CJjTF83lD 5bmEplO79btsU8QME4U9692IAsCLnQa/Fm+CTiIZovwUq7obORWORll5j572wzZbf8M0 Y9lyUPtJwSjHrHG3USX3zbaMDWJA3w4lqRUZyfnAEO+cY1JlratY5z5E2mXrOc0TihKP rxSCm7R0ZAKZmU1iITQUs0eFaUIvuVMQ2ET79qjtAY5kSCtsUXBqayulKS0mR0hXNjaH 31vXEWiCnwenp+ck1KCOMIXeell8D+9Jjdz7N0XMqOFks2UIQwmKqYoTMtB8cqFap1mt Os3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697549353; x=1698154153; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VuGaQVHTdZ3FK/nngsVRK43EdxfhroYPoQTb94Yq+fQ=; b=Lqt2xr7FIJOMgvHo8ZVmoMR5QEL67hTmk0+ur+OdzDncbyC46BfqQljZjW6iqSB+AP pUkk6s/BqSPguR8u73u0TgaOr3l5AgxvTGnj8RwbdoOWpkXHyCO9uUlRYJn7kqnAvDVG mwIDk4xc+X0woI4kMPrzZNhJU/GfCfA/yBhGRPFTuLjY46qrfA6UHJKpKLZTZaNzkmmc 2a6TpdNmuVj+ynPF2KBehTSeYwFR2qMYoURki1eJn4E36Y7HRnwI0tI2Yo1pB90zk2da LhNhU0AqJnJz6zG8RXAZ/yHj3oagoDKh5YMnTFVs5JmgRCHuBpOspILMYPQd4P0Dj5GO v5Rw== X-Gm-Message-State: AOJu0YzuNi/U4Jsvs4O4uYiqOSFkZhWsCxaWzjEuDqcgp339TNZcG+If 6wVDtYU7Mxr9kXHFmzy1mE9Gmu7Z0Ko= X-Google-Smtp-Source: AGHT+IEIry/CRfc0MhNCXcf+3KV6VW8khDs6eYLBXZYnhObVlmMOHbUxvVisltXLbSyjLZ1RZHybvg== X-Received: by 2002:a05:6512:b87:b0:507:9854:3b96 with SMTP id b7-20020a0565120b8700b0050798543b96mr1797528lfv.1.1697549352933; Tue, 17 Oct 2023 06:29:12 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id k2-20020a5d4282000000b0032daf848f68sm1685771wrq.59.2023.10.17.06.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 06:29:12 -0700 (PDT) From: Simon Tournier <zimon.toutoune@HIDDEN> To: guix-patches@HIDDEN Subject: [PATCH] scripts: archive: Check compatibility of command line options. Date: Tue, 17 Oct 2023 15:28:56 +0200 Message-Id: <fb2bfb115372a037e22df39dc194deabf290a58f.1697549017.git.zimon.toutoune@HIDDEN> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=zimon.toutoune@HIDDEN; helo=mail-lf1-x12f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: Simon Tournier <zimon.toutoune@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Fixes <https://issues.guix.gnu.org/66358>. Reported by Perry, Daniel J <dperry45@HIDDEN>. * guix/scripts/archive.scm (compatible-option): New procedure. (%options): Use it. --- guix/scripts/archive.scm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index 2b5a55a23f..a1b2b73a0f 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@HIDDEN> ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@HIDDEN> +;;; Copyright © 2023 Simon Tournier <zimon.toutoune@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -115,6 +116,22 @@ (define %key-generation-parameters "(genkey (ecdsa (curve Ed25519) (flags rfc6979)))" "(genkey (rsa (nbits 4:4096)))")) +(define* (compatible-option result + #:optional + (actions (list 'authorize 'export 'import))) + "Return the RESULT if it is compatible with the list of ACTIONS." + (let ((some-actions (fold (lambda (action answers) + (if (assoc-ref result action) + (cons action answers) + answers)) + '() + actions))) + (match some-actions + ((action) + result) + ((action other-action _ ...) + (leave (G_ "ambiguous options: ~s with ~s~%") action other-action))))) + (define %options ;; Specifications of the command-line options. (cons* (option '(#\h "help") #f #f @@ -126,13 +143,13 @@ (define %options (show-version-and-exit "guix archive"))) (option '("export") #f #f (lambda (opt name arg result) - (alist-cons 'export #t result))) + (compatible-option (alist-cons 'export #t result)))) (option '(#\r "recursive") #f #f (lambda (opt name arg result) (alist-cons 'export-recursive? #t result))) (option '("import") #f #f (lambda (opt name arg result) - (alist-cons 'import #t result))) + (compatible-option (alist-cons 'import #t result)))) (option '("missing") #f #f (lambda (opt name arg result) (alist-cons 'missing #t result))) @@ -158,7 +175,7 @@ (define %options (error-string err)))))) (option '("authorize") #f #f (lambda (opt name arg result) - (alist-cons 'authorize #t result))) + (compatible-option (alist-cons 'authorize #t result)))) (option '(#\S "source") #f #f (lambda (opt name arg result) base-commit: dcc5c34504c94732c135a85fb4db40ca9796270e -- 2.38.1
Simon Tournier <zimon.toutoune@HIDDEN>
:guix-patches@HIDDEN
.
Full text available.guix-patches@HIDDEN
:bug#66592
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.