From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pierre Lorenzon Newsgroups: gmane.emacs.bugs Subject: bug#11585: 24.0.50; corrupted byte compiled files Date: Wed, 30 May 2012 17:28:47 +0200 (CEST) Message-ID: <20120530.172847.356956325.devel@pollock-nageoire.net> References: <20120530.085706.183065156.devel@pollock-nageoire.net> <87sjeh7mna.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1338392818 13596 80.91.229.3 (30 May 2012 15:46:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 May 2012 15:46:58 +0000 (UTC) To: 11585@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 30 17:46:57 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SZl6o-00032p-8b for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 May 2012 17:46:50 +0200 Original-Received: from localhost ([::1]:55082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZl6n-0007GR-OJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 May 2012 11:46:49 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZl6h-00078m-4X for bug-gnu-emacs@gnu.org; Wed, 30 May 2012 11:46:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZl6Z-0003gC-Np for bug-gnu-emacs@gnu.org; Wed, 30 May 2012 11:46:42 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZl6Z-0003fx-Kb for bug-gnu-emacs@gnu.org; Wed, 30 May 2012 11:46:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SZl80-00043L-7I for bug-gnu-emacs@gnu.org; Wed, 30 May 2012 11:48:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pierre Lorenzon Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 May 2012 15:48:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11585 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11585-submit@debbugs.gnu.org id=B11585.133839288215569 (code B ref 11585); Wed, 30 May 2012 15:48:04 +0000 Original-Received: (at 11585) by debbugs.gnu.org; 30 May 2012 15:48:02 +0000 Original-Received: from localhost ([127.0.0.1]:50451 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZl7x-000430-1s for submit@debbugs.gnu.org; Wed, 30 May 2012 11:48:01 -0400 Original-Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:35857 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZl7s-00042l-Rm for 11585@debbugs.gnu.org; Wed, 30 May 2012 11:47:58 -0400 Original-Received: from localhost ([86.195.134.210]) by mwinf5d14 with ME id GFmL1j00A4YY4DA03FmLr1; Wed, 30 May 2012 17:46:21 +0200 In-Reply-To: <87sjeh7mna.fsf@gnu.org> X-Mailer: Mew version 6.2.51 on Emacs 24.0.50 / Mule 6.0 (HANACHIRUSATO) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:60528 Archived-At: From: Chong Yidong Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files Date: Wed, 30 May 2012 22:45:45 +0800 > Pierre Lorenzon writes: > >> It seems that a part of the .elc file is missing as if a part of the >> character strream was discarded. > > This is certainly one of the most interesting bugs I've come across in > quite some time. Congrats on finding it. Well there should be two circumstances simultaneously : 1. a long file name, 2. a compiled code containing utf-8 characters. 2 is probalby avoided by english speakers as well as other language speakers who simply write code. But when this code is automatically generated by auctex by a french speaker whose LaTeX code contains non ascii characters it may occur. Anyway that's probably why we discovered this bug so late. > > The problem is that `byte-compile-fix-header' tries to insert a message > within a fixed amount of space (in order to preserve file positions of > the actual bytecode), so long file names embedded in the message will > cause it to fail. Your proposed fix would not preserve file positions, > but here is another way to fix it. But why this need of fixing file position ? It seems to me that header fix is the last operation in compising the byte compiled code. After that file is saved and buffer is simply discarded so position is lost. > > Stefan, I think this problem is serious enough, and the solution > straightforward enough, that we ought to include it in emacs-24 even > though it is not a regression. WDYT? > > > === modified file 'lisp/emacs-lisp/bytecomp.el' > *** lisp/emacs-lisp/bytecomp.el 2012-03-26 19:10:00 +0000 > --- lisp/emacs-lisp/bytecomp.el 2012-05-30 14:40:25 +0000 > *************** > *** 1956,1966 **** > ;; don't try to check the version number. > " (< (aref emacs-version (1- (length emacs-version))) ?A)\n" > (format " (string-lessp emacs-version \"%s\")\n" minimum-version) > ! " (error \"`" > ! ;; prin1-to-string is used to quote backslashes. > ! (substring (prin1-to-string (file-name-nondirectory filename)) > ! 1 -1) > ! (format "' was compiled for Emacs %s or later\"))\n\n" > minimum-version)) > ;; Now compensate for any change in size, to make sure all > ;; positions in the file remain valid. > --- 1956,1965 ---- > ;; don't try to check the version number. > " (< (aref emacs-version (1- (length emacs-version))) ?A)\n" > (format " (string-lessp emacs-version \"%s\")\n" minimum-version) > ! ;; Because the header must fit in a fixed width, we cannot But why ? My solution without a fix header size produces perfectly loadable .elc files. What is the good reason to have this constrain of fix header size ? Regards Pierre > ! ;; insert arbitrary-length file names: > ! (format > ! " (error \"Unable to load library compiled for Emacs %s or later\"))\n\n" > minimum-version)) > ;; Now compensate for any change in size, to make sure all > ;; positions in the file remain valid. >