]> git.eshelyaron.com Git - emacs.git/commitdiff
(tar-summarize-buffer): Handle GNU Tar @LongLink format.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 25 May 2008 13:48:22 +0000 (13:48 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 25 May 2008 13:48:22 +0000 (13:48 +0000)
lisp/ChangeLog
lisp/tar-mode.el

index ce047a0036ebe4e9a350a7b038c0e8fd1bac980b..28a7eac3616618b5edc645694a2a1a9a757ebd57 100644 (file)
@@ -1,3 +1,7 @@
+2008-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * tar-mode.el (tar-summarize-buffer): Handle GNU Tar @LongLink format.
+
 2008-05-24  Alan Mackenzie  <acm@muc.de>
 
        * progmodes/cc-mode.el (c-postprocess-file-styles): Throw an error
index 41476f4250bfa0d207fd531286f483c02729ed74..04ce5dc83a95eb3be4116c806797a0af6fd4a0fb 100644 (file)
@@ -421,6 +421,16 @@ is visible (and the real data of the buffer is hidden)."
                                  (tar-header-block-tokenize
                                   (buffer-substring pos (+ pos 512)))))))
         (setq pos (+ pos 512))
+        (when (equal (tar-header-name tokens) "././@LongLink")
+          ;; This is a GNU Tar long-file-name header.
+          (let* ((size (tar-header-size tokens))
+                 ;; -1 so as to strip the terminating 0 byte.
+                 (name (buffer-substring pos (+ pos size -1))))
+            (setq pos (+ pos (ash (ash (+ 511 size) -9) 9)))
+            (setq tokens (tar-header-block-tokenize
+                          (buffer-substring pos (+ pos 512))))
+            (tar-setf (tar-header-name tokens) name)
+            (setq pos (+ pos 512))))
         (progress-reporter-update progress-reporter pos)
         (if (memq (tar-header-link-type tokens) '(20 55))
             ;; Foo.  There's an extra empty block after these.
@@ -429,20 +439,18 @@ is visible (and the real data of the buffer is hidden)."
           (if (< size 0)
               (error "%s has size %s - corrupted"
                      (tar-header-name tokens) size))
-                                        ;
-                                        ; This is just too slow.  Don't really need it anyway....
-                                        ;(tar-header-block-check-checksum
-                                        ;  hblock (tar-header-block-checksum hblock)
-                                        ;  (tar-header-name tokens))
+          ;;
+          ;; This is just too slow.  Don't really need it anyway....
+          ;;(tar-header-block-check-checksum
+          ;;  hblock (tar-header-block-checksum hblock)
+          ;;  (tar-header-name tokens))
 
           (push (make-tar-desc pos tokens) result)
 
           (and (null (tar-header-link-type tokens))
                (> size 0)
-               (setq pos
-                     (+ pos 512 (ash (ash (1- size) -9) 9)) ; this works
-                                        ;(+ pos (+ size (- 512 (rem (1- size) 512)))) ; this doesn't
-                     ))))
+               ;; Round up to a multiple of 512.
+               (setq pos (+ pos (ash (ash (+ 511 size) -9) 9))))))
       (make-local-variable 'tar-parse-info)
       (setq tar-parse-info (nreverse result))
       ;; A tar file should end with a block or two of nulls,