GNU bug report logs -
#33133
26.1.50; zlib-decompress-region too rigid
Previous Next
Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>
Date: Tue, 23 Oct 2018 23:10:02 UTC
Severity: normal
Tags: fixed, patch
Found in version 26.1.50
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi,
Whereas `gzip -d' does, zlib-decompress-region doesn't decompress
corrupted data of a certain kind. For instance, visiting
https://www.gutenberg.org/no-such-page-exists
using eww shows raw gzipped data. The data extracted is attached.
As for `gzip -d', it says "unexpected end of file" in stderr.
Here is a recipe to reproduce zlib-decompress-region not working:
(let ((buffer (get-buffer-create "*testing*"))
(coding-system-for-read 'binary)
(cw (selected-window))
jka-compr-compression-info-list format-alist)
(switch-to-buffer-other-window buffer)
(erase-buffer)
(set-buffer-multibyte nil)
(insert-file-contents "/TEMP/corrupted-data.gz")
(sit-for 1)
(prog1
(zlib-decompress-region (point-min) (point-max))
(select-window cw)))
If there is no prospect to improve zlib-decompress-region, how
about this workaround?
--- url-http.el~ 2018-09-12 07:48:16.110765500 +0000
+++ url-http.el 2018-10-23 23:04:48.060829900 +0000
@@ -951,7 +951,12 @@
(widen)
(goto-char (point-min))
(when (search-forward "\n\n")
- (zlib-decompress-region (point) (point-max)))))))
+ (or (zlib-decompress-region (point) (point-max))
+ (let ((coding-system-for-write 'binary)
+ (coding-system-for-read 'binary)
+ (default-process-coding-system (cons 'binary 'binary)))
+ (zerop (call-process-region (point) (point-max) "gzip"
+ t '(t nil) nil "-d")))))))))
;; Miscellaneous
(defun url-http-activate-callback ()
In GNU Emacs 26.1.50 (build 1, x86_64-unknown-cygwin, GTK+ Version 3.22.28)
of 2018-10-22 built on localhost
Windowing system distributor 'The Cygwin/X Project', version 11.0.12001000
[corrupted-data.gz (application/octet-stream, attachment)]
This bug report was last modified 6 years and 51 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.