GNU bug report logs - #11585
24.0.50; corrupted byte compiled files

Previous Next

Package: emacs;

Reported by: Pierre Lorenzon <devel <at> pollock-nageoire.net>

Date: Wed, 30 May 2012 07:29:02 UTC

Severity: important

Found in version 24.0.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11585 in the body.
You can then email your comments to 11585 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 07:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pierre Lorenzon <devel <at> pollock-nageoire.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 30 May 2012 07:29:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pierre Lorenzon <devel <at> pollock-nageoire.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 08:57:06 +0200 (CEST)
[Message part 1 (text/plain, inline)]
This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':


Hi,

Certain of my .el files are incorrectly compiled. See the .elc
file with a long name.

More details : It seems that a part of the .elc file is missing
as if a part of the character strream was discarded. I cannot
figure out why.

But more suprisingly when renaming the file with a much more
shorter name everything goes well as if there was a limitation
in the file name length. I must point out that there are only
ascii characters composing the file name.

Moreover even with the long name the .el (uncompiled file) is
perfectly correct and load perfectly as well as the .elc
(compiled file) with the short name.

I had this problem with emacs 24.0.50 as well as witth
24.0.95. I should say that I am using these devloppeing
versions since I appreciate ieieio to be integrated in it. I
never had this compilation problem with emacs 23 but probalbly
never tried with so long file names. Moreover emacs 23 is no
longer available on my system to test. But if it could be
useful I can reinstall this stable version.

See examples attached.

Is there a limitation somewhere ? 

Regards 

Pierre

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.0.50/etc/DEBUG.


In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu)
 of 2011-01-13 on jabberwocky
configured using `configure  '--prefix=/usr' '--libexecdir=/usr/lib' '--localstatedir=/var''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Message

Minor modes in effect:
  gpm-mouse-mode: t
  tool-bar-mode: t
  desktop-save-mode: t
  global-ede-mode: t
  global-speechd-speak-mode: t
  speechd-speak-mode: t
  global-speechd-speak-map-mode: t
  speechd-speak-map-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
d i s c o v e r SPC w h e r e SPC i s SPC t h SPC p 
r o b l e m SPC . . . . ESC q RET RET RET TAB T h a 
n k s SPC RET RET TAB P I e r r e ESC [ 1 ~ ESC [ C 
ESC [ C ESC [ C ESC [ 3 ~ i ESC [ 4 ~ C-c C-c y ESC 
[ A . C-x o ESC [ B C-@ ESC [ B ESC [ B ESC [ B ESC 
[ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B 
ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC 
[ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B 
ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC 
[ B ESC [ B ESC [ B ESC [ B ESC [ B ESC w C-x o ESC 
[ A ESC [ A C-x o ESC [ A ESC [ B ESC [ B ESC [ B ESC 
[ B ESC [ B . C-x o ESC [ B ESC [ B ESC [ B ESC [ B 
ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC 
[ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ A ESC [ A 
ESC [ A ESC [ A ESC [ A ESC [ B ESC x r e p o TAB r 
TAB b TAB RET

Recent messages:
+draft/4 has been queued to +queue/3 (from Draft mode)
Connecting to the SMTP server...done
Sending in background...done
Mark set
line-move-visual: End of buffer
Saved text from "Hi,

Certain of my .el files are incorre"
line-move-visual: Beginning of buffer
Making completion list...

Load-path shadows:
/usr/local/share/emacs/site-lisp/customization/site-start hides /usr/share/emacs/site-lisp/site-start
/usr/share/emacs/site-lisp/speechd/speechd hides /usr/share/emacs/site-lisp/speechd.cvs/speechd
/usr/share/emacs/site-lisp/speechd/speechd-ssip hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-ssip
/usr/share/emacs/site-lisp/speechd/speechd-speak hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-speak
/usr/share/emacs/site-lisp/speechd/brltty hides /usr/share/emacs/site-lisp/speechd.cvs/brltty
/usr/share/emacs/site-lisp/speechd/mmanager hides /usr/share/emacs/site-lisp/speechd.cvs/mmanager
/usr/share/emacs/site-lisp/speechd/speechd-common hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-common
/usr/share/emacs/site-lisp/speechd/speechd-version hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-version
/usr/share/emacs/site-lisp/speechd/speechd-out hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-out
/usr/share/emacs/site-lisp/speechd/braille hides /usr/share/emacs/site-lisp/speechd.cvs/braille
/usr/share/emacs/site-lisp/speechd/speechd-bug hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-bug
/usr/share/emacs/site-lisp/speechd/speechd-braille hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-braille
/usr/share/emacs/site-lisp/speechd/speechd-brltty hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-brltty
/usr/share/emacs/site-lisp/speechd/speechd-compile hides /usr/share/emacs/site-lisp/speechd.cvs/speechd-compile

Features:
(shadow emacsbug help-mode view pp mew-varsx vc-cvs vc-rcs
j++-packages-cdrom-projects-category
j++-packages-cdrom-projects-categories
j++-packages-cdrom-projects-references
j++-packages-cdrom-projects-pieces
j++-packages-cdrom-projects-performer
j++-packages-cdrom-components-performer
j++-packages-databases-cds-performer
j++-packages-cdrom-projects-performers
j++-packages-cdrom-projects-discid
j++-packages-cdrom-projects-discids
j++-packages-cdrom-projects-piece
j++-packages-cdrom-projects-type
j++-packages-cdrom-projects-author
j++-packages-cdrom-projects-authors
j++-packages-cdrom-projects-all
j++-packages-cdrom-projects-project j++-sound-project
j++-packages-sound-sound-project
j++-packages-cdrom-components-reference
j++-packages-cdrom-components-discid
j++-packages-cdrom-components-author
j++-packages-cdrom-components-person
j++-packages-databases-cds-author
j++-packages-databases-items-person
j++-packages-cdrom-components-piece
j++-packages-cdrom-components-item j++-packages-cdrom-track
j++-basic-processes-asynchronous j++-basic-flaggable
j++-packages-project-target j++-basic-widgets-open-close-title
j++-basic-widgets-open-close j++-packages-cdrom-cddb-client
j++-basic-processes-network-stream
j++-packages-cdrom-cdda-client j++-basic-processes-queueable
j++-basic-parsers-parser j++-basic-mastered
j++-packages-cdrom-cdrom j++-basic-string-filter
j++-basic-duration j++-basic-interfaces-pointed
j++-basic-interfaces-interface j++-basic-lists-pointed
j++-basic-creator j++-basic-lists-list j++-basic-mapable
j++-basic-sortable j++-basic-state
j++-basic-widgets-synchronized j++-basic-synchronized
j++-basic-widgets-object t-mouse info tool-bar reftex-auc
reftex-vcr reftex-dcr reftex reftex-vars noutline outline
font-latex newcomment Tss-LaTeX-remap latex easy-mmode edmacro
kmacro tex-style tex j++-project j++-packages-project-project
j++-packages-project-file j++-basic-processes-svn
j++-basic-processes-synchronous j++-basic-processes-process
j++-basic-files-file-manager j++-basic-files-file
j++-basic-files-serializable j++-basic-files-stringifiable
ede/dired ede/proj-elisp ede/pconf package desktop
speechd-el-extension Tss-TeX-remap tex-style-system
tex-style-system-eieio Tss-context Tss-common Tss-widget
Tss-util tree pln-auctex tex-site auto-loads pln-ede
latex/edext-target-exercise latex/edext-latex edext-project
edext-vc vc-svn vc vc-dispatcher edext-srecode semantic/edit
semantic/find srecode/srt-mode semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn semantic/db semantic/format
srecode/template srecode/srt-wy semantic/wisent
semantic/wisent/wisent semantic/ctxt srecode/ctxt
semantic/tag-ls srecode/compile srecode/table srecode/map
semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw edext-utils edext ede/proj-misc
ede/pmake ede/proj-obj ede/proj ede/make ede/proj-comp
ede/autoconf-edit autoconf autoconf-mode j++ ede/linux
ede/emacs ede/cpp-root srecode mode-local ede/speedbar
ede/files speechd-el-ede ede ede/source eieio-base
eieio-speedbar speedbar sb-image ezimage dframe assoc
eieio-custom cedet pln-mew mew-w3m speechd-el-w3m w3m
browse-url doc-view jka-compr dired regexp-opt image-mode
timezone w3m-hist w3m-fb w3m-ems wid-edit warnings w3m-ccl ccl
w3m-favicon image w3m-image w3m-proc w3m-util mew-auth
mew-config mew-imap2 mew-imap mew-nntp2 mew-nntp mew-pop
mew-smtp mew-ssl mew-ssh mew-net mew-highlight mew-sort mew-fib
mew-ext mew-refile mew-demo mew-attach mew-draft mew-message
mew-thread mew-virtual mew-summary4 mew-summary3 mew-summary2
mew-summary mew-search mew-pick mew-passwd mew-scan mew-syntax
mew-bq mew-smime mew-pgp mew-header mew-exec mew-mark mew-mime
mew-edit mew-decode mew-encode mew-cache mew-minibuf
mew-complete mew-addrbook mew-local mew-unix mew-vars3
mew-vars2 mew-vars mew-env mew-mule3 mew-mule mew-gemacs
easymenu mew-key mew-func mew-blvs mew-const speechd-el-mew mew
pln-w3m pln-customization speechd-speak advice help-fns
advice-preload speechd-ssip speechd-brltty speechd-braille
braille mmanager brltty cl cl-19 speechd-out eieio byte-opt
bytecomp byte-compile speechd speechd-common ediff-hook
vc-hooks lisp-float-type lisp-mode register page menu-bar
rfn-eshadow timer jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table
epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5
base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process
multi-tty emacs)
[Toto.elc (application/octet-stream, attachment)]
[Toto.el (text/plain, inline)]
(TeX-add-style-hook '(Tss-slave :name "Etude-des-Fonctions-Zeta-des-Courbes-Modulaires-Aux-Places-de-Bonne-Reductions/Reformulation-En-Theorie-des-Groupes" :master-directory "../" :state (new)) 
		    (lambda ()
		      (TeX-style-system-init-master "../Scholze")
		      (LaTeX-add-index-entries
		       "$\\sigma$-conjugués"
		       "$\\sigma$-centralisateur"
		       )
		      (LaTeX-add-labels
		       "SCH.zeta.groupe"
		       "SCH.zeta.groupe.lem.8"
		       "SCH.zeta.groupe.pro.4"
		       "SCH.zeta.groupe.lem.10"
		       "SCH.zeta.groupe.thm.7"
		       "SCH.zeta.groupe.pro.5"
		       )

		      )
		    )
[Reformulation-En-Theorie-des-Groupes.elc (application/octet-stream, attachment)]
[Reformulation-En-Theorie-des-Groupes.el (text/plain, inline)]
(TeX-add-style-hook '(Tss-slave :name "Etude-des-Fonctions-Zeta-des-Courbes-Modulaires-Aux-Places-de-Bonne-Reductions/Reformulation-En-Theorie-des-Groupes" :master-directory "../" :state (new)) 
		    (lambda ()
		      (TeX-style-system-init-master "../Scholze")
		      (LaTeX-add-index-entries
		       "$\\sigma$-conjugués"
		       "$\\sigma$-centralisateur"
		       )
		      (LaTeX-add-labels
		       "SCH.zeta.groupe"
		       "SCH.zeta.groupe.lem.8"
		       "SCH.zeta.groupe.pro.4"
		       "SCH.zeta.groupe.lem.10"
		       "SCH.zeta.groupe.thm.7"
		       "SCH.zeta.groupe.pro.5"
		       )

		      )
		    )

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 08:25:01 GMT) Full text and rfc822 format available.

Message #8 received at 11585 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Lorenzon <devel <at> pollock-nageoire.net>
To: 11585 <at> debbugs.gnu.org
Subject: Re: bug#11585: Acknowledgement (24.0.50; corrupted byte compiled
	files)
Date: Wed, 30 May 2012 10:05:37 +0200 (CEST)
Hi,

Ok I made a few tests by making the file name always more
shorter and miraculously saw more and more discarded characters
appearing in the byte compiled file. In my opinion the
`byte-compile-fix-header' function is responsible of this
undesirable behavior of the byte compile engine. I'll try to
analyse more precisely this function and eventually write a
patch if I discover that it is bugged. Anyway all these
narroing region killing and widening in this function look
mysterious to me and probably to complicated to obtain the
desired result but I have to look at it more precisely.


Regards !


Pierre




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 09:09:02 GMT) Full text and rfc822 format available.

Message #11 received at 11585 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Lorenzon <devel <at> pollock-nageoire.net>
To: 11585 <at> debbugs.gnu.org
Subject: Re: bug#11585: Acknowledgement (24.0.50; corrupted byte compiled
	files)
Date: Wed, 30 May 2012 10:49:17 +0200 (CEST)
[Message part 1 (text/plain, inline)]
OK here is how I suggest to rewrite the
`byte-compile-fix-header' function.

Regards

Pierre

[bytcomp-fix-fix.el (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 14:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 11585 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Pierre Lorenzon <devel <at> pollock-nageoire.net>
Cc: 11585 <at> debbugs.gnu.org
Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 22:45:45 +0800
Pierre Lorenzon <devel <at> pollock-nageoire.net> 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.

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.

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
!        ;; 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 15:27:02 GMT) Full text and rfc822 format available.

Message #17 received at 11585 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Pierre Lorenzon <devel <at> pollock-nageoire.net>
Cc: 11585 <at> debbugs.gnu.org
Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 11:24:49 -0400
> Certain of my .el files are incorrectly compiled. See the .elc
> file with a long name.

Duh, indeed it was byte-compile-fix-header, thanks for investigating.
I think your patch has the problem that it changes the byte-position of
the text in the rest of the buffer, which will break lazy-loaded
docstrings and byte-code.
Can you try the patch below instead, which will simply report the actual
load-file-name rather than file name of the source.


        Stefan


=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- lisp/emacs-lisp/bytecomp.el	2012-05-30 03:59:42 +0000
+++ lisp/emacs-lisp/bytecomp.el	2012-05-30 15:18:29 +0000
@@ -1937,7 +1937,7 @@
 	     (byte-compile-fix-header byte-compile-current-file))))
      byte-compile--outbuffer)))
 
-(defun byte-compile-fix-header (filename)
+(defun byte-compile-fix-header (_filename)
   "If the current buffer has any multibyte characters, insert a version test."
   (when (< (point-max) (position-bytes (point-max)))
     (goto-char (point-min))
@@ -1962,11 +1962,8 @@
        ;; 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"
+       "     (error \"`%s"
+       (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.
@@ -2037,7 +2034,7 @@
         (print-gensym t)
         (print-circle                   ; Handle circular data structures.
          (not byte-compile-disable-print-circle)))
-    (if (and (memq (car-safe form) '(defun defmacro defvar defvaralias defconst
+    (if (and (memq (car-safe form) '(defvar defvaralias defconst
                                       autoload custom-declare-variable))
              (stringp (nth 3 form)))
         (byte-compile-output-docform nil nil '("\n(" 3 ")") form nil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 15:48:04 GMT) Full text and rfc822 format available.

Message #20 received at 11585 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Lorenzon <devel <at> pollock-nageoire.net>
To: 11585 <at> debbugs.gnu.org
Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 17:28:47 +0200 (CEST)
From: Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 22:45:45 +0800

> Pierre Lorenzon <devel <at> pollock-nageoire.net> 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.
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11585; Package emacs. (Wed, 30 May 2012 15:51:02 GMT) Full text and rfc822 format available.

Message #23 received at 11585 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Lorenzon <devel <at> pollock-nageoire.net>
To: 11585 <at> debbugs.gnu.org
Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 17:31:50 +0200 (CEST)
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#11585: 24.0.50; corrupted byte compiled files
Date: Wed, 30 May 2012 11:24:49 -0400

>> Certain of my .el files are incorrectly compiled. See the .elc
>> file with a long name.
> 
> Duh, indeed it was byte-compile-fix-header, thanks for investigating.
> I think your patch has the problem that it changes the byte-position of
> the text in the rest of the buffer, which will break lazy-loaded
> docstrings and byte-code.

  OK ! Anyway when I tried to load this .elc files compiled
  with my patch I encounter problem ....

  Pierre



> Can you try the patch below instead, which will simply report the actual
> load-file-name rather than file name of the source.
> 
> 
>         Stefan
> 
> 
> === modified file 'lisp/emacs-lisp/bytecomp.el'
> --- lisp/emacs-lisp/bytecomp.el	2012-05-30 03:59:42 +0000
> +++ lisp/emacs-lisp/bytecomp.el	2012-05-30 15:18:29 +0000
> @@ -1937,7 +1937,7 @@
>  	     (byte-compile-fix-header byte-compile-current-file))))
>       byte-compile--outbuffer)))
>  
> -(defun byte-compile-fix-header (filename)
> +(defun byte-compile-fix-header (_filename)
>    "If the current buffer has any multibyte characters, insert a version test."
>    (when (< (point-max) (position-bytes (point-max)))
>      (goto-char (point-min))
> @@ -1962,11 +1962,8 @@
>         ;; 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"
> +       "     (error \"`%s"
> +       (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.
> @@ -2037,7 +2034,7 @@
>          (print-gensym t)
>          (print-circle                   ; Handle circular data structures.
>           (not byte-compile-disable-print-circle)))
> -    (if (and (memq (car-safe form) '(defun defmacro defvar defvaralias defconst
> +    (if (and (memq (car-safe form) '(defvar defvaralias defconst
>                                        autoload custom-declare-variable))
>               (stringp (nth 3 form)))
>          (byte-compile-output-docform nil nil '("\n(" 3 ")") form nil
> 




bug closed, send any further explanations to 11585 <at> debbugs.gnu.org and Pierre Lorenzon <devel <at> pollock-nageoire.net> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 31 May 2012 06:00:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 Jun 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 298 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.