unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#59923: Error when installing non-existent package add trailing dash character to package name
@ 2022-12-09 10:57 Stefan Kangas
  2022-12-11 10:29 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2022-12-09 10:57 UTC (permalink / raw)
  To: 59923

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)





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#59923: Error when installing non-existent package add trailing dash character to package name
  2022-12-09 10:57 bug#59923: Error when installing non-existent package add trailing dash character to package name Stefan Kangas
@ 2022-12-11 10:29 ` Eli Zaretskii
  2022-12-11 14:28   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2022-12-11 10:29 UTC (permalink / raw)
  To: Stefan Kangas, Stefan Monnier; +Cc: 59923

> From: Stefan Kangas <stefankangas@gmail.com>
> 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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#59923: Error when installing non-existent package add trailing dash character to package name
  2022-12-11 10:29 ` Eli Zaretskii
@ 2022-12-11 14:28   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-11 18:03     ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-11 14:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Kangas, 59923

>> 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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#59923: Error when installing non-existent package add trailing dash character to package name
  2022-12-11 14:28   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-11 18:03     ` Stefan Kangas
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Kangas @ 2022-12-11 18:03 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: 59923-done

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).





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-11 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 10:57 bug#59923: Error when installing non-existent package add trailing dash character to package name Stefan Kangas
2022-12-11 10:29 ` Eli Zaretskii
2022-12-11 14:28   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-11 18:03     ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).