summaryrefslogtreecommitdiff
path: root/lisp/tar-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-10-17 04:36:11 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-10-17 04:36:11 +0000
commit4062011e2f2b45c85cdafd27a30179d7e9f19778 (patch)
treee1c1ab06743eb7b0b942f68f095055705bdbb257 /lisp/tar-mode.el
parent67d3ffe4989e99079a69e1f7358b758c14cb519a (diff)
(tar-data-swapped-p): Make the assertion a bit more
permissive for when the buffer is empty. (tar-header-block-tokenize): Decode the username and groupname. (tar-chown-entry, tar-chgrp-entry): Encode the names (bug#4730).
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r--lisp/tar-mode.el22
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 762ecc07284..0e681f56702 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -171,8 +171,9 @@ This information is useful, but it takes screen space away from file names."
;; state correctly: the raw data is expected to be always larger than
;; the summary.
(progn
- (assert (eq tar-data-swapped
- (> (buffer-size tar-data-buffer) (buffer-size))))
+ (assert (or (= (buffer-size tar-data-buffer) (buffer-size))
+ (eq tar-data-swapped
+ (> (buffer-size tar-data-buffer) (buffer-size)))))
tar-data-swapped)))
(defun tar-swap-data ()
@@ -312,8 +313,12 @@ write-date, checksum, link-type, and link-name."
link-p
linkname
uname-valid-p
- (and uname-valid-p (substring string tar-uname-offset uname-end))
- (and uname-valid-p (substring string tar-gname-offset gname-end))
+ (when uname-valid-p
+ (decode-coding-string
+ (substring string tar-uname-offset uname-end) coding))
+ (when uname-valid-p
+ (decode-coding-string
+ (substring string tar-gname-offset gname-end) coding))
(tar-parse-octal-integer string tar-dmaj-offset tar-dmin-offset)
(tar-parse-octal-integer string tar-dmin-offset tar-prefix-offset)
))))))
@@ -1013,7 +1018,10 @@ for this to be permanent."
(read-string "New UID string: " (tar-header-uname descriptor))))))
(cond ((stringp new-uid)
(setf (tar-header-uname (tar-current-descriptor)) new-uid)
- (tar-alter-one-field tar-uname-offset (concat new-uid "\000")))
+ (tar-alter-one-field tar-uname-offset
+ (concat (encode-coding-string
+ new-uid tar-file-name-coding-system)
+ "\000")))
(t
(setf (tar-header-uid (tar-current-descriptor)) new-uid)
(tar-alter-one-field tar-uid-offset
@@ -1039,7 +1047,9 @@ for this to be permanent."
(cond ((stringp new-gid)
(setf (tar-header-gname (tar-current-descriptor)) new-gid)
(tar-alter-one-field tar-gname-offset
- (concat new-gid "\000")))
+ (concat (encode-coding-string
+ new-gid tar-file-name-coding-system)
+ "\000")))
(t
(setf (tar-header-gid (tar-current-descriptor)) new-gid)
(tar-alter-one-field tar-gid-offset