From 8de7995ae6388e5ae5418cb6af579281121f14a4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 8 Oct 2022 12:19:40 -0400 Subject: package.el: Understand a few more variations in tarball formats * lisp/emacs-lisp/package.el (package-untar-buffer): Fix thinko. (package-tar-file-info): Handle the case where the first file is in a subdirectory. * test/lisp/emacs-lisp/package-tests.el (package-test-bug58367): New test. * test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar: * test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar: New files. --- test/lisp/emacs-lisp/package-tests.el | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'test/lisp/emacs-lisp/package-tests.el') diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index b903cd781ba..ffe4d7cd5fd 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -275,11 +275,31 @@ Must called from within a `tar-mode' buffer." (let* ((pkg-el "multi-file-0.2.3.tar") (source-file (expand-file-name pkg-el (ert-resource-directory)))) - (package-initialize) (should-not (package-installed-p 'multie-file)) (package-install-file source-file) (should (package-installed-p 'multi-file)) - (package-delete (cadr (assq 'multi-file package-alist)))) + (package-delete (cadr (assq 'multi-file package-alist)))))) + +(ert-deftest package-test-bug58367 () + "Check variations in tarball formats." + (with-package-test (:basedir (ert-resource-directory)) + (package-initialize) + + ;; A package whose first entry is the main dir but without trailing /. + (let* ((pkg-el "ustar-withsub-0.1.tar") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (should-not (package-installed-p 'ustar-withsub)) + (package-install-file source-file) + (should (package-installed-p 'ustar-withsub)) + (package-delete (cadr (assq 'ustar-withsub package-alist)))) + + ;; A package whose first entry is a file in a subdir. + (let* ((pkg-el "v7-withsub-0.1.tar") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (should-not (package-installed-p 'v7-withsub)) + (package-install-file source-file) + (should (package-installed-p 'v7-withsub)) + (package-delete (cadr (assq 'v7-withsub package-alist)))) )) (ert-deftest package-test-install-file-EOLs () -- cgit v1.2.3