bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59923: Error when installing non-existent package add trailing dash


From: Stefan Kangas
Subject: bug#59923: Error when installing non-existent package add trailing dash character to package name
Date: Fri, 9 Dec 2022 02:57:15 -0800

Severity: minor
Tags: patch

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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]