GNU bug report logs - #78636
30.1; package-install-file errors with some tar files

Previous Next

Package: emacs;

Reported by: Andy Rosen <ajr <at> corp.mlfs.org>

Date: Thu, 29 May 2025 20:02:02 UTC

Severity: normal

Found in version 30.1

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andy Rosen <ajr <at> corp.mlfs.org>, Philip Kaludercic <philipk <at> posteo.net>
Cc: 78636 <at> debbugs.gnu.org
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 <at> 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?




This bug report was last modified 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.