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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 17 Jul 2025 10:47:53 +0300

> From: Michael Albinus <[email-masked]>
> Cc: Liu Hui <[email-masked]>,  [email-masked]
> Date: Thu, 17 Jul 2025 08:47:08 +0200
> 
> >> 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
> >
> > Shouldn't this code use 'expand-file-name' instead?  Using 'concat' to
> > construct file names is a bug waiting to happen, IME.
> 
> `expand-file-name' wouldn't work if file-name is an absolute file name.

I guess I'm missing something: doesn't this code want to produce an
absolute file name?  If not, what does it try to do?

> `file-remote-p' is designed to cooperate with `concat'. It mentions it
> in its docstring.

So you agree with the patch?  It looks strange to me that we should
use file-remote-p in the branch where it is known that FILE-NAME is
not a remote file name.