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

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

bug#59923: closed (Error when installing non-existent package add traili


From: GNU bug Tracking System
Subject: bug#59923: closed (Error when installing non-existent package add trailing dash character to package name)
Date: Sun, 11 Dec 2022 18:04:02 +0000

Your message dated Sun, 11 Dec 2022 10:03:31 -0800
with message-id 
<CADwFkmnSu1PDT-+O3D9wd84czLhZjy-e_=W4OT3_+z0RgORiQg@mail.gmail.com>
and subject line Re: bug#59923: Error when installing non-existent package add 
trailing dash character to package name
has caused the debbugs.gnu.org bug report #59923,
regarding Error when installing non-existent package add trailing dash 
character to package name
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
59923: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59923
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 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)



--- End Message ---
--- Begin Message --- Subject: Re: bug#59923: Error when installing non-existent package add trailing dash character to package name Date: Sun, 11 Dec 2022 10:03:31 -0800
Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> 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)
>>>
>
> LGTM (modulo the wrapping introduced by email quoting, obviously :-)
>
>
>         Stefan

Thanks, installed (commit 3e349ee119).


--- End Message ---

reply via email to

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