GNU bug report logs - #79036
[PATCH] Fix pdb tracking for remote filenames

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Liu Hui <liuhui1610@HIDDEN>; Keywords: patch; dated Thu, 17 Jul 2025 04:59:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79036 <at> debbugs.gnu.org:


Received: (at 79036) by debbugs.gnu.org; 17 Jul 2025 06:42:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 17 02:42:12 2025
Received: from localhost ([127.0.0.1]:52687 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ucIJn-0003dT-OU
	for submit <at> debbugs.gnu.org; Thu, 17 Jul 2025 02:42:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49368)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1ucIJk-0003d7-It
 for 79036 <at> debbugs.gnu.org; Thu, 17 Jul 2025 02:42:09 -0400
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 <eliz@HIDDEN>)
 id 1ucIJf-0001cg-0p; Thu, 17 Jul 2025 02:42:03 -0400
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=H1Dsv4hrDp9CW3YdNG5Ny+26fGrP8wI9inqR5MVSXKs=; b=Gt9hrG1Jj+DU
 Gd0EW/k7lAHKJBFhcp8tuCYlHOtxq5gRPZ7X8S4y3GtrHAf9Gfp9d5fDJw/pTmgjKOQa65Ep6UbNC
 mhbZmzVlYmiXzBvOW1F4SLRR3Rnkszuz25dDQYPA17+ek0kQi9ZxsIkW+p9rDODa+xohVhncKvgQa
 tVup6h5qPrtwU676goEPYtQTJ8SJ+SVfYUX2Aa8635lFCzpmaQv1eFshIrBstT2r0wNT2UA4egXQx
 lUSEW3roKdRrHFmDnEfUolrdcKbDsO5ltuQstYC2cQtbEZ1uBABa+gBE/FAwhKxNLNJEgXhsuaA3u
 vxSep6wNwqWD67vELI4g2Q==;
Date: Thu, 17 Jul 2025 09:41:44 +0300
Message-Id: <86tt3bgvyv.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Liu Hui <liuhui1610@HIDDEN>, Michael Albinus <michael.albinus@HIDDEN>
In-Reply-To: <CAOQTW-PG9jtZfQpQ3dPeMfksewV7UxX-M0R+M6gg20RXSDPRFw@HIDDEN>
 (message from Liu Hui on Thu, 17 Jul 2025 12:57:45 +0800)
Subject: Re: bug#79036: [PATCH] Fix pdb tracking for remote filenames
References: <CAOQTW-PG9jtZfQpQ3dPeMfksewV7UxX-M0R+M6gg20RXSDPRFw@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79036
Cc: 79036 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Liu Hui <liuhui1610@HIDDEN>
> Date: Thu, 17 Jul 2025 12:57:45 +0800
> 
> 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.
> 
> From b9770cea20186d0205319efb54327099849e3a21 Mon Sep 17 00:00:00 2001
> From: Liu Hui <liuhui1610@HIDDEN>
> 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

Shouldn't this code use 'expand-file-name' instead?  Using 'concat' to
construct file names is a bug waiting to happen, IME.

Michael, WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79036; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Jul 2025 04:58:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 17 00:58:11 2025
Received: from localhost ([127.0.0.1]:52355 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ucGh9-0005Wh-GC
	for submit <at> debbugs.gnu.org; Thu, 17 Jul 2025 00:58:11 -0400
Received: from lists.gnu.org ([2001:470:142::17]:47902)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <liuhui1610@HIDDEN>)
 id 1ucGh5-0005W8-OW
 for submit <at> debbugs.gnu.org; Thu, 17 Jul 2025 00:58:09 -0400
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 <liuhui1610@HIDDEN>)
 id 1ucGgy-0003Ck-QZ
 for bug-gnu-emacs@HIDDEN; Thu, 17 Jul 2025 00:58:00 -0400
Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <liuhui1610@HIDDEN>)
 id 1ucGgx-0003Tr-2c
 for bug-gnu-emacs@HIDDEN; Thu, 17 Jul 2025 00:58:00 -0400
Received: by mail-wr1-x42a.google.com with SMTP id
 ffacd0b85a97d-3a5257748e1so323807f8f.2
 for <bug-gnu-emacs@HIDDEN>; Wed, 16 Jul 2025 21:57:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1752728277; x=1753333077; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ixKc3kHuk+7yvt4LF4baBETskrt7woNH73nKURCZCPE=;
 b=Em2jrOQ/2d2sZhxKc/0BId1MTs04v7BNFJUVvecU/SLQfZlLDY+JlXKzslLm2K2fwO
 4/MjsaVeRqp/YBZTJVvx+XYuh++fK7Dvj+Qq28VQJxGuxBkIfGvi4EIMrWXmd0pD+I7W
 cwLsXXBAHdZACAxvdzSGe76jv4E5n3/z4Axn6rJ6ueLoO/PsssUWaWMuG+1MVPk1xDBi
 kfLlwTRkAr+CF74IiaHJNzLsRL3Q/o1hQLxlZYyICRvhokLA0vuGhNOCEPdgebK96h2s
 e0lEzBmFplf5/DcrcJTmiskmAyGnwAxPICVk/s2VRUtXVENTfALuPigCNe51Ta0MCpzu
 rHOw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1752728277; x=1753333077;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ixKc3kHuk+7yvt4LF4baBETskrt7woNH73nKURCZCPE=;
 b=QpvcAJZwW05d3lipCGoMI8CnYkF45QRX/eiZj2+a8EqLlq74Dzbgrdgv6LD0utXwm4
 IljM0Xy8r5/bfH+yS/269lIBlOCix94no6d8SLtew8X83i+4xHEJa5pyxOEdttN/O7rQ
 1pl6PPv7W76k161xyOTwm9EJUoNd2F1xC31Hx4d4qHQ8+eXSMXtXLN86lAKjahNFEiYh
 6SkdYxTLUtEaNefkrOEdTzSUeZeTDxCy5sajaaE3yTbwL48jPa4HzXQQpifNGpgypdMZ
 xtEXHhyS9ueWF3bhNiM1HwzH/hyLUgZpOXEdKSZZnDKs6rak/46RO2e8i3BMknHk92ZO
 +B0g==
X-Gm-Message-State: AOJu0YyBxhCzN0H12GiNqkEGli/7vo+jKDgHIHmngD3P5oonNODRS+es
 +oX/Qzwa3BCPa9fZuZI3i3ENHpZZVn9B7ZTRkgQo++Iy5bOIRWvH9UuWvpSynZLQu63DYXzaQe9
 xdCfuwcENIN6ey4d/mnms29XQZNgLDhDVfA9GUI8=
X-Gm-Gg: ASbGnct9Vpp4f/j+OFy7gXIYekW54ifLwYtEc0K5LZ4O/EukBRplLJDr64sCsru4sns
 VRfcbKIgNJRzYr3dw7ddn+LjGPKN2dlYEQtpRiR30UGWtY45fXxPWiu4gt4CRmp11wolz6DleVC
 y/+Y+A7LY7IR2c4nGsl1Mnu9pWtyrl7cvFWPVeS5ZKaZaGeQGse4B8M2WvUfSpZnLdwWWfMdYDi
 0ygBL0=
X-Google-Smtp-Source: AGHT+IHgN+kwMCA7fzBPeQKW2SOLsxffowl/xacyvkHtrZOBZMorbDmXNPdhyqQZKKxDKRrZjOYstgnemQ7iEe139XM=
X-Received: by 2002:a05:6000:2008:b0:3a5:2b1d:7889 with SMTP id
 ffacd0b85a97d-3b60e53e961mr4053735f8f.43.1752728276629; Wed, 16 Jul 2025
 21:57:56 -0700 (PDT)
MIME-Version: 1.0
From: Liu Hui <liuhui1610@HIDDEN>
Date: Thu, 17 Jul 2025 12:57:45 +0800
X-Gm-Features: Ac12FXxatteT926-RmpO5KHPy3SRoW-yHGINbk9h3vADO3UIk7l2fCFiWWeXvno
Message-ID: <CAOQTW-PG9jtZfQpQ3dPeMfksewV7UxX-M0R+M6gg20RXSDPRFw@HIDDEN>
Subject: [PATCH] Fix pdb tracking for remote filenames
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/mixed; boundary="0000000000005145f6063a18dab5"
Received-SPF: pass client-ip=2a00:1450:4864:20::42a;
 envelope-from=liuhui1610@HIDDEN; helo=mail-wr1-x42a.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  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 se [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (liuhui1610[at]gmail.com)
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (liuhui1610[at]gmail.com)
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

--0000000000005145f6063a18dab5
Content-Type: text/plain; charset="UTF-8"

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

--0000000000005145f6063a18dab5
Content-Type: text/x-patch; charset="US-ASCII"; 
	name="0001-Fix-pdb-tracking-for-remote-filenames.patch"
Content-Disposition: attachment; 
	filename="0001-Fix-pdb-tracking-for-remote-filenames.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_md6x36ew0>
X-Attachment-Id: f_md6x36ew0

RnJvbSBiOTc3MGNlYTIwMTg2ZDAyMDUzMTllZmI1NDMyNzA5OTg0OWUzYTIxIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBMaXUgSHVpIDxsaXVodWkxNjEwQGdtYWlsLmNvbT4KRGF0ZTog
VGh1LCAxNyBKdWwgMjAyNSAxMjo0MzozNCArMDgwMApTdWJqZWN0OiBbUEFUQ0hdIEZpeCBwZGIg
dHJhY2tpbmcgZm9yIHJlbW90ZSBmaWxlbmFtZXMKCiogbGlzcC9wcm9nbW9kZXMvcHl0aG9uLmVs
IChweXRob24tcGRidHJhY2stc2V0LXRyYWNrZWQtYnVmZmVyKToKQ2hlY2sgcmVtb3RlIGZpbGUg
bmFtZXMuCi0tLQogbGlzcC9wcm9nbW9kZXMvcHl0aG9uLmVsIHwgNiArKysrLS0KIDEgZmlsZSBj
aGFuZ2VkLCA0IGluc2VydG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SkKICAgICAodW5sZXNzIGZpbGUtYnVmZmVyCiAgICAg
ICAoY29uZAotLSAKMi4yNS4xCgo=
--0000000000005145f6063a18dab5--




Acknowledgement sent to Liu Hui <liuhui1610@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#79036; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 17 Jul 2025 06:45:01 UTC

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