From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#36502: Fwd: bug#36502: 27.0.50; infinite loop in file-name-case-insensitive-p Date: Mon, 08 Jul 2019 20:23:21 +0300 Message-ID: <83zhlo5tkm.fsf@gnu.org> References: <7fa570d6-74a7-56d0-af9e-48ade20551b8@cornell.edu> <87muhr47k5.fsf@gmail.com> <837e8v87jf.fsf@gnu.org> <2ffa1b04-e667-f708-1047-d5fc38e72787@cornell.edu> <83v9wd7vwi.fsf@gnu.org> <14115c87-c1e7-6f3d-2694-106a9d4c8706@cornell.edu> <83bly47lxk.fsf@gnu.org> <837e8s7hk4.fsf@gnu.org> <2f71c7a3-423c-4a36-a0c2-5c1833905a28@cornell.edu> <2f15cf80-feba-3e71-4cbf-a7fa25b43797@cornell.edu> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="33310"; mail-complaints-to="usenet@blaine.gmane.org" Cc: dan@dpsutton.com, npostavs@gmail.com, 36502@debbugs.gnu.org, schwab@suse.de To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 08 19:24:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hkXN7-0008Xp-80 for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Jul 2019 19:24:13 +0200 Original-Received: from localhost ([::1]:43498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkXN5-0006c9-KA for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Jul 2019 13:24:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33366) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkXN0-0006bq-9k for bug-gnu-emacs@gnu.org; Mon, 08 Jul 2019 13:24:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkXMy-0006WB-4q for bug-gnu-emacs@gnu.org; Mon, 08 Jul 2019 13:24:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50593) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hkXMw-0006Uy-IU for bug-gnu-emacs@gnu.org; Mon, 08 Jul 2019 13:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hkXMw-0004b7-Dc for bug-gnu-emacs@gnu.org; Mon, 08 Jul 2019 13:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Jul 2019 17:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36502 X-GNU-PR-Package: emacs Original-Received: via spool by 36502-submit@debbugs.gnu.org id=B36502.156260662617648 (code B ref 36502); Mon, 08 Jul 2019 17:24:02 +0000 Original-Received: (at 36502) by debbugs.gnu.org; 8 Jul 2019 17:23:46 +0000 Original-Received: from localhost ([127.0.0.1]:59414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkXMg-0004aa-6Y for submit@debbugs.gnu.org; Mon, 08 Jul 2019 13:23:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49121) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkXMe-0004aM-3u for 36502@debbugs.gnu.org; Mon, 08 Jul 2019 13:23:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:32970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hkXMY-0006IC-9k; Mon, 08 Jul 2019 13:23:38 -0400 Original-Received: from [176.228.60.248] (port=4296 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hkXMX-0000HK-No; Mon, 08 Jul 2019 13:23:38 -0400 In-reply-to: <2f15cf80-feba-3e71-4cbf-a7fa25b43797@cornell.edu> (message from Ken Brown on Mon, 8 Jul 2019 16:44:23 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:162344 Archived-At: > From: Ken Brown > CC: "dan@dpsutton.com" , "36502@debbugs.gnu.org" > <36502@debbugs.gnu.org>, "npostavs@gmail.com" , Andreas > Schwab > Date: Mon, 8 Jul 2019 16:44:23 +0000 > > --- a/src/fileio.c > +++ b/src/fileio.c > @@ -804,7 +804,22 @@ DEFUN ("expand-file-name", Fexpand_file_name, > Sexpand_file_name, 1, 2, 0, > > /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ > if (NILP (default_directory)) > - default_directory = BVAR (current_buffer, directory); > + { > + Lisp_Object dir = BVAR (current_buffer, directory); > + /* The buffer's default-directory should be absolute. If it > + isn't, try to expand it relative to invocation-directory. > + But we have to be careful to avoid an infinite loop, because > + the code in emacs.c that sets Vinvocation_directory might > + call Fexpand_file_name. */ > + if (STRINGP (dir)) > + { > + if (!NILP (Ffile_name_absolute_p (dir))) > + default_directory = dir; > + else if (STRINGP (Vinvocation_directory) > + && !NILP (Ffile_name_absolute_p (Vinvocation_directory))) > + default_directory = Fexpand_file_name (dir, Vinvocation_directory); > + } > + } > if (! STRINGP (default_directory)) > { > #ifdef DOS_NT LGTM, thanks. Can we have a test for this subtle use case, so that we never regress?