* bug#8870: Package installer corrupts image & zip files
[not found] <81vcw73e1k.fsf@gmail.com>
@ 2011-06-15 14:32 ` Jambunathan K
2011-06-15 18:01 ` bug#8870: Additional Info Jambunathan K
2011-06-18 21:56 ` bug#8870: Package installer corrupts image & zip files Chong Yidong
0 siblings, 2 replies; 7+ messages in thread
From: Jambunathan K @ 2011-06-15 14:32 UTC (permalink / raw)
To: 8870
[ Use M-x report-emacs-bug rather than a [BUG] tag in the subject line. ]
Would it be possible to address the following bug before my
OpenDocumentText exporter lands in elpa? I will also file a formal bug
report in few hours.
Summary:
I distribute an image file (png) and a OpenOffice extension (oxt) file
as part of the bundle. These files are getting mangled by the package
installer.
Steps for reproduction:
1. Update package-archives to point to my archive
--8<---------------cut here---------------start------------->8---
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("org-odt" . "http://repo.or.cz/w/org-mode/org-jambu.git/blob_plain/HEAD:/packages/")))
--8<---------------cut here---------------end--------------->8---
2. Install the org-odt package.
3. Visit the following files:
~/.emacs.d/elpa/org-odt-20110613/contrib/odt/files/org-mode-unicorn.png
~/.emacs.d/elpa/org-odt-20110613/contrib/odt/BasicODConverter-0.8.0.oxt
Note that the above two files are corrupt. (oxt file is a zip archive)
4. Visit these files in the downloaded tar. Note that they are sane.
Jambunathan K.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8870: Additional Info
2011-06-15 14:32 ` bug#8870: Package installer corrupts image & zip files Jambunathan K
@ 2011-06-15 18:01 ` Jambunathan K
2011-06-18 21:56 ` bug#8870: Package installer corrupts image & zip files Chong Yidong
1 sibling, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2011-06-15 18:01 UTC (permalink / raw)
To: 8870
Many Thanks to whoever filed this bug report on behalf of me.
,---- Emacs Version
| GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2011-06-13 on 3249CTO
`----
,---- tar Version
| tar (GNU tar) 1.23
| Packaged by Cygwin (1.23-1)
| Copyright (C) 2010 Free Software Foundation, Inc.
| License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law.
|
| Written by John Gilmore and Jay Fenlason.
`----
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8870: Package installer corrupts image & zip files
2011-06-15 14:32 ` bug#8870: Package installer corrupts image & zip files Jambunathan K
2011-06-15 18:01 ` bug#8870: Additional Info Jambunathan K
@ 2011-06-18 21:56 ` Chong Yidong
2011-06-19 4:47 ` Jambunathan K
1 sibling, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2011-06-18 21:56 UTC (permalink / raw)
To: Jambunathan K; +Cc: 8870
Jambunathan K <kjambunathan@gmail.com> writes:
> I distribute an image file (png) and a OpenOffice extension (oxt) file
> as part of the bundle. These files are getting mangled by the package
> installer.
I can't reproduce this, either with the org-odt package at your URL, nor
with a simple multi-file package containing a gif and a png file.
It's possible this is some kind of Windows problem related to tar mode.
Can you trying visiting the tar file in Emacs, and see if the image is
untarred correctly?
C-x C-f org-odt-XXXX.tar
C-s .png RET
RET
Is the image displayed correctly here?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8870: Package installer corrupts image & zip files
2011-06-18 21:56 ` bug#8870: Package installer corrupts image & zip files Chong Yidong
@ 2011-06-19 4:47 ` Jambunathan K
2011-06-26 21:01 ` Chong Yidong
0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2011-06-19 4:47 UTC (permalink / raw)
To: Chong Yidong; +Cc: 8870
Chong Yidong <cyd@stupidchicken.com> writes:
> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> I distribute an image file (png) and a OpenOffice extension (oxt) file
>> as part of the bundle. These files are getting mangled by the package
>> installer.
>
> I can't reproduce this, either with the org-odt package at your URL, nor
> with a simple multi-file package containing a gif and a png file.
>
> It's possible this is some kind of Windows problem related to tar mode.
> Can you trying visiting the tar file in Emacs, and see if the image is
> untarred correctly?
>
> C-x C-f org-odt-XXXX.tar
> C-s .png RET
> RET
>
> Is the image displayed correctly here?
The above sequence (which uses tar-extract) DTRT.
1 Hint for the final fix
-------------------------
tar-untar-buffer needs to use the right coding system for
extraction.
For example, the following "stupid change" in `tar-untar-buffer' fixes
the original bug.
(let ((coding-system-for-write 'no-conversion))
(write-region start end name))
2 Observation
--------------
1. Visiting the png file embedded within the original tar file is OK
2. Visiting the png file in the
~/.emacs.d/elpa/org-odt-YYYYMMDD/contrib/odt/files/org-mode-unicorn.png
is NOT OK.
3 Analysis
-----------
3.1 Behaviour of tar-untar-buffer
==================================
1. `package-install-file' uses `tar-untar-buffer' for extraction.
2. `tar-untar-buffer' invokes `write-region' and an immediate query
for `last-coding-system-used' reports "raw-text-dos" for the png
file.
3.2 Behaviour of tar-extract
=============================
1. `tar-extract' uses `decode-coding-region' with coding set to
`no-conversion' for the png file. The coding is decided by a prior
call to `set-auto-coding'.
I would assume that a value of `no-conversion' is picked from the
following entry in `auto-coding-alist'.
("\\.\\(jpe?g\\|png\\|gif\\|tiff?\\|p[bpgn]m\\)\\'" . no-conversion)
Jambunathan K.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8870: Package installer corrupts image & zip files
2011-06-19 4:47 ` Jambunathan K
@ 2011-06-26 21:01 ` Chong Yidong
2011-06-27 19:03 ` Jambunathan K
0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2011-06-26 21:01 UTC (permalink / raw)
To: Jambunathan K; +Cc: 8870
Jambunathan K <kjambunathan@gmail.com> writes:
> tar-untar-buffer needs to use the right coding system for
> extraction.
Could you verify that a standalone `M-x tar-untar-buffer' (called
outside of package.el) also exhibits the bug?
If so, I think setting coding-system-for-write to no-conversion is
probably the correct fix, indeed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8870: Package installer corrupts image & zip files
2011-06-26 21:01 ` Chong Yidong
@ 2011-06-27 19:03 ` Jambunathan K
2011-06-27 21:12 ` Chong Yidong
0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2011-06-27 19:03 UTC (permalink / raw)
To: Chong Yidong; +Cc: 8870
Chong Yidong <cyd@stupidchicken.com> writes:
> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> tar-untar-buffer needs to use the right coding system for
>> extraction.
>
> Could you verify that a standalone `M-x tar-untar-buffer' (called
> outside of package.el) also exhibits the bug?
Yes, the standalone `M-x tar-untar-buffer' ALSO corrupts the zip and png
files.
> If so, I think setting coding-system-for-write to no-conversion is
> probably the correct fix, indeed.
Could you please apply this fix then?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#8870: Package installer corrupts image & zip files
2011-06-27 19:03 ` Jambunathan K
@ 2011-06-27 21:12 ` Chong Yidong
0 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2011-06-27 21:12 UTC (permalink / raw)
To: Jambunathan K; +Cc: 8870
Jambunathan K <kjambunathan@gmail.com> writes:
> Chong Yidong <cyd@stupidchicken.com> writes:
>
>> Jambunathan K <kjambunathan@gmail.com> writes:
>>
>>> tar-untar-buffer needs to use the right coding system for
>>> extraction.
>>
>> Could you verify that a standalone `M-x tar-untar-buffer' (called
>> outside of package.el) also exhibits the bug?
>
> Yes, the standalone `M-x tar-untar-buffer' ALSO corrupts the zip and png
> files.
Thanks for checking. I've committed the change.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-06-27 21:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <81vcw73e1k.fsf@gmail.com>
2011-06-15 14:32 ` bug#8870: Package installer corrupts image & zip files Jambunathan K
2011-06-15 18:01 ` bug#8870: Additional Info Jambunathan K
2011-06-18 21:56 ` bug#8870: Package installer corrupts image & zip files Chong Yidong
2011-06-19 4:47 ` Jambunathan K
2011-06-26 21:01 ` Chong Yidong
2011-06-27 19:03 ` Jambunathan K
2011-06-27 21:12 ` Chong Yidong
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).