* bug#11585: 24.0.50; corrupted byte compiled files
@ 2012-05-30 6:57 Pierre Lorenzon
[not found] ` <handler.11585.B.133836288230357.ack@debbugs.gnu.org>
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Pierre Lorenzon @ 2012-05-30 6:57 UTC (permalink / raw
To: 11585
[-- Attachment #1: Type: Text/Plain, Size: 10091 bytes --]
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@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)
[-- Attachment #2: Toto.elc --]
[-- Type: Application/Octet-Stream, Size: 1176 bytes --]
[-- Attachment #3: Toto.el --]
[-- Type: Text/Plain, Size: 625 bytes --]
(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"
)
)
)
[-- Attachment #4: Reformulation-En-Theorie-des-Groupes.elc --]
[-- Type: Application/Octet-Stream, Size: 1208 bytes --]
[-- Attachment #5: Reformulation-En-Theorie-des-Groupes.el --]
[-- Type: Text/Plain, Size: 625 bytes --]
(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"
)
)
)
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#11585: Acknowledgement (24.0.50; corrupted byte compiled files)
[not found] ` <handler.11585.B.133836288230357.ack@debbugs.gnu.org>
@ 2012-05-30 8:05 ` Pierre Lorenzon
2012-05-30 8:49 ` Pierre Lorenzon
0 siblings, 1 reply; 7+ messages in thread
From: Pierre Lorenzon @ 2012-05-30 8:05 UTC (permalink / raw
To: 11585
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#11585: Acknowledgement (24.0.50; corrupted byte compiled files)
2012-05-30 8:05 ` bug#11585: Acknowledgement (24.0.50; corrupted byte compiled files) Pierre Lorenzon
@ 2012-05-30 8:49 ` Pierre Lorenzon
0 siblings, 0 replies; 7+ messages in thread
From: Pierre Lorenzon @ 2012-05-30 8:49 UTC (permalink / raw
To: 11585
[-- Attachment #1: Type: Text/Plain, Size: 95 bytes --]
OK here is how I suggest to rewrite the
`byte-compile-fix-header' function.
Regards
Pierre
[-- Attachment #2: bytcomp-fix-fix.el --]
[-- Type: Application/Octet-Stream, Size: 2147 bytes --]
(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))
;; Find the comment that describes the version condition.
(when (search-forward "\n;;; This file uses" nil t)
;; Maybe better to do nothing if this sttring is not
;; found.
(let ((beg (copy-marker (line-beginning-position))))
;; (narrow-to-region (line-beginning-position) (point-max))
;; ;; Find the first line of ballast semicolons.
(when (search-forward ";;;;;;;;;;" nil t)
;; As above if this string is not found header is
;; probably badly formated so better to do
;; nothing. Otherwise first killing the part of the
;; header we want to replace.
(kill-region beg (line-beginning-position))
;; Maybe not really necessary.
(goto-char beg)
;; (beginning-of-line)
;; (narrow-to-region (point-min) (point))
(let (;; (old-header-end (point))
(minimum-version "23")
;; delta
)
;; (delete-region (point-min) (point-max))
(insert
";;; This file contains utf-8 non-ASCII characters,\n"
";;; and so cannot be loaded into Emacs 22 or earlier.\n"
;; Have to check if emacs-version is bound so that this works
;; in files loaded early in loadup.el.
"(and (boundp 'emacs-version)\n"
;; If there is a name at the end of emacs-version,
;; 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.
;; (setq delta (- (point-max) old-header-end))
;; (goto-char (point-max))
;; (widen)
;; (delete-char delta))))
))))))
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#11585: 24.0.50; corrupted byte compiled files
2012-05-30 6:57 bug#11585: 24.0.50; corrupted byte compiled files Pierre Lorenzon
[not found] ` <handler.11585.B.133836288230357.ack@debbugs.gnu.org>
@ 2012-05-30 14:45 ` Chong Yidong
2012-05-30 15:28 ` Pierre Lorenzon
2012-05-30 15:24 ` Stefan Monnier
2 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2012-05-30 14:45 UTC (permalink / raw
To: Pierre Lorenzon; +Cc: 11585
Pierre Lorenzon <devel@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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#11585: 24.0.50; corrupted byte compiled files
2012-05-30 6:57 bug#11585: 24.0.50; corrupted byte compiled files Pierre Lorenzon
[not found] ` <handler.11585.B.133836288230357.ack@debbugs.gnu.org>
2012-05-30 14:45 ` bug#11585: 24.0.50; corrupted byte compiled files Chong Yidong
@ 2012-05-30 15:24 ` Stefan Monnier
2012-05-30 15:31 ` Pierre Lorenzon
2 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2012-05-30 15:24 UTC (permalink / raw
To: Pierre Lorenzon; +Cc: 11585
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#11585: 24.0.50; corrupted byte compiled files
2012-05-30 14:45 ` bug#11585: 24.0.50; corrupted byte compiled files Chong Yidong
@ 2012-05-30 15:28 ` Pierre Lorenzon
0 siblings, 0 replies; 7+ messages in thread
From: Pierre Lorenzon @ 2012-05-30 15:28 UTC (permalink / raw
To: 11585
From: Chong Yidong <cyd@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@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.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#11585: 24.0.50; corrupted byte compiled files
2012-05-30 15:24 ` Stefan Monnier
@ 2012-05-30 15:31 ` Pierre Lorenzon
0 siblings, 0 replies; 7+ messages in thread
From: Pierre Lorenzon @ 2012-05-30 15:31 UTC (permalink / raw
To: 11585
From: Stefan Monnier <monnier@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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-30 15:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-30 6:57 bug#11585: 24.0.50; corrupted byte compiled files Pierre Lorenzon
[not found] ` <handler.11585.B.133836288230357.ack@debbugs.gnu.org>
2012-05-30 8:05 ` bug#11585: Acknowledgement (24.0.50; corrupted byte compiled files) Pierre Lorenzon
2012-05-30 8:49 ` Pierre Lorenzon
2012-05-30 14:45 ` bug#11585: 24.0.50; corrupted byte compiled files Chong Yidong
2012-05-30 15:28 ` Pierre Lorenzon
2012-05-30 15:24 ` Stefan Monnier
2012-05-30 15:31 ` Pierre Lorenzon
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.