From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.bugs Subject: bug#8870: Package installer corrupts image & zip files Date: Sun, 19 Jun 2011 10:17:52 +0530 Message-ID: <81mxhebf5z.fsf@gmail.com> References: <81vcw73e1k.fsf@gmail.com> <8762o22493.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1308458906 13206 80.91.229.12 (19 Jun 2011 04:48:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 19 Jun 2011 04:48:26 +0000 (UTC) Cc: 8870@debbugs.gnu.org To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 19 06:48:19 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QY9vn-0005OD-2v for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Jun 2011 06:48:19 +0200 Original-Received: from localhost ([::1]:43396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QY9vm-00009i-5T for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Jun 2011 00:48:18 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QY9vY-00009S-CP for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2011 00:48:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QY9vX-0006Fy-95 for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2011 00:48:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QY9vX-0006Fs-7W for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2011 00:48:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QY9vW-0001u9-Fc; Sun, 19 Jun 2011 00:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Jun 2011 04:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8870-submit@debbugs.gnu.org id=B8870.13084588397271 (code B ref 8870); Sun, 19 Jun 2011 04:48:02 +0000 Original-Received: (at 8870) by debbugs.gnu.org; 19 Jun 2011 04:47:19 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QY9uo-0001tE-42 for submit@debbugs.gnu.org; Sun, 19 Jun 2011 00:47:18 -0400 Original-Received: from mail-pz0-f44.google.com ([209.85.210.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QY9ul-0001t0-7j for 8870@debbugs.gnu.org; Sun, 19 Jun 2011 00:47:15 -0400 Original-Received: by pzk5 with SMTP id 5so2739813pzk.3 for <8870@debbugs.gnu.org>; Sat, 18 Jun 2011 21:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=m+5501bhYe1EzcBQT60C/ZBKVoS3+5eUrh0zk3/JytE=; b=LH3Y42RbnOHouAkSn5Lh0jA7QybJAAkc0gXabr+k8ty8wGDCrII9MlcJsrF+k2Dg6s B2TnBZ+Ut7XZoV3av3UeQ1sf84l+R3opnnZLCaQ/8L4Dl0KXDT3a4rLR/NR1Yb4Ic+PD 2FJVOdB6wPdloL5tChMWuZfm8VFIPZLaR3A84= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; b=KjHdi0S1XWUGJPMgjEANuJdesjGQJ8ORm4NS1+b9v/X+vmjQMmAKKAu6m7Ozt+XYFB 9vAxXtljX7KvtBceYlO70+7iWkZNliIEKifOg06CzovYP/mkqykjpG3eJ0cNzv+MsZlm 1/LUCSaFX3x41eqn2BX+yfpP/8VHMheQuUYX0= Original-Received: by 10.68.12.228 with SMTP id b4mr1156605pbc.273.1308458829222; Sat, 18 Jun 2011 21:47:09 -0700 (PDT) Original-Received: from JAMBU-NETBOOK ([115.242.166.204]) by mx.google.com with ESMTPS id i7sm2424268pbj.10.2011.06.18.21.47.05 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 18 Jun 2011 21:47:07 -0700 (PDT) In-Reply-To: <8762o22493.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 18 Jun 2011 17:56:08 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 19 Jun 2011 00:48:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:47303 Archived-At: Chong Yidong writes: > Jambunathan K 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.