diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-01-12 03:37:13 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-01-12 03:37:13 +0000 |
commit | 64ac12669e7b908d4865bb9b083c088ca03552ea (patch) | |
tree | 8ae0904e0ea621d17383a8e9fed89d4ec5465bde /lisp/tar-mode.el | |
parent | 5e5e80fb43b19caa1eb003a96c0a7cba00126983 (diff) | |
download | emacs-64ac12669e7b908d4865bb9b083c088ca03552ea.tar.gz |
(tar-header-block-tokenize): Properly ignore the version
subfield of the magic string.
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r-- | lisp/tar-mode.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 7e091d8d038..99a7303944a 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -239,8 +239,13 @@ write-date, checksum, link-type, and link-name." (gname-end (1- tar-dmaj-offset)) (link-p (aref string tar-linkp-offset)) (magic-str (substring string tar-magic-offset - (1- tar-uname-offset))) - (uname-valid-p (car (member magic-str '("ustar " "ustar\0\0")))) + ;; The magic string is actually 6bytes + ;; of magic string plus 2bytes of version + ;; which we here ignore. + (- tar-uname-offset 2))) + ;; The magic string is "ustar\0" for POSIX format, and + ;; "ustar " for GNU Tar's format. + (uname-valid-p (car (member magic-str '("ustar " "ustar\0")))) name linkname (nulsexp "[^\000]*\000")) (when (string-match nulsexp string tar-name-offset) @@ -256,7 +261,7 @@ write-date, checksum, link-type, and link-name." nil (- link-p ?0))) (setq linkname (substring string tar-link-offset link-end)) - (when (and (equal uname-valid-p "ustar\0\0") + (when (and (equal uname-valid-p "ustar\0") (string-match nulsexp string tar-prefix-offset) (> (match-end 0) (1+ tar-prefix-offset))) (setq name (concat (substring string tar-prefix-offset @@ -271,7 +276,7 @@ write-date, checksum, link-type, and link-name." (setq link-p 5)) ; directory (if (and (equal name "././@LongLink") - (equal magic-str "ustar ")) ;OLDGNU_MAGIC. + (equal magic-str "ustar ")) ;OLDGNU_MAGIC. ;; This is a GNU Tar long-file-name header. (let* ((size (tar-parse-octal-integer string tar-size-offset tar-time-offset)) |