From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 59923@debbugs.gnu.org
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 [thread overview]
Message-ID: <837cyyutcg.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkm==FisyCxxjK21y0kmUMcbP1x_3jE1Wz1gb0Pg5c+WEUA@mail.gmail.com> (message from Stefan Kangas on Fri, 9 Dec 2022 02:57:15 -0800)
> 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.
next prev parent reply other threads:[~2022-12-11 10:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=837cyyutcg.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=59923@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.