From: Philip Kaludercic Date: Wed, 11 Jan 2023 08:27:01 +0000 (+0100) Subject: Ensure VC package names are not empty X-Git-Tag: emacs-29.0.90~763 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=384504edf35;p=emacs.git Ensure VC package names are not empty * lisp/emacs-lisp/package-vc.el (package-vc--unpack): Raise an error if the package name is empty. (package-vc-install): Avoid generating an empty file name, if a URL ends with a slash, and raise an error if the package name is empty. --- diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index ba1a01faeee..b5b8a6746a6 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -606,6 +606,8 @@ checkout. This overrides the `:branch' attribute in PKG-SPEC." (name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) (pkg-dir (expand-file-name dirname package-user-dir))) + (when (string-empty-p name) + (user-error "Empty package name")) (setf (package-desc-dir pkg-desc) pkg-dir) (when (file-exists-p pkg-dir) (if (yes-or-no-p (format "Overwrite previous checkout for package `%s'?" name)) @@ -773,7 +775,9 @@ regular package, but it will not remove a VC package. (package-vc--archives-initialize) (let* ((name-or-url (package-vc--read-package-name "Fetch and install package: " t)) - (name (file-name-base name-or-url))) + (name (file-name-base (directory-file-name name-or-url)))) + (when (string-empty-p name) + (user-error "Empty package name")) (list name-or-url (and current-prefix-arg :last-release) nil