summaryrefslogtreecommitdiff
path: root/lisp/tar-mode.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2008-05-26 06:57:40 +0000
committerMiles Bader <miles@gnu.org>2008-05-26 06:57:40 +0000
commit142e26a72e9b8bbbec23c6bf7234e9f2544b5f89 (patch)
treef419218fed5cc005b94187631f792e0ca27dd2d3 /lisp/tar-mode.el
parentf394fa259f0065c91a6312f291857907c787da23 (diff)
parent16cf244edb9f5b9dfb8d575921caee6f5365f38e (diff)
downloademacs-142e26a72e9b8bbbec23c6bf7234e9f2544b5f89.tar.gz
emacs-142e26a72e9b8bbbec23c6bf7234e9f2544b5f89.tar.bz2
emacs-142e26a72e9b8bbbec23c6bf7234e9f2544b5f89.zip
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1179
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r--lisp/tar-mode.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 1b3a4505cce..881c1263eeb 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -428,6 +428,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.
@@ -437,7 +447,7 @@ is visible (and the real data of the buffer is hidden)."
(error "%s has size %s - corrupted"
(tar-header-name tokens) size))
;;
- ;; This is just too slow. Don't really need it anyway....
+ ;; This is just too slow. Don't really ened it anyway....
;;(tar-header-block-check-checksum
;; hblock (tar-header-block-checksum hblock)
;; (tar-header-name tokens))
@@ -446,10 +456,8 @@ is visible (and the real data of the buffer is hidden)."
(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,