GNU bug report logs -
#34251
27.0.50; Use pretty ugly hack for tar-extract
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 29 Jan 2019 21:17:02 UTC
Severity: normal
Tags: patch
Found in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34251 in the body.
You can then email your comments to 34251 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#34251
; Package
emacs
.
(Tue, 29 Jan 2019 21:17:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 29 Jan 2019 21:17:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
0. cd /tmp
1. echo "test" | gzip > test.gz
2. zip test.zip test.gz
3. C-x C-f test.zip RET
4. RET ('archive-extract' to visit the first file)
-- file content is nicely displayed ungzipped from zip archive.
1. echo "test" | gzip > test.gz
2. tar zcvf test.tar.gz test.gz
3. C-x C-f test.tar.gz RET
4. RET ('tar-extract' to visit the first file)
-- garbage is displayed instead of ungzipped file content.
The reason why gzipped files can be visited from arc-mode archives is because
of this line in arc-mode.el in 'archive-extract' with this comment:
(defun archive-extract (&optional other-window-p event)
...
(archive-try-jka-compr) ;Pretty ugly hack :-(
...
To support gzipped files in tar archives as well, this patch
copies the same pretty ugly hack from arc-mode.el to tar-mode.el:
[tar-extract-try-jka-compr.patch (text/x-diff, inline)]
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 5b83d173b4..6f537df8e8 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -852,6 +852,26 @@ tar-mouse-extract
(goto-char (posn-point (event-end event)))
(tar-extract))
+(defun tar--try-jka-compr ()
+ (when (and auto-compression-mode
+ (jka-compr-get-compression-info buffer-file-name))
+ (let* ((basename (file-name-nondirectory buffer-file-name))
+ (tmpname (if (string-match ":\\([^:]+\\)\\'" basename)
+ (match-string 1 basename) basename))
+ (tmpfile (make-temp-file (file-name-sans-extension tmpname)
+ nil
+ (file-name-extension tmpname 'period))))
+ (unwind-protect
+ (progn
+ (let ((coding-system-for-write 'no-conversion)
+ ;; Don't re-compress this data just before decompressing it.
+ (jka-compr-inhibit t))
+ (write-region (point-min) (point-max) tmpfile nil 'quiet))
+ (erase-buffer)
+ (let ((coding-system-for-read 'no-conversion))
+ (insert-file-contents tmpfile)))
+ (delete-file tmpfile)))))
+
(defun tar-file-name-handler (op &rest args)
"Helper function for `tar-extract'."
(or (eq op 'file-exists-p)
@@ -931,6 +951,7 @@ tar-extract
(setq buffer-file-name new-buffer-file-name)
(setq buffer-file-truename
(abbreviate-file-name buffer-file-name))
+ (tar--try-jka-compr) ;Pretty ugly hack :-(
;; Force buffer-file-coding-system to what
;; decode-coding-region actually used.
(set-buffer-file-coding-system last-coding-system-used t)
Reply sent
to
Juri Linkov <juri <at> linkov.net>
:
You have taken responsibility.
(Sun, 03 Feb 2019 21:02:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Juri Linkov <juri <at> linkov.net>
:
bug acknowledged by developer.
(Sun, 03 Feb 2019 21:02:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 34251-done <at> debbugs.gnu.org (full text, mbox):
> To support gzipped files in tar archives as well, this patch
> copies the same pretty ugly hack from arc-mode.el to tar-mode.el:
Since etc/TODO has the following entry:
** Give Tar mode all the features of Archive mode.
I committed the fix to master.
Also enabled Unicode support in archive/tar gz files,
and added tests.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 04 Mar 2019 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 110 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.