Package: emacs;
Reported by: Johan Claesson <johanclaesson <at> bredband.net>
Date: Sun, 3 Mar 2013 11:02:01 UTC
Severity: normal
Tags: fixed, moreinfo
Found in version 24.2
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13860 in the body.
You can then email your comments to 13860 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#13860
; Package emacs
.
(Sun, 03 Mar 2013 11:02:01 GMT) Full text and rfc822 format available.Johan Claesson <johanclaesson <at> bredband.net>
:bug-gnu-emacs <at> gnu.org
.
(Sun, 03 Mar 2013 11:02:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: bug-gnu-emacs <at> gnu.org Subject: 24.2; dir-locals-directory-cache unreliable in one rare case Date: Sun, 03 Mar 2013 12:01:14 +0100
[Message part 1 (text/plain, inline)]
Hi, Maybe i have misunderstood something but i find the cache mechanism for directory local variables unreliable in one rare case. If first .dir-locals.el is read and a binding say foo = 1 is inserted in the dir-locals-directory-cache. And then foo = 2 is written in the same second. Now next time the dir locals the old binding foo = 1 will be returned. The cache entry is considered valid when it should not. Of course it is unlikely that a user is typing so fast that they trigger this :). But it can be triggered from Lisp. I found out when playing with a ert test case that was tampering with a dir local. Here is a recipe for this: (defvar foo nil) (put 'foo 'safe-local-variable 'numberp) (let ((dir (make-temp-file "cache-test" t))) ;; Create .dir-locals.el with foo = 1. (with-temp-buffer (cd dir) (add-dir-local-variable nil 'foo 1) (save-buffer) (kill-buffer)) ;; Read it into dir-locals-directory-cache ;; and save .dir-locals.el with foo = 2. (with-temp-buffer (cd dir) (make-local-variable 'foo) (hack-dir-local-variables-non-file-buffer) (add-dir-local-variable nil 'foo 2) (save-buffer) (kill-buffer)) ;; Read it back again. ;; It should be 2 at this point but is 1 most of the times. ;; (At the rare occasion that seconds increase ;; between the two add-dir-local-variable it returns 1). (with-temp-buffer (cd dir) (make-local-variable 'foo) (hack-dir-local-variables-non-file-buffer) (delete-file dir-locals-file) (delete-directory dir) foo)) The current mechanism: The bindings found when reading a .dir-locals.el file is put into dir-locals-directory-cache. The mtime of the file is stored in the cache entry. Later a cache entry is considered valid if it's mtime equals that of the file-attribute mtime of corresponding .dir-locals.el file. Suggestion: The mtime stored in the cache entry should be the time when .dir-local.el was read into memory. A cache entry should be considered valid if mtime of cache entry is greater than the file-attribute mtime of corresponding .dir-locals.el file. This will invalidate a couple of entries that should ideally have been considered valid but it will not let through any invalid ones. Or it should not let through any invalid entries, but in fact it seem to do so sometimes. If the above test is looped it will return the incorrect value one time in about 500 on my standard Ubuntu GNU/Linux system. I don't know why, maybe reading the mtime from a file is not that reliable. Anyway, to be on the safe side i subtract one second from the mtime when storing it to the cache. Now the test ran 50000 times with no trouble. Attached is a patch for files.el with this modification. If this makes sense and is accepted i will update the patch with the appropriate documentation changes as well. Regards, /Johan
[files.patch (text/x-diff, inline)]
--- a/files.el 2013-03-03 10:15:44.498835000 +0000 +++ b/files.el 2013-03-03 10:28:02.662835000 +0000 @@ -3610,14 +3610,14 @@ (defun dir-locals-find-file (file) (let ((cached-file (expand-file-name dir-locals-file-name (car dir-elt)))) (and (file-readable-p cached-file) - (equal (nth 2 dir-elt) - (nth 5 (file-attributes cached-file)))))) + (time-less-p (nth 5 (file-attributes cached-file)) + (nth 2 dir-elt))))) ;; This cache entry is OK. - dir-elt + dir-elt ;; This cache entry is invalid; clear it. (setq dir-locals-directory-cache (delq dir-elt dir-locals-directory-cache)) - ;; Return the first existing dir-locals file. Might be the same + ;; Return the first existing dir-locals file. Might be the same ;; as dir-elt's, might not (eg latter might have been deleted). locals-file) ;; No cache entry. @@ -3638,10 +3638,13 @@ (defun dir-locals-read-from-file (file) (let* ((dir-name (file-name-directory file)) (class-name (intern dir-name)) (variables (let ((read-circle nil)) - (read (current-buffer))))) + (read (current-buffer)))) + (just-now (time-subtract (current-time) + (list 0 1 0))) + (mtime (with-decoded-time-value ((high low micro just-now)) + (encode-time-value high low micro 1)))) (dir-locals-set-class-variables class-name variables) - (dir-locals-set-directory-class dir-name class-name - (nth 5 (file-attributes file))) + (dir-locals-set-directory-class dir-name class-name mtime) class-name)) (error (message "Error reading dir-locals: %S" err) nil)))))
[Message part 3 (text/plain, inline)]
In GNU Emacs 24.2.2 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2013-01-12 on goblin Windowing system distributor `The X.Org Foundation', version 11.0.11203000 Configured using: `configure '--prefix=/home/jcl/usr' '--without-toolkit-scroll-bars' '-C' '--disable-maintainer-mode' '--without-compress-info'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Fundamental Minor modes in effect: auto-fill-function: do-auto-fill diff-auto-refine-mode: t shell-dirtrack-mode: t global-cwarn-mode: t ido-everywhere: t display-time-mode: t icomplete-mode: t minibuffer-depth-indicate-mode: t which-function-mode: t electric-layout-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: <up> <up> M-f M-f C-h f <return> <down> <down> <down> <up> <up> <up> <up> <up> <up> <up> <down> <tab> <down> <tab> <down> <tab> <down> <tab> <down> <tab> <down> <tab> <C-tab> C-q C-SPC <C-up> <C-up> <C-tab> C-q C-q SPC SPC <return> C-h k C-c C-s C-c C-s i a a <C-tab> C-x C-f C-f <return> SPC <return> C-h v w h i <tab> t e s p <tab> m o <tab> <return> <C-tab> <M-next> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <down> <down> <down> <down> <down> <down> <home> <end> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <end> <up> b r <return> C-x C-s <C-tab> M-x e m a c s C-g <switch-frame> q p p p p p <return> q p <return> M-g C-s d i r C-s C-s C-s C-s C-s C-s C-s <home> C-s l o c a l C-s C-s <home> C-s c a c h e <down> <down> v k v k v k v k v k q <switch-frame> C-x C-s M-x e m a c s - b u g <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> r e p o r t - e m <tab> b <tab> - q <tab> <return> d i r SPC l o c s <backspace> a l s <return> <tab> <return> M-x <up> C-e <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <return> Recent messages: Saving file /home/jcl/.newsrc... Wrote /home/jcl/.newsrc Saving /home/jcl/.newsrc.eld... Saving file /home/jcl/.newsrc.eld... Wrote /home/jcl/.newsrc.eld Saving /home/jcl/.newsrc.eld...done Error during redisplay: (wrong-type-argument arrayp nil) [50 times] Contacting host: debbugs.gnu.org:80 Error during redisplay: (wrong-type-argument arrayp nil) [9 times] Reporting new bug! Load-path shadows: /home/jcl/elisp/elpa/flymake-0.4.13/flymake hides /home/jcl/usr/share/emacs/24.2/lisp/progmodes/flymake Features: (shadow emacsbug zone lisp-mnt flymake-autoloads org-datetree org-table org-lparse esh-var esh-io esh-cmd esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util org-mks org-id ob-octave pcase tree-widget slime-banner slime-enclosing-context tar-mode autoload org-element finder-inf mailalias info-look jcl-sl-init nrepl arc-mode archive-mode wesnoth-mode wesnoth-wml-data wesnoth-update calc calc-loaddefs calc-macs speedbar sb-image ezimage dframe woman tex-mode longlines rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok make-mode python cperl-mode tcl prolog align inf-haskell clojure-mode inf-lisp scheme gdb-mi json gud asm-mode glasses elp image-dired cal-dst ind-util gnus-fun w3m-form sort gnus-cite flow-fill mail-extr gnus-bcklg gnus-async rx chistory desktop apropos etags nnrss xml mm-url url-cache url-http url-gw url-auth tabify man dabbrev misearch multi-isearch cl-specs edebug hippie-exp haskell-mode smiley jcl-replace jcl-ruby jcl-w3m-init w3m-search jcl-games-init jcl-text-translator-init text-translator text-translator-window text-translator-vars text-translator-sites jcl-muse-init htmlize-hack htmlize muse-latex muse-html muse-xml-common muse-colors cus-edit cus-start cus-load muse-publish muse-project muse-protocols muse-regexps derived muse muse-nested-tags muse-mode jcl-dictem-init dictem jcl-yaoddmuse-init yaoddmuse-extension w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util yaoddmuse url url-proxy url-privacy url-expand url-methods url-history url-cookie url-util url-parse url-vars skeleton sgml-mode add-log gnus-dired vc-bzr vc-sccs vc-svn vc-cvs vc-rcs vc-dir vc vc-dispatcher find-lisp vc-git image-file org-indent org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-info org-gnus org-docview org-bibtex bibtex org-bbdb jcl-renegade-goblin jcl-home-boot jcl-status autorevert network-stream tls jcl-stumpwm jcl-slime slime-fancy slime-fontifying-fu slime-package-fu slime-references slime-scratch slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-parse slime-repl slime hyperspec browse-url mule-util flyspell qp parse-time gnus-ml nndraft nnmh nnfolder nnml gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime dig nntp gnus-cache jcl-goblin fuzzy-match jcl-load jcl-torrent text-translator-load jcl-calendar-init appt jcl-calendar holidays hol-loaddefs jcl-emms-init emms-playing-time emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-info later-do emms-playlist-mode emms-player-vlc emms-player-mplayer emms-player-simple emms-source-playlist emms-source-file emms-setup emms emms-compat jcl-gnus-init org-import-icalendar icalendar diary-lib diary-loaddefs jcl-gnus gnus-sum nnoo gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win mailcap starttls smtpmail sendmail message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus gnus-ems nnheader mail-utils wid-edit jcl-org-init org-latex org-export-latex org-beamer org-exp ob-exp org-exp-blocks org-agenda footnote org ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs cal-menu calendar cal-loaddefs jcl-midnite-init midnight jcl-picpocket-init picpocket eldoc files-x edmacro cl-lib jcl-erc-init jcl-file-cache-init jcl-grep-sbg sbg jcl-ido-init jcl-dired-init jcl-dired dired-x dired-details wdired dired-aux jcl-register-init jcl-command-subset-init jcl-generic-init generic-x jcl-erlang-init jcl-ssit jcl-sbg jcl-erlang-log bookmark pp jcl-eel bindat jcl-sbg-ssit erlang-eunit jcl-erlang distel-ie edb patmatch erl-service derl erlext epmd net-fsm erl distel erlang jcl-safe-init jcl-abbrev-init jcl-swedish-postfix quail help-mode jcl-ediff-init ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff jcl-term-init jcl-term time-stamp ange-ftp jcl-face-init hl-line jcl-elisp-init hi-lock jcl-template-init jcl-template jcl-file-cache ert find-func ewoc debug filecache jcl-register jcl-grep-init jcl-grep jcl-duff jcl-motion jcl-windows jcl-keys-init diff-mode term disp-table ehelp kmacro tramp tramp-compat auth-source eieio assoc gnus-util mm-util mail-prsvr password-cache shell pcomplete format-spec tramp-loaddefs windmove jcl-keys jcl-modes-init jcl-rfc rfcview view goto-addr proced table picture noutline outline easy-mmode inf-ruby ruby-mode sh-script cwarn grep compile jcl-command-subset ido jcl-global-init time winner thingatpt paren mic-paren printing ps-print ps-def lpr icomplete ispell uniquify mb-depth whitespace ffap byte-opt warnings bytecomp byte-compile cconv macroexp saveplace bitlbee-autoloads cl-lib-autoloads dired-details-autoloads eimp-autoloads el-mock-autoloads emms-autoloads erlang-autoloads fuzzy-match-autoloads haskell-mode-autoloads htmlize-autoloads inf-ruby-autoloads ipython-autoloads lua-mode-autoloads mediawiki-autoloads mic-paren-autoloads muse-autoloads nrepl-autoloads clojure-mode-autoloads org-autoloads pysmell-autoloads python-autoloads slime-autoloads tabbar-autoloads w3m-autoloads yaoddmuse-autoloads package tabulated-list jcl-imenu which-func imenu jcl-misc newcomment jcl-compile jcl-recommended-init jcl-site-start fpl electric cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs jpt-mode erlang-start clearcase tq reporter executable dired comint regexp-opt ansi-color ring info easymenu jcl-bugfix jcl-times-init advice help-fns advice-preload jcl-times jcl-util server jcl-load-path cl time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
bug-gnu-emacs <at> gnu.org
:bug#13860
; Package emacs
.
(Thu, 15 Aug 2019 06:19:02 GMT) Full text and rfc822 format available.Message #8 received at 13860 <at> debbugs.gnu.org (full text, mbox):
From: Lars Ingebrigtsen <larsi <at> gnus.org> To: Johan Claesson <johanclaesson <at> bredband.net> Cc: 13860 <at> debbugs.gnu.org Subject: Re: bug#13860: 24.2; dir-locals-directory-cache unreliable in one rare case Date: Wed, 14 Aug 2019 23:18:44 -0700
Johan Claesson <johanclaesson <at> bredband.net> writes: > Maybe i have misunderstood something but i find the cache > mechanism for directory local variables unreliable in one rare > case. If first .dir-locals.el is read and a binding say foo = 1 is > inserted in the dir-locals-directory-cache. And then foo = 2 is > written in the same second. Now next time the dir locals the old > binding foo = 1 will be returned. The cache entry is considered > valid when it should not. > > Of course it is unlikely that a user is typing so fast that they > trigger this :). But it can be triggered from Lisp. I found out > when playing with a ert test case that was tampering with a dir > local. (I'm going through old bug reports that have unfortunately gotten no responses yet.) > Here is a recipe for this: > > (defvar foo nil) > (put 'foo 'safe-local-variable 'numberp) > (let ((dir (make-temp-file "cache-test" t))) > ;; Create .dir-locals.el with foo = 1. > (with-temp-buffer > (cd dir) > (add-dir-local-variable nil 'foo 1) > (save-buffer) > (kill-buffer)) > ;; Read it into dir-locals-directory-cache > ;; and save .dir-locals.el with foo = 2. > (with-temp-buffer > (cd dir) > (make-local-variable 'foo) > (hack-dir-local-variables-non-file-buffer) > (add-dir-local-variable nil 'foo 2) > (save-buffer) > (kill-buffer)) > ;; Read it back again. > ;; It should be 2 at this point but is 1 most of the times. > ;; (At the rare occasion that seconds increase > ;; between the two add-dir-local-variable it returns 1). > (with-temp-buffer > (cd dir) > (make-local-variable 'foo) > (hack-dir-local-variables-non-file-buffer) > (delete-file dir-locals-file) > (delete-directory dir) > foo)) I'm unable to reproduce this problem in Emacs 27, but perhaps this could be a problem if the file system doesn't have sub-second resolution? Are there such file systems still in use (I mean, for something where'd you store file with file-local variables)? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
Lars Ingebrigtsen <larsi <at> gnus.org>
to control <at> debbugs.gnu.org
.
(Thu, 15 Aug 2019 06:19:04 GMT) Full text and rfc822 format available.bug-gnu-emacs <at> gnu.org
:bug#13860
; Package emacs
.
(Sun, 18 Aug 2019 19:20:02 GMT) Full text and rfc822 format available.Message #13 received at 13860 <at> debbugs.gnu.org (full text, mbox):
From: Johan Claesson <johanclaesson <at> bredband.net> To: Lars Ingebrigtsen <larsi <at> gnus.org> Cc: 13860 <at> debbugs.gnu.org Subject: Re: bug#13860: 24.2; dir-locals-directory-cache unreliable in one rare case Date: Sun, 18 Aug 2019 21:19:01 +0200
Hi Lars, I can reproduce with emacs -Q on Emacs 27 (ee1c638cff). I get the wrong value about 1 time in 3 tries. (I cannot reproduce without -Q. In particular when magit-autorevert is loaded that will "fix" the issue. Probably by slowing things down.) My original description is a bit incorrect/misleading. The race condition is not about if it occurs in the same second or not. But it is about when two file modification timestamps are equal. What happens seem to be that sometimes the second time the .dir-locals.el file is written (now with value foo = 2) the file will get the same timestamp as it already have from the first write. At this point the dir-locals-class-alist cache is not updated (it still have foo = 1). The cache is supposed to be updated when reading the .dir-locals.el. But that is only done if .dir-locals.el modification timestamp is newer than the timestamp in the cache. Sometimes they are the same just because the clock have not ticked forward. I think one way to remedy this would be to explicitly invalidate the directory cache every time a .dir-local.el file is modified. Something like the following seem to do the trick: diff --git a/lisp/files-x.el b/lisp/files-x.el index b71e9204f3..6b04518fe4 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -491,6 +491,13 @@ modify-dir-local-variable (cons `(,mode . ((,variable . ,value))) variables)))) + ;; Invalidate cache (may be needed if this .dir-locals.el file + ;; will be written with the same timestamp as is already present + ;; in the cache, see bug#13860). + (setq dir-locals-directory-cache + (assoc-delete-all (file-name-directory variables-file) + dir-locals-directory-cache)) + ;; Insert modified alist of directory-local variables. (insert ";;; Directory Local Variables\n") (insert ";;; For more information see (info \"(emacs) Directory Variables\")\n\n") Regards, /Johan On Wed, Aug 14 2019, Lars Ingebrigtsen wrote: > Johan Claesson <johanclaesson <at> bredband.net> writes: > >> Maybe i have misunderstood something but i find the cache >> mechanism for directory local variables unreliable in one rare >> case. If first .dir-locals.el is read and a binding say foo = 1 is >> inserted in the dir-locals-directory-cache. And then foo = 2 is >> written in the same second. Now next time the dir locals the old >> binding foo = 1 will be returned. The cache entry is considered >> valid when it should not. >> >> Of course it is unlikely that a user is typing so fast that they >> trigger this :). But it can be triggered from Lisp. I found out >> when playing with a ert test case that was tampering with a dir >> local. > > (I'm going through old bug reports that have unfortunately gotten no > responses yet.) > >> Here is a recipe for this: >> >> (defvar foo nil) >> (put 'foo 'safe-local-variable 'numberp) >> (let ((dir (make-temp-file "cache-test" t))) >> ;; Create .dir-locals.el with foo = 1. >> (with-temp-buffer >> (cd dir) >> (add-dir-local-variable nil 'foo 1) >> (save-buffer) >> (kill-buffer)) >> ;; Read it into dir-locals-directory-cache >> ;; and save .dir-locals.el with foo = 2. >> (with-temp-buffer >> (cd dir) >> (make-local-variable 'foo) >> (hack-dir-local-variables-non-file-buffer) >> (add-dir-local-variable nil 'foo 2) >> (save-buffer) >> (kill-buffer)) >> ;; Read it back again. >> ;; It should be 2 at this point but is 1 most of the times. >> ;; (At the rare occasion that seconds increase >> ;; between the two add-dir-local-variable it returns 1). >> (with-temp-buffer >> (cd dir) >> (make-local-variable 'foo) >> (hack-dir-local-variables-non-file-buffer) >> (delete-file dir-locals-file) >> (delete-directory dir) >> foo)) > > I'm unable to reproduce this problem in Emacs 27, but perhaps this could > be a problem if the file system doesn't have sub-second resolution? Are > there such file systems still in use (I mean, for something where'd you > store file with file-local variables)?
bug-gnu-emacs <at> gnu.org
:bug#13860
; Package emacs
.
(Sun, 18 Aug 2019 22:50:02 GMT) Full text and rfc822 format available.Message #16 received at 13860 <at> debbugs.gnu.org (full text, mbox):
From: Lars Ingebrigtsen <larsi <at> gnus.org> To: Johan Claesson <johanclaesson <at> bredband.net> Cc: 13860 <at> debbugs.gnu.org Subject: Re: bug#13860: 24.2; dir-locals-directory-cache unreliable in one rare case Date: Sun, 18 Aug 2019 15:49:49 -0700
Johan Claesson <johanclaesson <at> bredband.net> writes: > I think one way to remedy this would be to explicitly invalidate the > directory cache every time a .dir-local.el file is modified. Something > like the following seem to do the trick: > > diff --git a/lisp/files-x.el b/lisp/files-x.el > index b71e9204f3..6b04518fe4 100644 > --- a/lisp/files-x.el > +++ b/lisp/files-x.el > @@ -491,6 +491,13 @@ modify-dir-local-variable > (cons `(,mode . ((,variable . ,value))) > variables)))) > > + ;; Invalidate cache (may be needed if this .dir-locals.el file > + ;; will be written with the same timestamp as is already present > + ;; in the cache, see bug#13860). > + (setq dir-locals-directory-cache > + (assoc-delete-all (file-name-directory variables-file) > + dir-locals-directory-cache)) > + Thanks; I think this makes sense, so I've applied it to Emacs 27. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
Lars Ingebrigtsen <larsi <at> gnus.org>
to control <at> debbugs.gnu.org
.
(Sun, 18 Aug 2019 22:51:01 GMT) Full text and rfc822 format available.Lars Ingebrigtsen <larsi <at> gnus.org>
to control <at> debbugs.gnu.org
.
(Sun, 18 Aug 2019 22:51:02 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Mon, 16 Sep 2019 11:24:08 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.