From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59923: Error when installing non-existent package add trailing dash character to package name Date: Sun, 11 Dec 2022 12:29:03 +0200 Message-ID: <837cyyutcg.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31600"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59923@debbugs.gnu.org To: Stefan Kangas , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 11 11:30:34 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4JbN-00082C-Ha for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Dec 2022 11:30:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4Jb4-0006KF-Mr; Sun, 11 Dec 2022 05:30:14 -0500 Original-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 1p4Jat-0006Jb-49 for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 05:30:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4Jas-0002TN-Po for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 05:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4Jas-0008TW-D7 for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 05:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Dec 2022 10:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59923 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59923-submit@debbugs.gnu.org id=B59923.167075455232536 (code B ref 59923); Sun, 11 Dec 2022 10:30:02 +0000 Original-Received: (at 59923) by debbugs.gnu.org; 11 Dec 2022 10:29:12 +0000 Original-Received: from localhost ([127.0.0.1]:46301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4Ja4-0008Si-0R for submit@debbugs.gnu.org; Sun, 11 Dec 2022 05:29:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:39736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4Ja2-0008Sa-DH for 59923@debbugs.gnu.org; Sun, 11 Dec 2022 05:29:10 -0500 Original-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 1p4JZw-0002O5-OY; Sun, 11 Dec 2022 05:29:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1jERLHwmEdWaZld0z0DHgAZlCNu8iYBk9Z3vKOLnDrM=; b=U7csdEHNEQgqZGXDlRN5 RRzcuBCy/kxtO1FiOZy12LJH1ol/3ECQbu8ofKPWgXUeJPKR+8WEA7tael8qjHNokIJ0Z7TRfPa7O Ux2mEho38M/q9R+Zr37mMgzMLHag6BuKMA0obo4MrGPlrw7dgNrHcj0w4Bk6RvE/q52/SJnWxtdyV bFYP/FgNkzjlUcWSAZ6788nkaBlGlE0uMAGVWRsKRSyupmEPYmrmiE1cihTkTe/xtuKWneonc6wsf GK2ZV+A2086ZBcAzNlDIWWt/iybOldhFJdKP7a1ua4etV9jLrxkKJ1oYX7v0j/xzpai8BF32rITLN 8l1ecklRyobDWQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4JZv-00007X-OV; Sun, 11 Dec 2022 05:29:04 -0500 In-Reply-To: (message from Stefan Kangas on Fri, 9 Dec 2022 02:57:15 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250590 Archived-At: > From: Stefan Kangas > Date: Fri, 9 Dec 2022 02:57:15 -0800 > > When evaluating the following to install a package that is not > available, > > (package-install 'foobar) > > I get the error message > > Package ‘foobar-’ is unavailable > > This makes me think I made a typo, and have added a trailing dash that > shouldn't have been there. I would expect the package name to not > contain that trailing dash. > > Here's the backtrace: > > Debugger entered--Lisp error: (error "Package ‘foobar-’ is unavailable") > error("Package `%s-%s' is unavailable" foobar "") > package-compute-transaction(nil ((foobar))) > package-install(foobar) > elisp--eval-last-sexp(nil) > eval-last-sexp(nil) > funcall-interactively(eval-last-sexp nil) > command-execute(eval-last-sexp) > > Perhaps this is an okay fix? > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index a9fd8c741e..4d33311cb7 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -1949,8 +1949,10 @@ package-compute-transaction > (if (eq next-pkg 'emacs) > (error "This package requires Emacs version %s" > (package-version-join next-version)) > - (error "Package `%s-%s' is unavailable" > - next-pkg (package-version-join next-version)))))) > + (error (if (not next-version) > + (format "Package `%s' is unavailable" next-pkg) > + (format "Package `%s' (version %s) is unavailable" > + next-pkg (package-version-join > next-version)))))))) > (setq packages > (package-compute-transaction (cons found packages) > (package-desc-reqs found) > Barring objections or better ideas from Stefan (CC'ed), I think you should install the above. Thanks.