From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#27820: guix package -u: order of argument is significant Date: Wed, 26 Jul 2017 10:14:02 +0200 Message-ID: <874ltzbool.fsf@gnu.org> References: <5977294D.1020304@crazy-compilers.com> <87fudkb8zm.fsf@netris.org> <8760egcjdc.fsf@gnu.org> <87eft46wir.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daHTG-0001nt-Bj for bug-guix@gnu.org; Wed, 26 Jul 2017 04:15:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daHTC-0007lV-9C for bug-guix@gnu.org; Wed, 26 Jul 2017 04:15:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:54027) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daHTC-0007lQ-5I for bug-guix@gnu.org; Wed, 26 Jul 2017 04:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1daHTB-0006Kc-VA for bug-guix@gnu.org; Wed, 26 Jul 2017 04:15:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87eft46wir.fsf@elephly.net> (Ricardo Wurmus's message of "Tue, 25 Jul 2017 23:23:40 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ricardo Wurmus Cc: 27820@debbugs.gnu.org, Hartmut Goebel Ricardo Wurmus skribis: > Ludovic Court=C3=A8s writes: > >> Mark H Weaver skribis: >> >>> I agree that this is quite confusing. Perhaps we should issue a warning >>> if the regexp begins with "-". >>> >>> Also, perhaps we should *always* require an argument after "-u", even if >>> "-u" is at the end of the command line, failing otherwise. Users would >>> then learn to always pass an argument to "-u", and thus would be less >>> likely to fall into this trap when adding more options after the "-u". >> >> I=E2=80=99m in favor of the former: >> >> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm >> index 8da7a3fd3..b6133b6af 100644 >> --- a/guix/scripts/package.scm >> +++ b/guix/scripts/package.scm >> @@ -486,6 +486,11 @@ Install, remove, or upgrade packages in a single tr= ansaction.\n")) >> arg-handler)))) >> (option '(#\u "upgrade") #f #t >> (lambda (opt name arg result arg-handler) >> + (when (string-prefix? "-" arg) >> + (warning (G_ "upgrade regexp '~a' looks like a \ >> +command-line option~%") >> + arg) >> + (warning (G_ "is this intended?~%"))) >> (let arg-handler ((arg arg) (result result)) >> (values (alist-cons 'upgrade arg >> ;; Delete any prior "upgrade a= ll" >> >> Thoughts? > > This seems good to me. I just wonder if there are legitimate cases > where a package regexp would look like a command line option. If that=E2= =80=99s > not the case could we just =E2=80=9Cunread=E2=80=9D the argument and pars= e it as the > next option? I thought about it but in theory =E2=80=9C-=E2=80=9D is perfectly legitimat= e, so I thought we=E2=80=99d rather not try to be smart. Thoughts? Ludo=E2=80=99.