GNU bug report logs - #38079
On Windows tramp hangs after server-start is called

Previous Next

Package: emacs;

Reported by: Wanrong Lin <wrglin <at> gmail.com>

Date: Wed, 6 Nov 2019 00:54:02 UTC

Severity: normal

Tags: patch

Fixed in version 27.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 38079 in the body.
You can then email your comments to 38079 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#38079; Package emacs. (Wed, 06 Nov 2019 00:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wanrong Lin <wrglin <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 06 Nov 2019 00:54:02 GMT) Full text and rfc822 format available.

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

From: Wanrong Lin <wrglin <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: On Windows tramp hangs after server-start is called
Date: Tue, 5 Nov 2019 19:52:59 -0500
On Windows, after M-x server-start, tramp no longer works. When I tried 
to connect to a "pscp" remote Linux host, it just hangs at the message 
"Remote prompt found" (something like that).

Today I finally figured out what the problem is, and put in a work 
around as following:

;; On Windows, after "server-start" is called, somehow (system-name) 
will return lower case host name. If the original
;; (system-name) returns upper case host name now 
tramp-restricted-shell-hosts-alist will be out-of-date and cause
;; tramp not to function properly.
(defadvice server-start (after update-restricted-host-list last activate)
  (setf tramp-restricted-shell-hosts-alist
        (when (memq system-type '(windows-nt))
          (list (concat "\\`" (regexp-quote (system-name)) "\\'")))))

But the proper fix should be to make sure (system-name) always returns 
the same string consistently. I found it is this sexp in "server-start" 
function that changes the return value of (system-name):

      (setq server-process
        (apply #'make-network-process ....))

This bug has bothered me for a long time. Even Emacs 26.3 still has it 
(although I am still using 26.2 for daily work). I hope this can lead to 
a fix that saves some frustration for other fellow Emacs users.

Here is my set up:

In GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
 of 2019-04-13 built on CIRROCUMULUS
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749

Warren





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Wed, 06 Nov 2019 16:07:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Wanrong Lin <wrglin <at> gmail.com>
Cc: 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Wed, 06 Nov 2019 18:06:02 +0200
> From: Wanrong Lin <wrglin <at> gmail.com>
> Date: Tue, 5 Nov 2019 19:52:59 -0500
> 
> ;; On Windows, after "server-start" is called, somehow (system-name) 
> will return lower case host name. If the original
> ;; (system-name) returns upper case host name now 
> tramp-restricted-shell-hosts-alist will be out-of-date and cause
> ;; tramp not to function properly.
> (defadvice server-start (after update-restricted-host-list last activate)
>    (setf tramp-restricted-shell-hosts-alist
>          (when (memq system-type '(windows-nt))
>            (list (concat "\\`" (regexp-quote (system-name)) "\\'")))))
> 
> But the proper fix should be to make sure (system-name) always returns 
> the same string consistently. I found it is this sexp in "server-start" 
> function that changes the return value of (system-name):
> 
>        (setq server-process
>          (apply #'make-network-process ....))

Thanks.  However, your proposed solution is very hard to implement
(for boring technical reasons), so my suggestion is for Trump to
compare system names case insensitively, at least on MS-Windows, with
a proper comment to explain why.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Wed, 06 Nov 2019 16:15:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Wanrong Lin <wrglin <at> gmail.com>
Cc: 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Wed, 6 Nov 2019 17:14:06 +0100
> (for boring technical reasons), so my suggestion is for Trump to
                                                            ^

> compare system names case insensitively, at least on MS-Windows, with

So Richard was right after all when he suggested to rename this ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Wed, 06 Nov 2019 16:52:02 GMT) Full text and rfc822 format available.

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

From: Wanrong Lin <wrglin <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Wed, 6 Nov 2019 11:50:59 -0500
Yes that can be another way to fix. The downside is we don't know this 
system-name upper/lower case change will cause any surprises somewhere 
else. But I don't understand the underlying difficulty to ensure 
system-name never changes. Thanks for fixing it either way.

Warren

On 11/6/2019 11:06 AM, Eli Zaretskii wrote:
>> From: Wanrong Lin <wrglin <at> gmail.com>
>> Date: Tue, 5 Nov 2019 19:52:59 -0500
>>
>> ;; On Windows, after "server-start" is called, somehow (system-name)
>> will return lower case host name. If the original
>> ;; (system-name) returns upper case host name now
>> tramp-restricted-shell-hosts-alist will be out-of-date and cause
>> ;; tramp not to function properly.
>> (defadvice server-start (after update-restricted-host-list last activate)
>>     (setf tramp-restricted-shell-hosts-alist
>>           (when (memq system-type '(windows-nt))
>>             (list (concat "\\`" (regexp-quote (system-name)) "\\'")))))
>>
>> But the proper fix should be to make sure (system-name) always returns
>> the same string consistently. I found it is this sexp in "server-start"
>> function that changes the return value of (system-name):
>>
>>         (setq server-process
>>           (apply #'make-network-process ....))
> Thanks.  However, your proposed solution is very hard to implement
> (for boring technical reasons), so my suggestion is for Trump to
> compare system names case insensitively, at least on MS-Windows, with
> a proper comment to explain why.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Wed, 06 Nov 2019 17:38:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 38079 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Wanrong Lin <wrglin <at> gmail.com>
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Wed, 06 Nov 2019 18:37:26 +0100
martin rudalics <rudalics <at> gmx.at> writes:

>> (for boring technical reasons), so my suggestion is for Trump to
>                                                             ^
>
>> compare system names case insensitively, at least on MS-Windows, with
>
> So Richard was right after all when he suggested to rename this ...

... and I've refused, for good reasons.

Will see what I could do.

> martin

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Wed, 06 Nov 2019 18:12:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Wanrong Lin <wrglin <at> gmail.com>
Cc: 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Wed, 06 Nov 2019 20:11:10 +0200
> Cc: 38079 <at> debbugs.gnu.org
> From: Wanrong Lin <wrglin <at> gmail.com>
> Date: Wed, 6 Nov 2019 11:50:59 -0500
> 
> But I don't understand the underlying difficulty to ensure
> system-name never changes.

There are two system calls that return this information on Windows,
and they treat the letter-case differently.  The second system call
needs the winsock layer to be initialized, and we don't want to do
that at startup because it causes various problems (sorry, I no longer
remember the details of that part).  So we only call the network-aware
system call after some network connection is available.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Thu, 07 Nov 2019 15:24:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Wanrong Lin <wrglin <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Thu, 07 Nov 2019 16:23:16 +0100
[Message part 1 (text/plain, inline)]
Wanrong Lin <wrglin <at> gmail.com> writes:

Hi,

> Yes that can be another way to fix. The downside is we don't know this
> system-name upper/lower case change will cause any surprises somewhere
> else. But I don't understand the underlying difficulty to ensure
> system-name never changes. Thanks for fixing it either way.

Does the appended patch fix the problem for you?

> Warren

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. (Thu, 07 Nov 2019 15:24:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Thu, 07 Nov 2019 16:19:03 GMT) Full text and rfc822 format available.

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

From: Wanrong Lin <wrglin <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Thu, 7 Nov 2019 11:18:19 -0500
Yes it does. Thanks.

Wanrong

On 11/7/2019 10:23 AM, Michael Albinus wrote:
> Wanrong Lin <wrglin <at> gmail.com> writes:
>
> Hi,
>
>> Yes that can be another way to fix. The downside is we don't know this
>> system-name upper/lower case change will cause any surprises somewhere
>> else. But I don't understand the underlying difficulty to ensure
>> system-name never changes. Thanks for fixing it either way.
> Does the appended patch fix the problem for you?
>
>> Warren
> Best regards, Michael.
>





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Thu, 07 Nov 2019 16:19:04 GMT) Full text and rfc822 format available.

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

From: Wanrong Lin <wrglin <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 38079 <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Thu, 7 Nov 2019 11:18:28 -0500
Yes it does. Thanks.

Warren

On 11/7/2019 10:23 AM, Michael Albinus wrote:
> Wanrong Lin <wrglin <at> gmail.com> writes:
>
> Hi,
>
>> Yes that can be another way to fix. The downside is we don't know this
>> system-name upper/lower case change will cause any surprises somewhere
>> else. But I don't understand the underlying difficulty to ensure
>> system-name never changes. Thanks for fixing it either way.
> Does the appended patch fix the problem for you?
>
>> Warren
> Best regards, Michael.
>





Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Thu, 07 Nov 2019 17:46:02 GMT) Full text and rfc822 format available.

Notification sent to Wanrong Lin <wrglin <at> gmail.com>:
bug acknowledged by developer. (Thu, 07 Nov 2019 17:46:03 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Wanrong Lin <wrglin <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 38079-done <at> debbugs.gnu.org
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Thu, 07 Nov 2019 18:45:08 +0100
Version: 27.1

Wanrong Lin <wrglin <at> gmail.com> writes:

> Yes it does. Thanks.

Thanks for the feedback. I've committed the patch to the repositories,
closing the bug.

> Wanrong

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Fri, 08 Nov 2019 07:52:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38079 <at> debbugs.gnu.org, Wanrong Lin <wrglin <at> gmail.com>
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Fri, 08 Nov 2019 08:51:42 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> But I don't understand the underlying difficulty to ensure
>> system-name never changes.
>
> There are two system calls that return this information on Windows,
> and they treat the letter-case differently.  The second system call
> needs the winsock layer to be initialized, and we don't want to do
> that at startup because it causes various problems (sorry, I no longer
> remember the details of that part).  So we only call the network-aware
> system call after some network connection is available.

Shouldn't we document this in etc/PROBLEMS? I can't write this, because
I don't know too much about Emacs on MS Windows.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Fri, 08 Nov 2019 10:35:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 38079 <at> debbugs.gnu.org, wrglin <at> gmail.com
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Fri, 08 Nov 2019 12:34:22 +0200
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: Wanrong Lin <wrglin <at> gmail.com>,  38079 <at> debbugs.gnu.org
> Date: Fri, 08 Nov 2019 08:51:42 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> But I don't understand the underlying difficulty to ensure
> >> system-name never changes.
> >
> > There are two system calls that return this information on Windows,
> > and they treat the letter-case differently.  The second system call
> > needs the winsock layer to be initialized, and we don't want to do
> > that at startup because it causes various problems (sorry, I no longer
> > remember the details of that part).  So we only call the network-aware
> > system call after some network connection is available.
> 
> Shouldn't we document this in etc/PROBLEMS?

What would you suggest to document?  This is an internal detail of the
Emacs implementation, and users have no control on the results.  Maybe
I'm missing something, but what useful workarounds can we suggest?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Fri, 08 Nov 2019 10:52:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 38079 <at> debbugs.gnu.org, wrglin <at> gmail.com
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Fri, 08 Nov 2019 11:50:45 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > There are two system calls that return this information on Windows,
>> > and they treat the letter-case differently.  The second system call
>> > needs the winsock layer to be initialized, and we don't want to do
>> > that at startup because it causes various problems (sorry, I no longer
>> > remember the details of that part).  So we only call the network-aware
>> > system call after some network connection is available.
>>
>> Shouldn't we document this in etc/PROBLEMS?
>
> What would you suggest to document?  This is an internal detail of the
> Emacs implementation, and users have no control on the results.  Maybe
> I'm missing something, but what useful workarounds can we suggest?

I don't speak about users but developers. At least we shall warn them
that `system-name' can return different values. They might apply counter
measures, like using only (downcase (system-name)) or a alike on w32.

Well, since it is about developers, the Lisp manual might be the better
place to document, in the "Operating System Environment" section.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38079; Package emacs. (Fri, 08 Nov 2019 13:36:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 38079 <at> debbugs.gnu.org, wrglin <at> gmail.com
Subject: Re: bug#38079: On Windows tramp hangs after server-start is called
Date: Fri, 08 Nov 2019 15:35:24 +0200
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: wrglin <at> gmail.com,  38079 <at> debbugs.gnu.org
> Date: Fri, 08 Nov 2019 11:50:45 +0100
> 
> >> Shouldn't we document this in etc/PROBLEMS?
> >
> > What would you suggest to document?  This is an internal detail of the
> > Emacs implementation, and users have no control on the results.  Maybe
> > I'm missing something, but what useful workarounds can we suggest?
> 
> I don't speak about users but developers.

Then PROBLEMS is not the appropriate place.

> At least we shall warn them that `system-name' can return different
> values. They might apply counter measures, like using only (downcase
> (system-name)) or a alike on w32.
> 
> Well, since it is about developers, the Lisp manual might be the better
> place to document, in the "Operating System Environment" section.

Right.  Or maybe in the doc string.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 07 Dec 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 281 days ago.

Previous Next


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