[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35022: 26.1; Load order of custom-autoload, custom-load-symbol, cust
From: |
Allen Li |
Subject: |
bug#35022: 26.1; Load order of custom-autoload, custom-load-symbol, custom-loads is backward? |
Date: |
Wed, 27 Mar 2019 12:45:42 -0700 |
I just spent some time tracking down an unexpected behavior in custom
autoloads.
The custom-autoload function is used in autoloads/loaddef files to set
up custom variables. custom-autoload adds a load path to the
custom-loads property of a variable. This property is then used in
custom-load-symbol to load each of the load paths.
The problem is that custom-autoload adds load paths to the front of
custom-loads, and custom-load-symbol loads the paths in forward order.
This is unexpected because if the site distributes a package foo and the
user installs their own version of foo, the site custom-autoload will be
called first:
;; Called from site-start
(custom-autoload 'foo-some-variable "path/to/site/foo" nil)
;; Called from init.el/package-initialize
(custom-autoload 'foo-some-variable "path/to/user/foo" nil)
In this case the custom-loads property will be
("path/to/user/foo" "path/to/site/foo")
The user version will be loaded first, and the site version will be
loaded later, overriding the user version.
This behavior is unexpected; the user would expect that their version of
foo overrides the site version of foo. Furthermore, this behavior is
somewhat non-deterministic; site overrides foo *only if* foo is loaded
via setting foo-some-variable with customize. If foo is loaded normally
(e.g. with require), then the user version of foo will be loaded in
preference to the site verison of foo.
I have attached a patch fixing this.
Note that this is technically a breaking change; however I really doubt
any one is intentionally relying on this behavior. I consider this a
bugfix and I think there are probably users who don't realize that they
are suffering from this bug because it's so subtle.
In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.24), modified by Debian
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux rodete (upgraded from: Ubuntu 14.04 LTS)
0001-Load-custom-variable-dependencies-in-FIFO-order.patch
Description: Text Data
- bug#35022: 26.1; Load order of custom-autoload, custom-load-symbol, custom-loads is backward?,
Allen Li <=