From: Max Nikulin <manikulin@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Ihor Radchenko <yantar92@posteo.net>,
62762@debbugs.gnu.org, bzg@gnu.org, dmitry@gutov.dev,
Alan Mackenzie <acm@muc.de>, Eli Zaretskii <eliz@gnu.org>
Subject: bug#62762: 'make' often errors with "Org version mismatch" after pulling a new version of the code
Date: Fri, 5 May 2023 11:18:17 +0700 [thread overview]
Message-ID: <6070e598-7dee-1b7a-7f97-26a90618cb7a@gmail.com> (raw)
In-Reply-To: <jwvlei3st6i.fsf-monnier+emacs@gnu.org>
On 05/05/2023 04:53, Stefan Monnier wrote:
>> First of all, I think, incremental builds are broken in Emacs.
>
> Indeed, but in practice they usually work fine.
...
> Also, the use of `load-prefer-newer` in lisp/Makefile eliminates most of
> the brokenness we used to have in our incremental builds.
`load-prefer-newer' is a kludge as well. E.g. Python people migrated
from comparison of timestamps to inscribing of .py file hash into byte
compiled .pyc files. So if the hash in .pyc does not match .py content
then .pyc file is recompiled or just ignored.
By the way, `load-prefer-newer' make things even worse in the case of
`org-assert-version' when full dependency tree is not available. I have
tried to add dependency for all lisp/org/*.elc files on
lisp/org/org-macs.elc and lisp/org/org-version.el, but it is not enough.
During recompilation `require' prefers .elc files (.el files not
changed, so they are older) with inscribed stale `org-version' causing
compilation error. If .el files were loaded, recompiling would be
slower, but with up to date macro definitions. So in general, due to
`load-prefer-newer' the chance to get stale macro during incremental
build is higher than .el files are preferred. I admit, it is not common
case when definition of a macro depends on another macro loaded from
another file.
I am unsure if it is possible to express in make that all lisp/org/*.elc
files must be removed on change of
lisp/org/{org-version.el,org-macs.el}. It might alleviate the issue till
implementation of properly dependency tracking.
>> `org-assert-version' is just the most apparent manifestation.
>
> AFAIK `org-assert-version` tries to solve a different problem.
Of course `org-assert-version' was introduced to solve another problem,
but it highlighted issues with dependency handling during incremental
builds.
> Indeed,
> we recently introduced `org--inhibit-version-check` specifically so as
> not to use `org-assert-version` for Emacs's broken incremental builds
> (i.e. we decided we preferred that brokenness there).
`org--inhibit-version-check' is even uglier kludge that partially
deactivated `org-assert-version' and just hides the issue with
dependencies for incremental builds.
>> gcc supports generation of dependency files as a side effect of
>> preprocessing for decades, see
> [...]
>> Perhaps a similar trick may be done in elisp by advicing e.g. `load'.
Another idea: while single file is compiled per emacs invocation
`load-history' may be compared before and after byte compilation.
> I can already warn them that an
> important problem will be the presence of cyclic dependencies.
In the C and C++ world the solution for cyclic dependencies is forward
declarations. Some kind of such approach I see in Org as well.
lisp/org/ol.el and lisp/org/org-element.el are mutually dependent.
org-element.el requires 'ol, while the latter just declares functions
from 'org-element.
When dependency files are generated, it is possible to create a report
on cyclic dependency and to disentangle them.
>> Instead of dependency tracking Makefile in Emacs uses much more limited
>> approach with the main-first target.
>
> Hmm... no, `main-first` doesn't have much to do with dependencies (and
> things like deciding when to *re*compile a file), it's concerned with
> compile-time performance (typically for the first compilation, when the
> `.d` dependencies wouldn't be available yet).
My impression is that main-first defines order of compilation. In this
sense it servers for the same purpose as dependencies.
>> By the way, generated dependency map might help to properly reload a package
>> update without restarting of Emacs.
>
> BTW, I was reminded recently that `load-history` keeps track of
> `require`s so we already have most of that info at hand.
I agree that heuristics based on `load-history' mostly works, but I
suspect corner cases might exist. I have not inspected `org-reload'
closely and what Emacs core offers instead.
> The idea was to check the shadowing only for one specific file, so as to
> try and keep the added cost in check.
That specific file must be checked for each file loaded from the updated
directory. So hash O(1) should be better than scanning the list.
>> I am unsure that path comparison is able to detect a problem when a user
>> reloads Org after git pull and compiling new version.
>
> If you mean `git pull; make` in Emacs's source code,
I mean reloading of updated Org from a clone of the org-mode repository
to emacs installed as a system package (or as an independent custom
built). A recent case where origin of the problem remained obscure:
Colin Baxter to emacs-orgmode. Why am I being told to use "straight.el"?
Fri, 21 Apr 2023 10:42:27 +0100.
https://list.orgmode.org/87ildpbmgs.fsf@yandex.com
Notice that mixed version loading may happen without changing of
`load-path'. New org is loaded from the same directory.
> If you mean `git pull; make` in Org's source repository, then I must
> admit that I don't have much experience with it, but make Org's make
> file could set `load-prefer-newer`
Not enough, see beginning of the message.
> `my-require-with-shadow-check` is instead aimed at the case where the
> users try to load a mix of two different Org versions in the same Emacs
> sessions, either because of things like:
> - they're byte-compiling Org-2 in an Emacs that has Org-1 already loaded.
Does in help in the following case?
1. Base Org part is loaded on opening of some .org file.
2. Org in that directory is updated and recompiled.
3. New Org feature is loaded (autoloaded or by explicit call of e.g.
(require ob-shell))
> I my own experience `git pull; make` in Emacs's source code has
> virtually never caused me trouble with Org files,
I recall issues after introducing of `org-encode-time' and finally Ihor
replaced original macro to a less efficient function. However I am not
sure what was the real reason:
- Some issue with conditional macro definition and native compilation
- Incomplete incremental rebuilds
- Macro was not properly defined so it was disappearing from byte
compiled code.
However "undefined" complains might be similar to what I saw for
`org-assert-version'.
>> In respect to incremental builds, `org-assert-version' is a disaster.
>> Any update requires full recompiling.
>
> Indeed, I used to disable it locally (before `org--inhibit-version-check`).
By disaster I mean increased build time. `org--inhibit-version-check'
allows mixed version compilation for macros unrelated to
`org-assert-version', it is another disaster.
> Maybe a clear set of examples of the kinds of problems that
> `org-assert-version` aims to catch would be a good start.
> For me it's still not really clear.
- You are almost certainly going to ignore package.el issues in released
Emacs versions including 28.
- Besides package.el there are other package managers. I have heard of
weird issues with straight.el and org, but I have no links describing
details.
- Some users just clone org-mode repository and add that directory to
`load-path'. Directory remains the same after updates.
- Users tend to load some part of org before adding new version to
load-path: explicit require, through dependencies, unsure if org file as
startup screen may cause it as well
- User wish to update Org without restarting of Emacs. Recompiling may
be called from Emacs (e.g. package.el) or by make or other scripts.
The goals:
- prevent mixed version compiling
- prevent mixed version loading
- error message should be clear for users explaining what actions they
should perform for recovery from broken state.
I have not isolated an issue in Emacs-28 with package.el and difference
with emacs binary is running from source tree or from install tree
(.el+.elc vs. el.gz+.elc files in the directory with built-in Org and
preference of .el vs. elc in require), so I can not tell if it affects
other package managers in newer Emacs. It is the case when
`org-assert-version' prevents loading of mixed compilation result, but
user experience is terrible since simple recompilation does not help.
next prev parent reply other threads:[~2023-05-05 4:18 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 23:09 bug#62762: 'make' often errors with "Org version mismatch" after pulling a new version of the code Dmitry Gutov
2023-04-11 6:10 ` Eli Zaretskii
2023-04-11 7:18 ` Ihor Radchenko
2023-04-11 8:03 ` Eli Zaretskii
2023-04-11 18:35 ` Ihor Radchenko
2023-04-11 18:51 ` Eli Zaretskii
2023-04-11 18:59 ` Ihor Radchenko
2023-04-11 19:28 ` Eli Zaretskii
2023-04-11 19:37 ` Eli Zaretskii
2023-04-12 9:03 ` Ihor Radchenko
2023-04-12 9:21 ` Eli Zaretskii
2023-04-13 8:34 ` Ihor Radchenko
2023-04-13 8:37 ` Eli Zaretskii
2023-04-13 14:20 ` Ihor Radchenko
2023-04-13 14:55 ` Eli Zaretskii
2023-04-13 15:05 ` Ihor Radchenko
2023-04-15 10:48 ` Eli Zaretskii
2023-04-15 11:36 ` Ihor Radchenko
2023-04-15 11:40 ` Eli Zaretskii
2023-04-15 11:57 ` Ihor Radchenko
2023-04-15 12:08 ` Eli Zaretskii
2023-04-21 11:44 ` Eli Zaretskii
2023-04-21 15:28 ` Ihor Radchenko
2023-04-22 9:49 ` Eli Zaretskii
2023-04-22 12:39 ` Ihor Radchenko
2023-04-22 12:48 ` Eli Zaretskii
2023-04-22 14:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-23 8:55 ` Ihor Radchenko
2023-04-24 11:21 ` Eli Zaretskii
2023-04-24 12:29 ` Ihor Radchenko
2023-11-24 17:43 ` Dmitry Gutov
2023-11-24 18:54 ` Eli Zaretskii
2023-11-24 18:56 ` Dmitry Gutov
2023-11-25 7:08 ` Eli Zaretskii
2023-11-25 12:38 ` Dmitry Gutov
2023-11-25 12:59 ` Eli Zaretskii
2023-11-25 13:55 ` Dmitry Gutov
2023-04-22 14:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-22 14:59 ` Eli Zaretskii
2023-04-23 9:21 ` Ihor Radchenko
2023-05-01 1:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-01 10:25 ` Ihor Radchenko
2023-05-01 16:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-02 11:26 ` Ihor Radchenko
2023-05-02 13:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-03 10:30 ` Ihor Radchenko
2023-05-03 21:37 ` Alan Mackenzie
2023-05-04 5:35 ` Eli Zaretskii
2023-05-04 14:02 ` Alan Mackenzie
2023-05-04 14:10 ` Eli Zaretskii
2023-05-04 15:31 ` Max Nikulin
2023-05-04 21:53 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-05 4:18 ` Max Nikulin [this message]
2023-05-05 5:27 ` Max Nikulin
2023-05-05 6:46 ` Eli Zaretskii
2023-05-05 7:27 ` Max Nikulin
2023-05-05 10:38 ` Eli Zaretskii
2023-05-05 11:20 ` Max Nikulin
2023-05-05 11:33 ` Eli Zaretskii
2023-05-05 15:33 ` Max Nikulin
2023-05-05 15:49 ` Eli Zaretskii
2023-05-05 16:46 ` Max Nikulin
2023-05-05 17:48 ` Eli Zaretskii
2023-05-05 18:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-11 15:14 ` bug#62762: circular dependencies in elisp files and make Max Nikulin
2023-05-11 15:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-11 15:59 ` Eli Zaretskii
2023-05-12 14:59 ` Max Nikulin
2023-05-12 15:10 ` Eli Zaretskii
2023-05-12 15:26 ` Max Nikulin
2023-05-12 16:01 ` Eli Zaretskii
2023-05-13 3:08 ` Max Nikulin
2023-05-13 6:50 ` Eli Zaretskii
2023-05-13 7:34 ` Max Nikulin
2023-05-13 8:46 ` Eli Zaretskii
2023-05-13 10:25 ` Max Nikulin
2023-05-13 10:58 ` Eli Zaretskii
2023-05-13 11:21 ` Max Nikulin
2023-05-13 14:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13 14:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15 10:11 ` Max Nikulin
2023-05-15 11:20 ` Eli Zaretskii
2023-05-15 13:00 ` Max Nikulin
2023-05-15 15:00 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13 15:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-05 14:29 ` bug#62762: 'make' often errors with "Org version mismatch" after pulling a new version of the code Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-05 16:37 ` Max Nikulin
2023-05-05 18:17 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-06 5:25 ` Max Nikulin
2023-05-06 13:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07 16:23 ` Max Nikulin
2023-05-07 21:57 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 10:05 ` Ihor Radchenko
2023-05-10 14:52 ` Max Nikulin
2023-06-23 12:02 ` Ihor Radchenko
2023-06-25 14:37 ` Max Nikulin
2023-06-27 10:59 ` Ihor Radchenko
2023-06-27 11:40 ` Eli Zaretskii
2023-06-27 12:08 ` Ihor Radchenko
2023-06-27 12:12 ` Eli Zaretskii
2023-06-27 12:30 ` Ihor Radchenko
2023-06-27 12:51 ` Eli Zaretskii
2023-06-27 16:11 ` Max Nikulin
2023-07-04 12:20 ` Ihor Radchenko
2023-05-06 6:00 ` Max Nikulin
2023-05-06 7:51 ` bug#62762: Incremental builds and Lisp files dependencies " Eli Zaretskii
2023-05-06 15:50 ` Max Nikulin
2023-05-06 16:26 ` Eli Zaretskii
2023-05-07 2:45 ` Max Nikulin
2023-05-07 5:34 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6070e598-7dee-1b7a-7f97-26a90618cb7a@gmail.com \
--to=manikulin@gmail.com \
--cc=62762@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=bzg@gnu.org \
--cc=dmitry@gutov.dev \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.