From: "Iñigo Serna" <inigoserna@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: 22333@debbugs.gnu.org
Subject: bug#22333: 24.5; EWW downloads invalid compressed tar-files
Date: Sat, 09 Jan 2016 12:26:35 +0100 [thread overview]
Message-ID: <87io3356z8.fsf@inigo.katxi.org> (raw)
In-Reply-To: <m2y4bz136o.fsf@linux-m68k.org>
Hi and thanks for your time,
Andreas Schwab writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>> Could it be that the saved tar file is already uncompressed?
>
> I'd rather guess it's compressed twice.
I think I've discovered the problem with the downloaded files:
0. As downloaded (remember it's saved from an emacs buffer) is not a
valid .tar.gz file
1. but it is a valid gzipped file
2. the uncompressed file contains some HTTP headers at
the start of the file.
3. After manually removing these lines and changing extension (to add
the '.gz' again), file is correctly recognized as a gzipped tar-file.
[0] /home/inigo/Downloads ⚡ tar xvfz filename.tar.gz
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
[1] /home/inigo/Downloads ⚡ gzip -d filename.tar.gz
/home/inigo/Downloads ⚡ file filename.tar
filename.tar: data
[2] /home/inigo/Downloads ⚡ head -21 filename.tar
HTTP/1.1 200 OK
x-amz-replication-status: COMPLETED
Last-Modified: Sun, 08 Nov 2015 13:11:05 GMT
ETag: "9c13c5fafcb1aecd43f51fa9b0278000"
Content-Type: application/octet-stream
Server: AmazonS3
Via: 1.1 varnish
Fastly-Debug-Digest: 37a3779f444d206796099a174bb873c853bb8f1b9a13cf06f29108f907a9d50b
Cache-Control: max-age=31557600, public
Content-Length: 87341
Accept-Ranges: bytes
Date: Sat, 09 Jan 2016 10:16:29 GMT
Via: 1.1 varnish
Age: 135058
Connection: keep-alive
X-Served-By: cache-sea1920-SEA, cache-fra1247-FRA
X-Cache: HIT, HIT
X-Cache-Hits: 2, 1
X-Timer: S1452334589.874408,VS0,VE1
*I?V.�dist/lfm-3.0.tar��[w۸�0���.�d���H�$;�>:����N�+��c;}9n/
[3] [...remove HTTP headers from first lines of file...]
/home/inigo/Downloads ⚡ file filename.tar
filename.tar: gzip compressed data, was "dist/lfm-3.0.tar", last modified: Sun Nov 8 14:07:54 2015, max compression
/home/inigo/Downloads ⚡ mv filename.tar filename.tar.gz
/home/inigo/Downloads ⚡ file filename.tar.gz
filename.tar.gz: gzip compressed data, was "dist/lfm-3.0.tar", last modified: Sun Nov 8 14:07:54 2015, max compression
/home/inigo/Downloads ⚡ tar xvfz filename.tar.gz
lfm-3.0/
[...]
So I think the error comes with those extra spurious headers added to
the start of the buffer when downloading the file, which mess buffer
saving operation.
The bug can be easily reproduced with code like:
(let ((url "https://pypi.python.org/packages/source/l/lfm/lfm-3.0.1.tar.gz"))
(url-retrieve url 'test-cb (list url)))
(defun test-cb (status url)
(message "Downloaded: %s" url)
;; (sleep-for 60)
(write-file "~/a.tgz")
(message "Saved: %s" url))
`eww-download-callback` (called by `url-retrieve`) should remove those headers
after download is finished and before buffer is saved to disk.
A simple fix could be to add (excuse my poor elisp skills):
(goto-char (point-min))
(search-forward-regexp "^$")
(forward-line)
(delete-region (point-min) (point))
before '(write-file file)' in `eww-download-callback`.
... and this almost works, but the downloaded file is compressed twice
now as Andreas stated (ie, tar.gz is gzipped again at file saving).
Thus it looks there is an additional issue when saving gzipped tar-files
from a buffer.
Any idea on how to solve this?
Thanks,
Iñigo Serna
next prev parent reply other threads:[~2016-01-09 11:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 21:23 bug#22333: 24.5; EWW downloads invalid compressed tar-files Iñigo Serna
2016-01-09 6:50 ` Eli Zaretskii
2016-01-09 10:02 ` Andreas Schwab
2016-01-09 11:26 ` Iñigo Serna [this message]
2016-02-04 4:59 ` Lars Ingebrigtsen
2016-02-04 5:06 ` Lars Ingebrigtsen
2016-02-06 17:28 ` Iñigo Serna
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87io3356z8.fsf@inigo.katxi.org \
--to=inigoserna@gmail.com \
--cc=22333@debbugs.gnu.org \
--cc=schwab@linux-m68k.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.