[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#78636: 30.1; package-install-file errors with some tar files
From: |
Eli Zaretskii |
Subject: |
bug#78636: 30.1; package-install-file errors with some tar files |
Date: |
Sat, 07 Jun 2025 11:52:15 +0300 |
> Date: Thu, 29 May 2025 15:56:31 +0000
> From: Andy Rosen via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> Running 'package-install-file' on a tar file might throw a 'Wrong type
> argument: arrayp, nil' error from
> 'tar--check-descriptor’. The problem comes from assumptions made by
> 'package--description-file' and
> tar-mode about the filenames contained in the tar file. I’ve written a
> detailed description of the error and
> root cause here.
>
> I propose adding a 'condition-case' to 'package-install-file' to return a
> friendly message.
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 82fcf439a11..01f659e6982 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -2439,8 +2439,10 @@ directory."
> (insert-file-contents-literally file)
> (set-visited-file-name file)
> (set-buffer-modified-p nil)
> - (when (string-match "\\.tar\\'" file) (tar-mode)))
> - (package-install-from-buffer)))
> + (when (string-match "\\.tar\\'" file) (tar-mode)
> + (condition-case nil
> + (package-install-from-buffer)
> + (error (message "%s is not a valid package file"
> (file-name-nondirectory file))))))))
>
> ;;;###autoload
> (defun package-install-selected-packages (&optional noconfirm)
>
> In GNU Emacs 30.1 (build 1, aarch64-apple-darwin21.6.0, NS
> appkit-2113.65 Version 12.7.6 (Build 21H1320)) of 2025-02-24 built on
> armbob.lan
> Windowing system distributor 'Apple', version 10.3.2575
> System Description: macOS 15.5
Philip, any comments?
- bug#78636: 30.1; package-install-file errors with some tar files,
Eli Zaretskii <=