[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19481: package.el: support .tar archives featuring a pax_global_head
From: |
Ivan Shmakov |
Subject: |
bug#19481: package.el: support .tar archives featuring a pax_global_header entry |
Date: |
Thu, 01 Jan 2015 17:55:46 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Package: emacs
Severity: minor
As currently implemented, package.el signals an error trying to
process a .tar archive which has a pax_global_header entry, –
such as the archives produced with $ git archive --format=tar.
Please thus consider the patch MIMEd.
* lisp/emacs-lisp/package.el (package-untar-buffer): Ignore
archive entries with link type being 55.
(package-tar-file-info): Consider the second file name in the
archive if the first one has no directory component.
* lisp/tar-mode.el (tar-untar-buffer): Ignore archive entries
with link type being 55 (pax global extended header.)
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -739,6 +739,8 @@ defun package-untar-buffer (dir)
(dolist (tar-data tar-parse-info)
(let ((name (expand-file-name (tar-header-name tar-data))))
(or (string-match regexp name)
+ ;; Ignore the pax_global_header entry.
+ (eq 55 (tar-header-link-type tar-data))
;; Tarballs created by some utilities don't list
;; directories with a trailing slash (Bug#13136).
(and (string-equal dir name)
@@ -1245,8 +1247,10 @@ defun package-tar-file-info ()
"Find package information for a tar file.
The return result is a `package-desc'."
(cl-assert (derived-mode-p 'tar-mode))
- (let* ((dir-name (file-name-directory
- (tar-header-name (car tar-parse-info))))
+ (let* ((dir-name
+ ;; Take care of pax_global_header, if any.
+ (or (file-name-directory (tar-header-name (car tar-parse-info)))
+ (file-name-directory (tar-header-name (cadr tar-parse-info)))))
(desc-file (package--description-file dir-name))
(tar-desc (tar-get-file-descriptor (concat dir-name desc-file))))
(unless tar-desc
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -479,10 +550,12 @@ defun tar-untar-buffer ()
(message "Extracting %s" name)
(if (and dir (not (file-exists-p dir)))
(make-directory dir t))
- (unless (file-directory-p name)
- (let ((coding-system-for-write 'no-conversion))
- (write-region start end name)))
- (set-file-modes name (tar-header-mode descriptor))))))))
+ ;; Ignore the pax_global_header entry.
+ (unless (eq 55 (tar-header-link-type descriptor))
+ (unless (or (file-directory-p name))
+ (let ((coding-system-for-write 'no-conversion))
+ (write-region start end name)))
+ (set-file-modes name (tar-header-mode descriptor)))))))))
(defun tar-summarize-buffer ()
"Parse the contents of the tar file in the current buffer."
- bug#19481: package.el: support .tar archives featuring a pax_global_header entry,
Ivan Shmakov <=
bug#19481: package.el: support .tar archives featuring a pax_global_header entry, Dmitry Gutov, 2015/01/01