GNU bug report logs - #78929
31.0.50; ffap does not find the correct filename in remote projects

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Mon, 30 Jun 2025 14:48:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 78929 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78929; Package emacs. (Mon, 30 Jun 2025 14:48:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Liu Hui <liuhui1610 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Jun 2025 14:48:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; ffap does not find the correct filename in remote projects
Date: Mon, 30 Jun 2025 22:47:10 +0800
Hi,

The following recipe is extracted from bug#78925:

1. emacs -Q
2. Open a file in a remote project:
   C-x C-f /ssh:server:~/a_git_project/test_file
3. Create a file that exists outside the project in the remote host, e.g.
   M-! touch /tmp/abc
4. type the above filename (i.e. /tmp/abc) in test_file, and M-x ffap

ffap prompts /ssh:server:~/a_git_project/tmp/abc, while in Emacs 29
prompts /ssh:server:/tmp/abc correctly. This problem seems to be
related to commit 1eae0e7edf4.

Thanks.

--
Liu Hui




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78929; Package emacs. (Mon, 30 Jun 2025 15:39:02 GMT) Full text and rfc822 format available.

Message #8 received at 78929 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>,
 Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 78929 <at> debbugs.gnu.org
Subject: Re: bug#78929: 31.0.50;
 ffap does not find the correct filename in remote projects
Date: Mon, 30 Jun 2025 18:37:22 +0300
> From: Liu Hui <liuhui1610 <at> gmail.com>
> Date: Mon, 30 Jun 2025 22:47:10 +0800
> 
> Hi,
> 
> The following recipe is extracted from bug#78925:
> 
> 1. emacs -Q
> 2. Open a file in a remote project:
>    C-x C-f /ssh:server:~/a_git_project/test_file
> 3. Create a file that exists outside the project in the remote host, e.g.
>    M-! touch /tmp/abc
> 4. type the above filename (i.e. /tmp/abc) in test_file, and M-x ffap
> 
> ffap prompts /ssh:server:~/a_git_project/tmp/abc, while in Emacs 29
> prompts /ssh:server:/tmp/abc correctly. This problem seems to be
> related to commit 1eae0e7edf4.

Spencer, could you please look into this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78929; Package emacs. (Thu, 03 Jul 2025 18:03:02 GMT) Full text and rfc822 format available.

Message #11 received at 78929 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Liu Hui <liuhui1610 <at> gmail.com>, 78929 <at> debbugs.gnu.org
Subject: Re: bug#78929: 31.0.50; ffap does not find the correct filename in
 remote projects
Date: Thu, 03 Jul 2025 14:02:21 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Liu Hui <liuhui1610 <at> gmail.com>
>> Date: Mon, 30 Jun 2025 22:47:10 +0800
>> 
>> Hi,
>> 
>> The following recipe is extracted from bug#78925:
>> 
>> 1. emacs -Q
>> 2. Open a file in a remote project:
>>    C-x C-f /ssh:server:~/a_git_project/test_file
>> 3. Create a file that exists outside the project in the remote host, e.g.
>>    M-! touch /tmp/abc
>> 4. type the above filename (i.e. /tmp/abc) in test_file, and M-x ffap
>> 
>> ffap prompts /ssh:server:~/a_git_project/tmp/abc, while in Emacs 29
>> prompts /ssh:server:/tmp/abc correctly. This problem seems to be
>> related to commit 1eae0e7edf4.
>
> Spencer, could you please look into this?

Thanks for the report, this is indeed a bug in ffap-in-project.  This
should be fixed by the attached patch, could you please test?

[0001-Fix-ffap-in-project-to-check-file-existence.patch (text/x-patch, inline)]
From 3d6b886fb8d9f30ec72950e969427925299d3c8e Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Thu, 3 Jul 2025 13:59:46 -0400
Subject: [PATCH] Fix ffap-in-project to check file existence

* lisp/ffap.el (ffap-in-project): Check file existence before
returning non-nil. (bug#78929)
---
 lisp/ffap.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ffap.el b/lisp/ffap.el
index 1c9f0294601..10afcd9514a 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -807,7 +807,9 @@ ffap-completable
 (declare-function project-root "project" (project))
 (defun ffap-in-project (name)
   (when-let* ((project (project-current)))
-    (file-name-concat (project-root project) name)))
+    (ffap-file-exists-string
+     (file-name-concat (project-root project) name)
+     'nomodify)))
 
 (defun ffap-home (name) (ffap-locate-file name t '("~")))
 
-- 
2.39.3


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78929; Package emacs. (Fri, 04 Jul 2025 04:56:02 GMT) Full text and rfc822 format available.

Message #14 received at 78929 <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 78929 <at> debbugs.gnu.org
Subject: Re: bug#78929: 31.0.50; ffap does not find the correct filename in
 remote projects
Date: Fri, 4 Jul 2025 12:54:55 +0800
On Fri, Jul 4, 2025 at 2:02 AM Spencer Baugh <sbaugh <at> janestreet.com> wrote:
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> From: Liu Hui <liuhui1610 <at> gmail.com>
> >> Date: Mon, 30 Jun 2025 22:47:10 +0800
> >>
> >> Hi,
> >>
> >> The following recipe is extracted from bug#78925:
> >>
> >> 1. emacs -Q
> >> 2. Open a file in a remote project:
> >>    C-x C-f /ssh:server:~/a_git_project/test_file
> >> 3. Create a file that exists outside the project in the remote host, e.g.
> >>    M-! touch /tmp/abc
> >> 4. type the above filename (i.e. /tmp/abc) in test_file, and M-x ffap
> >>
> >> ffap prompts /ssh:server:~/a_git_project/tmp/abc, while in Emacs 29
> >> prompts /ssh:server:/tmp/abc correctly. This problem seems to be
> >> related to commit 1eae0e7edf4.
> >
> > Spencer, could you please look into this?
>
> Thanks for the report, this is indeed a bug in ffap-in-project.  This
> should be fixed by the attached patch, could you please test?

I confirm the issue is fixed, thanks!




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 05 Jul 2025 09:22:02 GMT) Full text and rfc822 format available.

Notification sent to Liu Hui <liuhui1610 <at> gmail.com>:
bug acknowledged by developer. (Sat, 05 Jul 2025 09:22:02 GMT) Full text and rfc822 format available.

Message #19 received at 78929-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: sbaugh <at> janestreet.com, 78929-done <at> debbugs.gnu.org
Subject: Re: bug#78929: 31.0.50; ffap does not find the correct filename in
 remote projects
Date: Sat, 05 Jul 2025 12:20:44 +0300
> From: Liu Hui <liuhui1610 <at> gmail.com>
> Date: Fri, 4 Jul 2025 12:54:55 +0800
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 78929 <at> debbugs.gnu.org
> 
> On Fri, Jul 4, 2025 at 2:02 AM Spencer Baugh <sbaugh <at> janestreet.com> wrote:
> >
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> >
> > >> From: Liu Hui <liuhui1610 <at> gmail.com>
> > >> Date: Mon, 30 Jun 2025 22:47:10 +0800
> > >>
> > >> Hi,
> > >>
> > >> The following recipe is extracted from bug#78925:
> > >>
> > >> 1. emacs -Q
> > >> 2. Open a file in a remote project:
> > >>    C-x C-f /ssh:server:~/a_git_project/test_file
> > >> 3. Create a file that exists outside the project in the remote host, e.g.
> > >>    M-! touch /tmp/abc
> > >> 4. type the above filename (i.e. /tmp/abc) in test_file, and M-x ffap
> > >>
> > >> ffap prompts /ssh:server:~/a_git_project/tmp/abc, while in Emacs 29
> > >> prompts /ssh:server:/tmp/abc correctly. This problem seems to be
> > >> related to commit 1eae0e7edf4.
> > >
> > > Spencer, could you please look into this?
> >
> > Thanks for the report, this is indeed a bug in ffap-in-project.  This
> > should be fixed by the attached patch, could you please test?
> 
> I confirm the issue is fixed, thanks!

Thanks, installed on the master branch, and closing the bug.




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.