From: Katsumi Yamaoka <yamaoka@jpl.org>
To: 33133@debbugs.gnu.org
Cc: Kevin Ryde <user42_kevin@yahoo.com.au>
Subject: bug#33133: 26.1.50; zlib-decompress-region too rigid
Date: Wed, 24 Oct 2018 08:07:50 +0900 [thread overview]
Message-ID: <b4my3aow9bt.fsf@jpl.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1663 bytes --]
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
[-- Attachment #2: corrupted-data.gz --]
[-- Type: application/octet-stream, Size: 1667 bytes --]
next reply other threads:[~2018-10-23 23:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 23:07 Katsumi Yamaoka [this message]
2018-10-24 0:26 ` bug#33133: 26.1.50; zlib-decompress-region too rigid Noam Postavsky
2018-10-24 1:16 ` Katsumi Yamaoka
2018-10-27 21:48 ` Noam Postavsky
2018-10-28 15:41 ` Eli Zaretskii
2018-10-31 0:25 ` Noam Postavsky
2018-10-31 16:07 ` Eli Zaretskii
2019-04-03 2:09 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4my3aow9bt.fsf@jpl.org \
--to=yamaoka@jpl.org \
--cc=33133@debbugs.gnu.org \
--cc=user42_kevin@yahoo.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).