GNU bug report logs - #62762
'make' often errors with "Org version mismatch" after pulling a new version of the code

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dmitry <at> gutov.dev>

Date: Mon, 10 Apr 2023 23:10:01 UTC

Severity: normal

Full log


Message #110 received at 62762 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: bzg <at> gnu.org, dmitry <at> gutov.dev, Eli Zaretskii <eliz <at> gnu.org>,
 62762 <at> debbugs.gnu.org
Subject: Re: bug#62762: 'make' often errors with "Org version mismatch"
 after pulling a new version of the code
Date: Mon, 01 May 2023 12:49:04 -0400
> May you provide an approximate code for that function?

Something like (guaranteed 100% untested):

    (defun my-require-with-shadow-check (feature &optional reload)
      (if (not (featurep feature))
          (require feature)
        (let ((file (locate-file (symbol-name feature)
                                 load-path (get-load-suffixes))))
          (if (assoc file load-history)
              ;; The desired file is already loaded, we're clear!
              nil
            ;; The feature is already provided, but from some other file
            ;; than expected.  Presumably because `load-path` has been
            ;; changed since the file was loaded.  This is likely a sign
            ;; that we're loading a mix of files from different versions.
            ;; That can spell trouble.
            (if reload
                ;; Try and fix the situation by force-reloading the file
                ;; This may fix the problem but only if that file doesn't
                ;; `require` any other affected file, or if it also
                ;; uses `my-require-with-shadow-check` to similarly reload
                ;; any other affected file.
                (load file nil t t)
              ;; We could try and find the "other/older" file in `load-history`
              ;; to provide better feedback to the user.
              (error "Mixed versions!!"))))))


-- Stefan





This bug report was last modified 1 year and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.