all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 19481@debbugs.gnu.org
Subject: bug#19481: package.el: support .tar archives featuring a pax_global_header entry
Date: Thu, 01 Jan 2015 17:55:46 +0000	[thread overview]
Message-ID: <871tne5qsd.fsf@violet.siamics.net> (raw)

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

             reply	other threads:[~2015-01-01 17:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01 17:55 Ivan Shmakov [this message]
2015-01-01 18:27 ` bug#19481: package.el: support .tar archives featuring a pax_global_header entry 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871tne5qsd.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=19481@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.