From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#52773: Master and (probably) emacs-28: locate-library hides .eln files. Date: Fri, 24 Dec 2021 21:03:17 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3868"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52773@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 24 22:04:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n0rjg-0000pg-Pt for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Dec 2021 22:04:20 +0100 Original-Received: from localhost ([::1]:38088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0rjf-0000md-1z for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Dec 2021 16:04:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0rjO-0000kH-PO for bug-gnu-emacs@gnu.org; Fri, 24 Dec 2021 16:04:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0rjO-0001mb-Fl for bug-gnu-emacs@gnu.org; Fri, 24 Dec 2021 16:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n0rjO-0001wQ-2n for bug-gnu-emacs@gnu.org; Fri, 24 Dec 2021 16:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Dec 2021 21:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52773 X-GNU-PR-Package: emacs Original-Received: via spool by 52773-submit@debbugs.gnu.org id=B52773.16403798097413 (code B ref 52773); Fri, 24 Dec 2021 21:04:02 +0000 Original-Received: (at 52773) by debbugs.gnu.org; 24 Dec 2021 21:03:29 +0000 Original-Received: from localhost ([127.0.0.1]:38132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n0rir-0001vU-Hy for submit@debbugs.gnu.org; Fri, 24 Dec 2021 16:03:29 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:36427 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1n0rin-0001vD-Kt for 52773@debbugs.gnu.org; Fri, 24 Dec 2021 16:03:28 -0500 Original-Received: (qmail 58030 invoked by uid 3782); 24 Dec 2021 21:03:18 -0000 Original-Received: from acm.muc.de (p4fe1590f.dip0.t-ipconnect.de [79.225.89.15]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 24 Dec 2021 22:03:18 +0100 Original-Received: (qmail 2356 invoked by uid 1000); 24 Dec 2021 21:03:17 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:223070 Archived-At: Hello, Andrea. On Fri, Dec 24, 2021 at 13:18:13 +0000, Andrea Corallo wrote: > Alan Mackenzie writes: > > Hello, Emacs and Andrea. > > With a native compiled recent master branch, do: > > emacs -Q > > M-x locate-library files > > The result in the echo area is something like: > > Library is file ~/emacs/emacs.git/sub-master-5/lisp/files.el > > ^^^ > > .. This is wrong. The Emacs is _NOT_ running uncompiled Lisp, it's > > running native compiled files. The reply should be a file name ending > > in ".eln". > > This problem is surely also in the emacs-28 branch. > > ######################################################################### > > The cause of the problem is in `locate-file' in files.el. There, if a > > ..eln file is found, it's corresponding .el source is looked up in a hash > > table, and the .el name returned instead. > > This mechanism was inserted by the following patch: > > commit 3224a443060a5f21bb910064fc06fe4432810355 > > Author: Andrea Corallo > > Date: Sun Jul 19 10:46:24 2020 +0200 > > Move eln files into dedicated cache directories > > When loading a elc file search for a corresponding eln one into > > `comp-eln-load-path' directories and load it if available. > > `comp-eln-load-path' contains by default two directory (user and > > system one). > > It seems there is some use case for which returning the .el file name in > > place of the .eln is appropriate. It isn't appropriate for > > locate-library. > > I would suggest moving the hash table mechanism out of locate-file, and > > into the other function which calls locate-file, where the substitution > > is wanted. > [resending as the mail was rejected by bug-gnu-emacs@debbugs.gnu.org] Apologies for the non-sensical address. > Hi Alan, > The trouble in this area is that `locate-library' might be used by > existing programs to obtain the source file (.elc files are tipically in > the same directory where the corresponding .el are). Are you saying that programs obtain the path of the .elc file, then expect to get the source file by removing the "c" at the end? Possibly something similar for .eln files? > This was the big trouble also for `load-file-name' and that's why we had > to add `load-true-file-name', all other solution caused unacceptable > incompatibilities with existing software. But it's broken locate-library. The doc string states clearly that this function "show[s] the PRECISE file name of Emacs library LIBRARY". Currently, the function doesn't do this. This was a nuisance for me yesterday and today, when I was trying to find out whether a particular Lisp file was .el, .elc, or .eln. I needed to use the workaround of C-h v on load-history. > AFAIR `locate-library' had the same exact issue. > Best Regards > Andrea -- Alan Mackenzie (Nuremberg, Germany).