Bug 2355

Summary: *.elc compression breaks documentation access
Product: Sisyphus Reporter: Sergey Vlasov <vsu>
Component: emacs-commonAssignee: Ivan Zakharyaschev <imz>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P5 CC: sbolshakov
Version: unstable   
Hardware: all   
OS: Linux   

Description Sergey Vlasov 2003-03-11 16:57:09 MSK
При использовании сжатых файлов *.elc (как gzip, так и bzip2) после загрузки этих файлов становится невозможным доступ к документации для определённых в этих файлах функций.

Пример:

C-h f life RET		(описание отображается нормально)
M-x life RET		(вызывает загрузку life.elc.gz)
C-h f life RET		(вместо описания отображается мусор)

Кроме того, в определённых ситуациях emacs падает:

M-: (setq load-force-doc-strings t) RET
M-x life RET
Fatal error (11).Segmentation fault

Проблема в том, что в .elc строки с документацией хранятся в виде смещений от начала файла, а загрузка самого текста обычно происходит по требованию; для сжатых файлов это не проходит (функция doc.c:get_doc_string() работает непосредственно с файлом).  После (setq load-force-doc-strings t) строки документации должны загружаться немедленно - это тоже не работает, так как в функцию doc.c:get_doc_string() передаётся имя сжатого файла, а распакованное содержимое находится во временном буфере Emacs и недоступно для этой функции.

---

---

Comment 1 imz 2003-03-25 23:39:55 MSK
У меня не падает (во втором примере). Впрочем, это не так важно. Первое уже плохо.
Comment 2 imz 2003-03-25 23:39:55 MSK
У меня не падает (во втором примере). Впрочем, это не так важно. Первое уже плохо.
Comment 3 imz 2003-04-08 02:09:20 MSD
in 21.3-alt2

Некоторые подробности: 

`jka-compr-load\' заботится об этой проблеме (временно меняя знчение `load-force-doc-strings\' при загрузке распакованного файла). Всё должно было быть хорошо, но оказалось, что `jka-compr-load\' использовался не всегда при загрузке. Это ошибка в lread.c -- там на самом деле две ошибки в одном месте, поэтому и патча два.

* Tue Apr 01 2003 Ivan Zakharyaschev &lt;<a href="mailto:imz@altlinux.ru&gt" target="_new">imz@altlinux.ru&gt</a>; 21.3-alt2

- built-in `load\': always use the load-handler if it is present 
  (e.g. for compressed .elc\'s; fixes No. 0002355; patches 11 and 12);
&lt;...&gt;

Ещё более подробные объяснения и тесты:

I have just tried the currently checked-out from Savannah Emacs sources. My
conclusion is like this: in the current sources, another problem
at the same place has been fixed, and the problem in focus
remains there. (I\'ve made a patch.)

(Meanwhile I discovered that the fix I suggested for Emacs 21.3
is not enough for it to work correctly -- it should be combined
with the fix from the current sources to fight the problem
completely.)

Here are the details:

the handler for load is not always used when it should. Here is a
sequence of commands that demonstrates it on the newest Emacs,
too. (Remember, /usr/share/emacs/21.3/lisp/play/life.elc.gz is
compressed at the standard location;
\&quot;/usr/share/emacs/21.3/lisp\&quot; and
\&quot;/usr/share/emacs/21.3/lisp/play\&quot; are in the `load-path\'):

(require \'jka-compr)
(auto-compression-mode t)
(debug-on-entry \'jka-compr-load)

;;;;;;;;; 1 ;;;;;;;;;
(load \&quot;/usr/share/emacs/21.3/lisp/play/life\&quot;)
; no entry into `jka-compr-load\'

(load \&quot;/usr/share/emacs/21.3/lisp/play/life.elc.gz\&quot;)
; `jka-compr-load\' entered

;;;;;;;;; 2 ;;;;;;;;;
(load \&quot;play/life\&quot;)
; no entry into `jka-compr-load\'
(load \&quot;play/life.elc.gz\&quot;)
; `jka-compr-load\' entered

;;;;;;;;; 3 ;;;;;;;;;
(load \&quot;life\&quot;)
; no entry into `jka-compr-load\'

(load \&quot;life.elc.gz\&quot;)
; `jka-compr-load\' entered

This inconsistency is not good. It might cause errors. (E.g., in
Emacs 21.3, it was the problems with docstrings.)

In Emacs 21.3, there are even less entries (no entry in one of the cases 1--3.)
Comment 4 imz 2003-04-08 02:09:20 MSD
in 21.3-alt2

Некоторые подробности: 

`jka-compr-load\' заботится об этой проблеме (временно меняя знчение `load-force-doc-strings\' при загрузке распакованного файла). Всё должно было быть хорошо, но оказалось, что `jka-compr-load\' использовался не всегда при загрузке. Это ошибка в lread.c -- там на самом деле две ошибки в одном месте, поэтому и патча два.

* Tue Apr 01 2003 Ivan Zakharyaschev &lt;<a href="mailto:imz@altlinux.ru&gt" target="_new">imz@altlinux.ru&gt</a>; 21.3-alt2

- built-in `load\': always use the load-handler if it is present 
  (e.g. for compressed .elc\'s; fixes No. 0002355; patches 11 and 12);
&lt;...&gt;

Ещё более подробные объяснения и тесты:

I have just tried the currently checked-out from Savannah Emacs sources. My
conclusion is like this: in the current sources, another problem
at the same place has been fixed, and the problem in focus
remains there. (I\'ve made a patch.)

(Meanwhile I discovered that the fix I suggested for Emacs 21.3
is not enough for it to work correctly -- it should be combined
with the fix from the current sources to fight the problem
completely.)

Here are the details:

the handler for load is not always used when it should. Here is a
sequence of commands that demonstrates it on the newest Emacs,
too. (Remember, /usr/share/emacs/21.3/lisp/play/life.elc.gz is
compressed at the standard location;
\&quot;/usr/share/emacs/21.3/lisp\&quot; and
\&quot;/usr/share/emacs/21.3/lisp/play\&quot; are in the `load-path\'):

(require \'jka-compr)
(auto-compression-mode t)
(debug-on-entry \'jka-compr-load)

;;;;;;;;; 1 ;;;;;;;;;
(load \&quot;/usr/share/emacs/21.3/lisp/play/life\&quot;)
; no entry into `jka-compr-load\'

(load \&quot;/usr/share/emacs/21.3/lisp/play/life.elc.gz\&quot;)
; `jka-compr-load\' entered

;;;;;;;;; 2 ;;;;;;;;;
(load \&quot;play/life\&quot;)
; no entry into `jka-compr-load\'
(load \&quot;play/life.elc.gz\&quot;)
; `jka-compr-load\' entered

;;;;;;;;; 3 ;;;;;;;;;
(load \&quot;life\&quot;)
; no entry into `jka-compr-load\'

(load \&quot;life.elc.gz\&quot;)
; `jka-compr-load\' entered

This inconsistency is not good. It might cause errors. (E.g., in
Emacs 21.3, it was the problems with docstrings.)

In Emacs 21.3, there are even less entries (no entry in one of the cases 1--3.)