From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mEhDLKxjul60ZwAA0tVLHw (envelope-from ) for ; Tue, 12 May 2020 08:51:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id APVpALtjul62QAAAB5/wlQ (envelope-from ) for ; Tue, 12 May 2020 08:52: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 51DFA940068 for ; Tue, 12 May 2020 08:52:08 +0000 (UTC) Received: from localhost ([::1]:51254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYQe0-0000kk-EZ for larch@yhetil.org; Tue, 12 May 2020 04:52:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYQdt-0000ka-Ue for bug-guix@gnu.org; Tue, 12 May 2020 04:52:01 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYQdt-0003fo-Lg for bug-guix@gnu.org; Tue, 12 May 2020 04:52:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jYQdt-0004qq-JV for bug-guix@gnu.org; Tue, 12 May 2020 04:52:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#40549: More usability issues: Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 12 May 2020 08:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40549 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: zimoun Received: via spool by 40549-submit@debbugs.gnu.org id=B40549.158927349818616 (code B ref 40549); Tue, 12 May 2020 08:52:01 +0000 Received: (at 40549) by debbugs.gnu.org; 12 May 2020 08:51:38 +0000 Received: from localhost ([127.0.0.1]:54119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYQdV-0004qC-Sq for submit@debbugs.gnu.org; Tue, 12 May 2020 04:51:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYQdU-0004px-ER for 40549@debbugs.gnu.org; Tue, 12 May 2020 04:51:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36066) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYQdO-0003de-By; Tue, 12 May 2020 04:51:30 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=40928 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jYQdO-0005qk-0q; Tue, 12 May 2020 04:51:30 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <6171889.DvuYhMxLoT@cherry> <3827671.e9J7NaK4W3@peach> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 =?UTF-8?Q?Flor=C3=A9al?= 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: Tue, 12 May 2020 10:51:28 +0200 In-Reply-To: (zimoun's message of "Tue, 12 May 2020 02:27:03 +0200") Message-ID: <87mu6dcz8v.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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 40549@debbugs.gnu.org, Tom Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Scan-Result: default: False [-1.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.54014206468552]; TO_DN_SOME(0.00)[]; DWL_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.06), country: US(-0.00), ip: 209.51.188.17(-0.54)]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[ludo@gnu.org,bug-guix-bounces@gnu.org]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; SPF_REPUTATION_HAM(0.00)[-0.56487956732625]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[gnu.org]; HAS_LIST_UNSUB(-0.01)[]; DNSWL_BLOCKED(0.00)[209.51.188.17:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: Tp7xMf3h2+BZ Hi, zimoun skribis: >> --8<---------------cut here---------------start------------->8---> # OK >> guix package --list-generations -p /path/to/profile >> guix package --list-installed -p /path/to/profile >> >> # KO >> guix package -l -p /path/to/profile >> guix package -I -p /path/to/profile >> >> # OK >> guix package -p /path/to/profile -l >> guix package -p /path/to/profile -I >> >> # KO >> guix package -l --profile=3D/path/to/profile >> >> # Do nothing >> guix package -I --profile=3D/path/to/profile >> >> # OK >> guix package -l --profile=3D/path/to/profile -l >> guix package -I --profile=3D/path/to/profile -I >> --8<---------------cut here---------------end--------------->8--- > > All are expected too. > Same reason. And the long option works because no argument is > provided by '=3D' so it fallback to the default one "". > Short options expect an argument so read the next characters as the > value or fallback to the default one "" when there is no next > character. > > Fixing this will add complexity on parsing 'args' when building > 'opts'. Basically, "guix package -I -p /path/tp/profile" returns an > error because the short option '-I' expect only one argument, read > '-p' and then Guix cannot deals with the option '/path/to/profile' and > so raises an error. See the dance with 'handle-argument' and > 'arg-handler'. And "guix package -I '' -p /path/to/profile' works, > obviously. Well, the extra quotes ('') is annoying but I am not > convince that better could be done for short options -- regardless the > order of CLI arguments. Nothing new here, and everything is properly documented. I think there are option parsers that =E2=80=9Ccorrectly=E2=80=9D deal with= the ambiguity that arises for instance with =E2=80=9C-I -p foo=E2=80=9D (is =E2= =80=98-p=E2=80=99 the argument to =E2=80=98-I=E2=80=99 or something else?). Perhaps libc=E2=80= =99s argp does it right. However (srfi srfi-37) does it as we see it now. Fixing it would mean implementing a different option parser. > Why (a) works and (b) not? Because the command-line is transformed > into an alist. And this alist is built reading the command-line from > right to left. Therefore, if you are on the generation 18 and you try > to delete it, Guix raises an error which seems expected. The second > one (b) works because first you switch and then you delete. > > Well, that's said, IMHO, two options: > > 1) the order of CLI does not matter; > 2) the order of CLI matters. > > Well, the order of 'actions' necessary matters as it is seen with this > example: "switch and then delete" does not end in the same state than > "delete and then switch". Welcome in the classical mess of imperative > package manager. ;-) > Therefore, I am not convinced that something should be fixed. It > comes from the very nature of 'actions': actions is not always > commutative. Otherwise the best is to forbid to provide several > actions with the same transaction; which seems a bad idea -- at least > for me. Right, but at least we could reverse the list returned by =E2=80=98args-fol= d=E2=80=99. > However, main of us are used to read from left to right so it seems > more natural to write: > > guix package --action1 --action2 # (a) > than > guix package --action2 --action1 # (b) > > in other words, the fix should be to simply 'reverse opts' and the CLI > will read (a) instead of the current (b). My only concern is about > backward compatibility. We=E2=80=99ll need to check exactly what will behave differently. If the t= ests don=E2=80=99t catch anything, I think we=E2=80=99re fine. Most likely, we= =E2=80=99re talking about corner cases like =E2=80=98-S x -d y=E2=80=99, which probably very fe= w people tried. Thanks, Ludo=E2=80=99.