GNU bug report logs - #13304
[PATCH] full-path gud breakpoints now don't get confused by tramp

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Sat, 29 Dec 2012 11:02:02 UTC

Severity: normal

Tags: patch

Done: Dima Kogan <dima <at> secretsauce.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13304 in the body.
You can then email your comments to 13304 AT debbugs.gnu.org in the normal way.

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#13304; Package emacs. (Sat, 29 Dec 2012 11:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 29 Dec 2012 11:02:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] full-path gud breakpoints now don't get confused by tramp
Date: Sat, 29 Dec 2012 03:00:11 -0800
[Message part 1 (text/plain, inline)]
This patch fixes a bug I hit when remotely-debugging a python program
with gud through tramp. If I tried to set a breakpoint from the source
buffer, the python debugger would be given the full path to the file,
tramp fields and all. This made it impossible to set breakpoints in this
manner.

Attached is a patch that strips out the remote pieces of the path when
communicating with the backend debugger.


[0001-full-path-gud-breakpoints-now-don-t-get-confused-by-.patch (text/x-diff, inline)]
From 3bfe6f560a8c6f96ef0ed9200015bab0d29235c9 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
Date: Sat, 29 Dec 2012 02:54:40 -0800
Subject: [PATCH] full-path gud breakpoints now don't get confused by tramp

prior to this patch if gud used a path to set a breakpoint, the FULL
path would be sent to the backend debugger, including the tramp
pieces. The backends don't know anything about tramp, so they were
naturally confused by this. Most notably, it was impossible to set
from-source breakpoints in pdb, the python debugger.
---
 lisp/progmodes/gud.el |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 13eac83..45e0ddf 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -2743,6 +2743,11 @@ Obeying it means displaying in another window the specified file and line."
 (defun gud-format-command (str arg)
   (let ((insource (not (eq (current-buffer) gud-comint-buffer)))
 	(frame (or gud-last-frame gud-last-last-frame))
+	(buffer-file-name-localized
+	 (if (and (buffer-file-name) (file-remote-p (buffer-file-name)))
+	     (tramp-file-name-localname (tramp-dissect-file-name
+					 (buffer-file-name) t))
+	   (buffer-file-name)))
 	result)
     (while (and str
 		(let ((case-fold-search nil))
@@ -2752,15 +2757,15 @@ Obeying it means displaying in another window the specified file and line."
 	(cond
 	 ((eq key ?f)
 	  (setq subst (file-name-nondirectory (if insource
-						  (buffer-file-name)
+						  buffer-file-name-localized
 						(car frame)))))
 	 ((eq key ?F)
 	  (setq subst (file-name-base (if insource
-                                          (buffer-file-name)
+                                          buffer-file-name-localized
                                         (car frame)))))
 	 ((eq key ?d)
 	  (setq subst (file-name-directory (if insource
-					       (buffer-file-name)
+					       buffer-file-name-localized
 					     (car frame)))))
 	 ((eq key ?l)
 	  (setq subst (int-to-string
-- 
1.7.10.4


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13304; Package emacs. (Sat, 29 Dec 2012 20:25:01 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: 13304 <at> debbugs.gnu.org
Subject: Re: bug#13304: Acknowledgement ([PATCH] full-path gud breakpoints
	now don't get confused by tramp)
Date: Sat, 29 Dec 2012 12:23:21 -0800
Here's a recipe to reproduce the bug as it was. Note that I'm on an amd64 linux
box.

1. Create a new python program. I put it in /tmp/tst.py with these contents:

#!/usr/bin/python
print("hi")


2. Run pdb on this file via tramp. I did this:

M-x pdb     pdb /127.0.0.1:/tmp/tst.py

This launches pdb and opens the remote /tmp/tst.py



3. Now navigate to the print("hi") line, and do C-x SPC. This is supposed to set
a breakpoint there, but it doesn't work. If it did, pdb would say "Breakpoint 1
at /tmp/tst.py:2". Instead it says "End of file". The command being sent to the
pdb backend is

break /scpc:127.0.0.1:/tmp/tst.py:2

but it should be

break /tmp/tst.py:2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13304; Package emacs. (Mon, 31 Dec 2012 15:44:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 13304 <at> debbugs.gnu.org
Subject: Re: bug#13304: [PATCH] full-path gud breakpoints now don't get
	confused by tramp
Date: Mon, 31 Dec 2012 16:41:42 +0100
Dima Kogan <dima <at> secretsauce.net> writes:

> +	     (tramp-file-name-localname (tramp-dissect-file-name
> +					 (buffer-file-name) t))

Don't use Tramp internal functions, they are not documented by
intention. You could use instead

(file-remote-p (buffer-file-name) 'localname)

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13304; Package emacs. (Mon, 31 Dec 2012 19:57:01 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 13304 <at> debbugs.gnu.org
Subject: Re: bug#13304: [PATCH] full-path gud breakpoints now don't get
	confused by tramp
Date: Mon, 31 Dec 2012 11:53:13 -0800
[Message part 1 (text/plain, inline)]
> On Mon, 31 Dec 2012 16:41:42 +0100
> Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Dima Kogan <dima <at> secretsauce.net> writes:
> 
> > +	     (tramp-file-name-localname (tramp-dissect-file-name
> > +					 (buffer-file-name) t))
> 
> Don't use Tramp internal functions, they are not documented by
> intention. You could use instead
> 
> (file-remote-p (buffer-file-name) 'localname)

Great point; this is really much better. I'm attaching an updated patch.
[0001-full-path-gud-breakpoints-now-don-t-get-confused-by-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13304; Package emacs. (Mon, 21 Sep 2015 02:38:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: 13304 <at> debbugs.gnu.org
Subject: ping
Date: Sun, 20 Sep 2015 19:37:38 -0700
Hi. This is a gentle ping. This patch is useful and fixes a real bug.
Can somebody please take a look and maybe merge it? Thanks!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13304; Package emacs. (Mon, 21 Sep 2015 10:57:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 13304 <at> debbugs.gnu.org
Subject: Re: bug#13304: ping
Date: Mon, 21 Sep 2015 13:56:09 +0300
> From: Dima Kogan <dima <at> secretsauce.net>
> Date: Sun, 20 Sep 2015 19:37:38 -0700
> 
> Hi. This is a gentle ping. This patch is useful and fixes a real bug.
> Can somebody please take a look and maybe merge it? Thanks!

Thanks, pushed.

Should we close the bug now?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13304; Package emacs. (Mon, 21 Sep 2015 18:37:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <lists <at> dima.secretsauce.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 13304 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: master 127bafd: Fix setting breakpoints when remote-debugging
Date: Mon, 21 Sep 2015 11:35:59 -0700
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
>> index 9ab0667..8b5d490 100644
>> --- a/lisp/progmodes/gud.el
>> +++ b/lisp/progmodes/gud.el
>> @@ -2855,6 +2855,11 @@ Obeying it means displaying in another window the specified file and line."
>>  (defun gud-format-command (str arg)
>>    (let ((insource (not (eq (current-buffer) gud-comint-buffer)))
>>  	(frame (or gud-last-frame gud-last-last-frame))
>> +	(buffer-file-name-localized
>> +	 (if (and (buffer-file-name) (file-remote-p (buffer-file-name)))
>> +	     (tramp-file-name-localname (tramp-dissect-file-name
>> +					 (buffer-file-name) t))
>> +	   (buffer-file-name)))
>
> Better would be
>
> (buffer-file-name-localized
>  (and (buffer-file-name)
>       (or (file-remote-p (buffer-file-name) 'localname)
>           (buffer-file-name))))
>
> Tramp internal function calls shall be avoided.

Hi. Yes, you mentioned that in the bug report (13304), and I updated the
patch in the bug report. Eli committed the older version of the patch by
mistake, however.




Reply sent to Dima Kogan <dima <at> secretsauce.net>:
You have taken responsibility. (Mon, 21 Sep 2015 18:39:01 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dima <at> secretsauce.net>:
bug acknowledged by developer. (Mon, 21 Sep 2015 18:39:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13304-done <at> debbugs.gnu.org
Subject: Re: bug#13304: ping
Date: Mon, 21 Sep 2015 11:38:16 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, pushed.
>
> Should we close the bug now?

Thanks for doing that. You accidentally pushed the original patch, the
one from before I addressed Michael's comments, so it might be good to
update the tree with the later patch. In any case, I'm closing the bug.
Thanks again.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 20 Oct 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 246 days ago.

Previous Next


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