Subject: bug#79036: closed (Re: bug#79036: [PATCH] Fix pdb tracking for remote filenames)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 07 Aug 2025 14:47:02 +0000

Your bug report

#79036: [PATCH] Fix pdb tracking for remote filenames

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79036: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79036
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79036: [PATCH] Fix pdb tracking for remote filenames
From: Eli Zaretskii <[email-masked]>
To: kobarity <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Thu, 07 Aug 2025 17:46:09 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Thu, 07 Aug 2025 22:52:13 +0900
> From: kobarity <[email-masked]>
> Cc: [email-masked]
> 
> Eli Zaretskii wrote:
> > 
> > > Date: Wed, 06 Aug 2025 23:14:47 +0900
> > > From: kobarity <[email-masked]>
> > > Cc: [email-masked]
> > > 
> > > Attached is the revised patch to fix #79036.
> > 
> > Thanks, now installed on master.
> > 
> > Should we close this bug now, or is there anything else left to do
> > here?
> 
> Thanks.  I think we can close this bug.  It would be best for Liu to
> send a patch as a separate bug ID for the improvement using the buffer
> name.

Thanks, closing.

Subject: [PATCH] Fix pdb tracking for remote filenames
From: Liu Hui <[email-masked]>
To: [email-masked]
Date: Thu, 17 Jul 2025 12:57:45 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

The recipe:

1. emacs -Q
2. Create a remote python file and start the remote python shell, e.g.
   M-x find-file /ssh:server:/tmp/test.py
   M-x run-python
3. Insert the following code in test.py and press C-c C-c to send it
   to the python shell:

   def f():
       breakpoint()
       return 1

4. Execute f() in the python shell to trigger the pdb

Result: Emacs tries to open /ssh:server:/ssh:server:/tmp/test.py
instead of /ssh:server:/tmp/test.py.

The reason is the filename set by python-shell-send-string may be
remote. The attached patch fixes the issue.

--
Liu Hui
From b9770cea20186d0205319efb54327099849e3a21 Mon Sep 17 00:00:00 2001
From: Liu Hui <[email-masked]>
Date: Thu, 17 Jul 2025 12:43:34 +0800
Subject: [PATCH] Fix pdb tracking for remote filenames

* lisp/progmodes/python.el (python-pdbtrack-set-tracked-buffer):
Check remote file names.
---
 lisp/progmodes/python.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f4f0518dbfd..59977fcb49f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5079,8 +5079,10 @@ python-pdbtrack-set-tracked-buffer
   "Set the buffer for FILE-NAME as the tracked buffer.
 Internally it uses the `python-pdbtrack-tracked-buffer' variable.
 Returns the tracked buffer."
-  (let* ((file-name-prospect (concat (file-remote-p default-directory)
-                              file-name))
+  (let* ((file-name-prospect (if (file-remote-p file-name)
+                                 file-name
+                               (concat (file-remote-p default-directory)
+                                       file-name)))
          (file-buffer (get-file-buffer file-name-prospect)))
     (unless file-buffer
       (cond
-- 
2.25.1