all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: 8870@debbugs.gnu.org
Subject: bug#8870: Package installer corrupts image & zip files
Date: Sun, 19 Jun 2011 10:17:52 +0530	[thread overview]
Message-ID: <81mxhebf5z.fsf@gmail.com> (raw)
In-Reply-To: <8762o22493.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 18 Jun 2011 17:56:08 -0400")

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.





  reply	other threads:[~2011-06-19  4:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  4:37 [BUG] Package installer corrupts image & zip files Jambunathan K
2011-06-15 14:32 ` bug#8870: " 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 [this message]
2011-06-26 21:01       ` Chong Yidong
2011-06-27 19:03         ` Jambunathan K
2011-06-27 21:12           ` Chong Yidong

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=81mxhebf5z.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=8870@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    /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.