GNU bug report logs - #71972
31.0.50; Tramp does not parse ipv6 address with port correctly

Previous Next

Package: emacs;

Reported by: Yikai Zhao <yikai <at> z1k.dev>

Date: Sat, 6 Jul 2024 12:25:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Fixed in version 30.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

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 71972 in the body.
You can then email your comments to 71972 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#71972; Package emacs. (Sat, 06 Jul 2024 12:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yikai Zhao <yikai <at> z1k.dev>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Jul 2024 12:25:02 GMT) Full text and rfc822 format available.

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

From: Yikai Zhao <yikai <at> z1k.dev>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Tramp does not parse ipv6 address with port correctly
Date: Sat, 06 Jul 2024 20:22:05 +0800
To reproduce:

  (tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")

Expected result: the result "port" should be "2202"

Current result: the result "port" is empty

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.22.30, cairo version 1.15.10) of 2024-07-06 built on a40438a00efa
Repository revision: bd86a6c4fde1aa42ea9e8b5434f0cb63f8d52684
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Gentoo Linux





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71972; Package emacs. (Sat, 06 Jul 2024 15:03:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Yikai Zhao <yikai <at> z1k.dev>
Cc: 71972 <at> debbugs.gnu.org
Subject: Re: bug#71972: 31.0.50; Tramp does not parse ipv6 address with port
 correctly
Date: Sat, 06 Jul 2024 17:02:28 +0200
Yikai Zhao <yikai <at> z1k.dev> writes:

Hi,

> To reproduce:
>
>   (tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
>
> Expected result: the result "port" should be "2202"
>
> Current result: the result "port" is empty

Indeed.

--8<---------------cut here---------------start------------->8---
(tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
=> (tramp-file-name "ssh" nil nil "2001::abcd#2202" nil "/tmp/xxx" nil)
--8<---------------cut here---------------end--------------->8---

That is a structure, which has "2001::abcd#2202" as host name. Ouch.

Will see how I could fix it.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71972; Package emacs. (Sat, 06 Jul 2024 17:02:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Yikai Zhao <yikai <at> z1k.dev>
Cc: 71972 <at> debbugs.gnu.org
Subject: Re: bug#71972: 31.0.50; Tramp does not parse ipv6 address with port
 correctly
Date: Sat, 06 Jul 2024 19:00:48 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi,

> (tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
> => (tramp-file-name "ssh" nil nil "2001::abcd#2202" nil "/tmp/xxx" nil)
>
> That is a structure, which has "2001::abcd#2202" as host name. Ouch.
>
> Will see how I could fix it.

Could you please try the appended patch? It ought to fix the problem.

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71972; Package emacs. (Sun, 07 Jul 2024 06:33:02 GMT) Full text and rfc822 format available.

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

From: Yikai Zhao <yikai <at> z1k.dev>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 71972 <at> debbugs.gnu.org
Subject: Re: bug#71972: 31.0.50;
 Tramp does not parse ipv6 address with port correctly
Date: Sun, 7 Jul 2024 14:31:13 +0800
Hi,

Thanks for the patch. However, with this patch applied to master, the result is:

(tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
=> (tramp-file-name "ssh" nil nil #("Oldtown" 0 7 (tramp-default t))
"2202" "/tmp/xxx" nil) [2 times]

("oldtown" is my local hostname). Although the port is correctly
parsed, the host is now incorrect.

Also note that in master, the correct file path for tramp.el is
lisp/net/tramp.el, so I had to manually edit your patch before
applying it. What version is your patch based on? Maybe the result is
different in different versions?

On Sun, Jul 7, 2024 at 1:00 AM Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
> Hi,
>
> > (tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
> > => (tramp-file-name "ssh" nil nil "2001::abcd#2202" nil "/tmp/xxx" nil)
> >
> > That is a structure, which has "2001::abcd#2202" as host name. Ouch.
> >
> > Will see how I could fix it.
>
> Could you please try the appended patch? It ought to fix the problem.
>
> Best regards, Michael.
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71972; Package emacs. (Sun, 07 Jul 2024 10:30:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Yikai Zhao <yikai <at> z1k.dev>
Cc: 71972 <at> debbugs.gnu.org
Subject: Re: bug#71972: 31.0.50; Tramp does not parse ipv6 address with port
 correctly
Date: Sun, 07 Jul 2024 12:28:45 +0200
[Message part 1 (text/plain, inline)]
Yikai Zhao <yikai <at> z1k.dev> writes:

> Hi,

Hi,

> Thanks for the patch. However, with this patch applied to master, the result is:
>
> (tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
> => (tramp-file-name "ssh" nil nil #("Oldtown" 0 7 (tramp-default t))
> "2202" "/tmp/xxx" nil) [2 times]
>
> ("oldtown" is my local hostname). Although the port is correctly
> parsed, the host is now incorrect.

Indeed, we have a race condition. tramp-host-with-port-regexp is defined
before tramp-set-syntax has run.

Could you, please, try the appended patch indeed?

> Also note that in master, the correct file path for tramp.el is
> lisp/net/tramp.el, so I had to manually edit your patch before
> applying it. What version is your patch based on? Maybe the result is
> different in different versions?

I develop in the Tramp git repo. The files are identical with the ones
in the Emacs git repo. However, there is a different directory structure.

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Added tag(s) patch. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Sun, 07 Jul 2024 10:30:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71972; Package emacs. (Sun, 07 Jul 2024 15:59:02 GMT) Full text and rfc822 format available.

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

From: Yikai Zhao <yikai <at> z1k.dev>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 71972 <at> debbugs.gnu.org
Subject: Re: bug#71972: 31.0.50;
 Tramp does not parse ipv6 address with port correctly
Date: Sun, 7 Jul 2024 23:56:56 +0800
Thanks! I can confirm this patch fixes the issue for me.

BTW, is there any chance that this patch would make it into emacs 30 release?


Regards, Yikai

On Sun, Jul 7, 2024 at 6:28 PM Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Yikai Zhao <yikai <at> z1k.dev> writes:
>
> > Hi,
>
> Hi,
>
> > Thanks for the patch. However, with this patch applied to master, the result is:
> >
> > (tramp-dissect-file-name "/ssh:[2001::abcd]#2202:/tmp/xxx")
> > => (tramp-file-name "ssh" nil nil #("Oldtown" 0 7 (tramp-default t))
> > "2202" "/tmp/xxx" nil) [2 times]
> >
> > ("oldtown" is my local hostname). Although the port is correctly
> > parsed, the host is now incorrect.
>
> Indeed, we have a race condition. tramp-host-with-port-regexp is defined
> before tramp-set-syntax has run.
>
> Could you, please, try the appended patch indeed?
>
> > Also note that in master, the correct file path for tramp.el is
> > lisp/net/tramp.el, so I had to manually edit your patch before
> > applying it. What version is your patch based on? Maybe the result is
> > different in different versions?
>
> I develop in the Tramp git repo. The files are identical with the ones
> in the Emacs git repo. However, there is a different directory structure.
>
> Best regards, Michael.
>




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sun, 07 Jul 2024 17:48:02 GMT) Full text and rfc822 format available.

Notification sent to Yikai Zhao <yikai <at> z1k.dev>:
bug acknowledged by developer. (Sun, 07 Jul 2024 17:48:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Yikai Zhao <yikai <at> z1k.dev>
Cc: 71972-done <at> debbugs.gnu.org
Subject: Re: bug#71972: 31.0.50; Tramp does not parse ipv6 address with port
 correctly
Date: Sun, 07 Jul 2024 19:47:36 +0200
Version: 30.1

Yikai Zhao <yikai <at> z1k.dev> writes:

Hi Yikai,

> Thanks! I can confirm this patch fixes the issue for me.

Thanks for the feedback.

> BTW, is there any chance that this patch would make it into emacs 30 release?

Yep. I've pushed the patch to the emacs-30 branch, closing this bug.

> Regards, Yikai

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 05 Aug 2024 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 220 days ago.

Previous Next


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