unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19481: package.el: support .tar archives featuring a pax_global_header entry
@ 2015-01-01 17:55 Ivan Shmakov
  2015-01-01 18:27 ` Eli Zaretskii
  2015-01-01 18:38 ` Dmitry Gutov
  0 siblings, 2 replies; 15+ messages in thread
From: Ivan Shmakov @ 2015-01-01 17:55 UTC (permalink / raw)
  To: 19481

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/diff, Size: 1981 bytes --]

--- 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."

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-08-19 13:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 17:55 bug#19481: package.el: support .tar archives featuring a pax_global_header entry Ivan Shmakov
2015-01-01 18:27 ` Eli Zaretskii
2015-01-01 18:49   ` Ivan Shmakov
2015-01-28 20:54     ` Ivan Shmakov
2015-01-31  8:41       ` Eli Zaretskii
2015-01-31 11:05         ` Ivan Shmakov
2015-01-31 11:22           ` Eli Zaretskii
2015-02-07 20:10             ` bug#19481: new tar-header-extractable-p, to use in tar-untar-buffer Ivan Shmakov
2015-02-07 20:26               ` Eli Zaretskii
2016-02-23 11:30                 ` Lars Ingebrigtsen
2019-06-25 20:53           ` bug#19481: package.el: support .tar archives featuring a pax_global_header entry Lars Ingebrigtsen
2020-01-20 18:35             ` Stefan Monnier
2020-08-13  9:01               ` Lars Ingebrigtsen
2020-08-19 13:42                 ` Lars Ingebrigtsen
2015-01-01 18:38 ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).