all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Max Nikulin <manikulin@gmail.com>
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: Thu, 04 May 2023 17:53:34 -0400	[thread overview]
Message-ID: <jwvlei3st6i.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <1c5d0ff0-5bae-1123-d2f7-64d9013fbc0f@gmail.com> (Max Nikulin's message of "Thu, 4 May 2023 22:31:43 +0700")

> First of all, I think, incremental builds are broken in Emacs.

Indeed, but in practice they usually work fine.  So in the absence of
a better solution, we stay with this hack and tell people to try
`make bootstrap` when there's a problem.

Also, the use of `load-prefer-newer` in lisp/Makefile eliminates most of
the brokenness we used to have in our incremental builds.

> `org-assert-version' is just the most apparent manifestation.

AFAIK `org-assert-version` tries to solve a different problem.  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).

> 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'.

I encourage people to try that out, yes.
Having been there (many years ago), I can already warn them that an
important problem will be the presence of cyclic dependencies.

> 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).

> That is why incremental build may easily result in mixed-version
> compilation.

Actually, now that we set `load-prefer-newer`, it is rarely a problem.
[ Of course, it can still be a problem, but only in cases such as when
  a macro is changed such that the old expansion is not compatible with
  code using the new definitions.  This happens (e.g. when we changed
  structs to use `record` instead of `vector`), but not fairly rarely.  ]

> 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 have heard that some users complain concerning Emacs startup time. Likely
> a hashmap will be required in addition to the `load-history' list to avoid
> performance degradation. I am unsure if the following idea have some
> benefits: check shadowing when `load-path' is modified, not for each file
> loaded from the newly added directory.

The idea was to check the shadowing only for one specific file, so as to
try and keep the added cost in check.  Checking shadowings when
`load-path` is modified is harder (because `load-history` doesn't
remember which name was used to load a file, so it could be confused and
think a file like `lisp/progmodes/compile.el` shadows a previously
loaded `lisp/cedet/srecode/compile.el`) and could be more costly
(because it has to check for "all" files).

> I am unsure that path comparison is able to detect a problem when a user
> reloads Org after git pull and compiling new version.

[ AFAICT, there are different situations with related yet different
  problems that manifest slightly differently and that may be solved
  differently as well, so please be specific when you mention
  problematic scenarios.  ]

If you mean `git pull; make` in Emacs's source code, then AFAIK this
should almost never be a problem (thanks to `load-prefer-newer`), and if
it is, it's a general problem that's not specific to Org, and "we"
changed `org-assert-version` so as not to bother trying to solve
this case.

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` (or use some hack to autogenerate
`.d` dependency files :-).

`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.
- they inadvertently end up loading part of Org-1 early in their init
  file before they set their `load-path` to point to Org-2.

I understand Org people have had lots of problems with mixed-versions in
the past, but I personally don't know which circumstances have been more
often at the source of those problems, so maybe my suggestion addresses
a problem that's not very important, indeed.

I my own experience `git pull; make` in Emacs's source code has
virtually never caused me trouble with Org files, and it's never cause
any trouble in my checkout of Org's source code either, which is why
I'm suggesting something like `my-require-with-shadow-check`, which
targets other scenarios.

> 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`).

> It is a reason why I always considered it as a kludge.  Unfortunately
> I do not have a better idea.

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.

> The issue is not limited to package.el or replacing built-in package.
> Various ways to load packages are used, so a couple of versions may
> appear in load-path even for non built-in package.

So far I haven't seen enough of the diversity of situations are (source
of) problems to have a clear idea of what a good solution should look
like, admittedly.

`my-require-with-shadow-check` is only based on my intuition that it
might catch the most common issues where two different Org versions are
used in the same Emacs session, which seems to cover most of the
problems (except for those due to `git pull; make`, which seem to be
qualitatively of a different kind).


        Stefan






  reply	other threads:[~2023-05-04 21:53 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 [this message]
2023-05-05  4:18                             ` Max Nikulin
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=jwvlei3st6i.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62762@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=bzg@gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=manikulin@gmail.com \
    --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.