[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOL conversion of files in .tar archives

From: Eli Zaretskii
Subject: Re: EOL conversion of files in .tar archives
Date: Wed, 23 May 2007 21:43:07 +0300

> From: Richard Stallman <address@hidden>
> CC: address@hidden, address@hidden, address@hidden
> Date: Tue, 22 May 2007 04:30:45 -0400
>     Apropos: take the tar.gz file in
> <URL:http://www.codemonkey.org.uk/projects/git-snapshots/git/git-2007-05-20.tar.gz>
>     (it will be available only a week or so).
>     Move cursor down to .gitignore and press RET.  Instead you'll get
>     Makefile, the file one line lower.  In general, on every line you'll
>     get the file one line lower.
>     It would appear that this is packed with some version of tar that GNU
>     tar can perfectly well unpack, but with output confusing tar-mode.  My
>     tar version is tar (GNU tar) 1.16.
> Would someone please debug this and fix it in the trunk?
> Please ack when it is done.

Fixed on the trunk with the patch below.  Additional info about the
tarball that causes this can be found here:


Note that the fix I checked in is not a perfect one: the extended pax
header is still shown as a special entry (unlike GNU Tar, which
doesn't show it at all).  But at least the bug reported by David is
gone, and tar-mode now says correctly that this is a special entry,
not a real file, and does not allow to visit it, as it does with
directories and other special entries.

I used the uppercase `H' to flag this special entry in the tarball
summary, but if someone has a better suggestion, I won't object to
changing the letter.

2007-05-23  Eli Zaretskii  <address@hidden>

        * tar-mode.el (tar-header-block-summarize, tar-summarize-buffer)
        (tar-get-descriptor): Handle type 55, an extended pax header.

Index: lisp/tar-mode.el
RCS file: /cvsroot/emacs/emacs/lisp/tar-mode.el,v
retrieving revision 1.109
diff -u -r1.109 tar-mode.el
--- lisp/tar-mode.el    23 May 2007 12:38:35 -0000      1.109
+++ lisp/tar-mode.el    23 May 2007 18:29:24 -0000
@@ -363,6 +363,7 @@
                  ((eq type 29) ?M)     ; multivolume continuation
                  ((eq type 35) ?S)     ; sparse
                  ((eq type 38) ?V)     ; volume header
+                 ((eq type 55) ?H)     ; extended pax header
                  (t ?\s)
            (tar-grind-file-mode mode)
@@ -421,7 +422,7 @@
                                   (buffer-substring pos (+ pos 512)))))))
         (setq pos (+ pos 512))
         (progress-reporter-update progress-reporter pos)
-        (if (eq (tar-header-link-type tokens) 20)
+        (if (memq (tar-header-link-type tokens) '(20 55))
             ;; Foo.  There's an extra empty block after these.
             (setq pos (+ pos 512)))
         (let ((size (tar-header-size tokens)))
@@ -657,13 +658,14 @@
         (size (tar-header-size tokens))
         (link-p (tar-header-link-type tokens)))
     (if link-p
-       (error "This is a %s, not a real file"
-              (cond ((eq link-p 5) "directory")
-                    ((eq link-p 20) "tar directory header")
-                    ((eq link-p 28) "next has longname")
-                    ((eq link-p 29) "multivolume-continuation")
-                    ((eq link-p 35) "sparse entry")
-                    ((eq link-p 38) "volume header")
+       (error "This is a%s, not a real file"
+              (cond ((eq link-p 5) " directory")
+                    ((eq link-p 20) " tar directory header")
+                    ((eq link-p 28) " next has longname")
+                    ((eq link-p 29) " multivolume-continuation")
+                    ((eq link-p 35) " sparse entry")
+                    ((eq link-p 38) " volume header")
+                    ((eq link-p 55) "n extended pax header")
                     (t "link"))))
     (if (zerop size) (error "This is a zero-length file"))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]