On 16/12/2022 21:47, Ihor Radchenko wrote:
Can it happen that already loaded version affects compilation of a new
version by package-install.

Yes. It is what appears to be happening:

https://irreal.org/blog/?p=10996
https://irreal.org/blog/?p=10999

I would not call it steps to reproduce.

From my point of view, there is a number of issues with updating of packages from emacs session.

1. If compilation of a package failed then it is not withdrawn from the load path.

2. There is no reliable way to determine if package compilation failed. (byte-recompile-directory DIR 0 t) returns human readable string, not signalling an error or returning a value convenient to check in the code. It is the cause of the previous issue.

3. Emacs package system is not ready for complex multifile packages containing macro definitions. It does not push user to update packages just after emacs restart in a clean state. As a result, files may be compiled with old or missed macro definitions.

4. Because of the item 2 a package has no chance to implement reliable internal sanity check that prevents updating to a broken state.

I have tried the following in Emacs-27. For Emacs >= 29 add -L to Org <= 9.5.

- "emacs -l org" to simulate a regular user session with some opened files.
- Update to Org-9.6 from ELPA.
- Close emacs and start it again "emacs -l org"

Result:
byte-code: Invalid function: org-assert-version

Notice attempt to load Org-9.6 despite warnings and even error during update:

Compiling file /home/emcs/.emacs.d/elpa/org-9.6/ob-C.el at Sun Dec 18 04:30:49 
2022
Entering directory ‘/home/emcs/.emacs.d/elpa/org-9.6/’

In end of data:
ob-C.el:509:1:Warning: the function ‘org-assert-version’ is not known to be
defined.
...
Compiling file /home/emcs/.emacs.d/elpa/org-9.6/ob-matlab.el at Sun Dec 18 
04:30:50 2022
ob-matlab.el:43:1:Error: Symbol’s function definition is void: 
org-assert-version

So emacs can not handle update of a package with changed macro definitions when they reside in another package file.

Reply via email to