From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59507: 29.0.50; Autoloads generation hangs on Windows and Emacs 29 Date: Sat, 26 Nov 2022 13:01:29 +0200 Message-ID: <83bkout1x2.fsf@gnu.org> References: <837czlzqou.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33763"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59507@debbugs.gnu.org To: Denys Mentiei Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 26 12:02:21 2022 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 1oyswv-0008Zy-5k for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Nov 2022 12:02:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyswe-0006Pq-T3; Sat, 26 Nov 2022 06:02:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oyswc-0006Pf-QX for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2022 06:02:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyswc-0006WW-He for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2022 06:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oyswc-0005KP-2U for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2022 06:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Nov 2022 11:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59507 X-GNU-PR-Package: emacs Original-Received: via spool by 59507-submit@debbugs.gnu.org id=B59507.166946048320436 (code B ref 59507); Sat, 26 Nov 2022 11:02:02 +0000 Original-Received: (at 59507) by debbugs.gnu.org; 26 Nov 2022 11:01:23 +0000 Original-Received: from localhost ([127.0.0.1]:37958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oysvy-0005JW-Ku for submit@debbugs.gnu.org; Sat, 26 Nov 2022 06:01:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oysvn-0005J9-P0 for 59507@debbugs.gnu.org; Sat, 26 Nov 2022 06:01:21 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oysvh-0006Rm-Kx; Sat, 26 Nov 2022 06:01:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=umLgtu6+PrvZZVr5s2i69kh8XYDK116F6WZTXIN966s=; b=WRRSI8oINm/e HMVDOH9wUvgKdaEiDc0kOT1uOBLmfhqAQVzDcgRBHPhtFaMnz4QRNiemdS+D6A4AcChYLjhdf3nZk 41/5maxvWPSttmHpqrHSGCAaycS/JBR/2fArHc/qF/ZJd1AY3zjrK+/FHoYkvi7rww2KR9Io1ROfk gifk9gaqbF/XchxYYm9ZbuAUikKTHMOUwm5HnNYsVBns2YFiWljjZOHx77nurGeEEe/zVGHZiQr91 XK1ZIBk/j4xu2t6GpCVIKQ5NGW/OKGPY0TmYXAzazNljta4QS0QbRY3/TISNY7Yp+uiM8P0V60NlZ hDfVDFz9fsctzOxZPpqwJw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oysvg-0002oN-R3; Sat, 26 Nov 2022 06:01:05 -0500 In-Reply-To: (message from Denys Mentiei on Wed, 23 Nov 2022 19:36:12 +0000) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249069 Archived-At: > From: Denys Mentiei > CC: "59507@debbugs.gnu.org" <59507@debbugs.gnu.org> > Date: Wed, 23 Nov 2022 19:36:12 +0000 > > > I may be missing something, but I fail to see the difference between a > > Windows file name starting with "C:/" and a Unix file name starting with > > "/", as far as that function is concerned. Either they both work or they > > both fail in the same way, because (file-name-directory "/") returns "/". > > Indeed! That is just the use case I describe further was caught on Windows. > > > So do you have a real-life recipe where loaddefs-generate--file-load-name is > > called and infloops? Can you show such a recipe, preferably in "emacs -Q"? > > So, this happened for me when installing a package via Straight.el. > Under the hood it invokes autoloads generation, which can be seen in the > following backtrace: > > loaddefs-generate--file-load-name > ("c:/Users/d/AppData/Roaming/.emacs.d/straight/build/bind-key/bind-key.el" > "d:/dotfiles/.emacs.d/straight/build/bind-key/bind-key-autoloads.el") Thanks, I think I see the problem now. Please try the patch below, which I just installed on the master branch of the Emacs Git repository: diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index ecc5f7e..2dd0417 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -108,21 +108,26 @@ loaddefs-generate--file-load-name (let* ((name (file-relative-name file (file-name-directory outfile))) (names '()) (dir (file-name-directory outfile))) - ;; If `name' has directory components, only keep the - ;; last few that are really needed. - (while name - (setq name (directory-file-name name)) - (push (file-name-nondirectory name) names) - (setq name (file-name-directory name))) - (while (not name) - (cond - ((null (cdr names)) (setq name (car names))) - ((file-exists-p (expand-file-name "subdirs.el" dir)) - ;; FIXME: here we only check the existence of subdirs.el, - ;; without checking its content. This makes it generate wrong load - ;; names for cases like lisp/term which is not added to load-path. - (setq dir (expand-file-name (pop names) dir))) - (t (setq name (mapconcat #'identity names "/"))))) + ;; If `name' lives inside an ancestor directory of OUTFILE, only + ;; keep the last few leading directories that are really needed. + ;; (It will always live in an ancestor directory of OUTFILE on + ;; Posix systems, but on DOS/Windows it could not be, if FILE and + ;; OUTFILE are on different drives.) + (when (not (file-name-absolute-p name)) + (while name + (setq name (directory-file-name name)) + (push (file-name-nondirectory name) names) + (setq name (file-name-directory name))) + (while (not name) + (cond + ((null (cdr names)) (setq name (car names))) + ((file-exists-p (expand-file-name "subdirs.el" dir)) + ;; FIXME: here we only check the existence of subdirs.el, + ;; without checking its content. This makes it generate + ;; wrong load names for cases like lisp/term which is not + ;; added to load-path. + (setq dir (expand-file-name (pop names) dir))) + (t (setq name (mapconcat #'identity names "/")))))) (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name) (substring name 0 (match-beginning 0)) name)))