unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27009: 25.1; Tramp stuck on wrong host
@ 2017-05-21 10:12 Devon Sean McCullough
  2017-05-22 12:03 ` Michael Albinus
  0 siblings, 1 reply; 8+ messages in thread
From: Devon Sean McCullough @ 2017-05-21 10:12 UTC (permalink / raw)
  To: 27009

Tramp connects to the wrong host -- the user may not notice, leading to
devastating damage.

To replicate this bug, have two different systems serve SSH on different
ports of the same IP address,
e.g., In VBox, map local host ports 11111 and 22222 respectively to two
different guest systems:
VirtualBox VM > Devices > Network > Network Settings ... > Adapter 1 >
  Attached to: NAT
  Advanced > Port Forwarding >
    Host Port: 11111 for system one, 22222 for system two
    Guest Port: 22

bash$ Open -n -a /Applications/Emacs.app --args -Q --eval '
(message "Emacs %s tramp bug %s" ; t = bug, nil = ok
	 emacs-version
	 (let ((one "/scp:127.0.0.1#11111:")
	       (two "/scp:127.0.0.1#22222:"))
	   (delete-other-windows)
	   (dired one)
	   (revert-buffer)
	   (split-window)
	   (other-window 1)
	   (dired two)
	   (revert-buffer)
	   (apply (function string=)
		  (mapcar (lambda (w)
			    (with-current-buffer (window-buffer w)
			      (buffer-substring (save-excursion
						  (goto-char (point-min))
						  (forward-line 1)
						  (point))
						(point-max))))
			  (window-list-1)))))'

		Peace
			--Devon

P.S. (tramp-cleanup-all-connections) ; fails to fix it but can switch
which host is wrong.

In GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version
10.9.5 (Build 13F1911))
 of 2016-09-21 built on builder10-9.porkrind.org
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Tramp: Opening connection for 127.0.0.1#11111 using scp...
Tramp: Sending command ‘exec ssh  -p 11111 -o ControlMaster=auto -o
ControlPath='tramp.%C' -o ControlPersist=no -e none 127.0.0.1’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘127.0.0.1’
Tramp: Opening connection for 127.0.0.1#11111 using scp...done
ls does not support --dired; see ‘dired-use-ls-dired’ for more details.
Emacs 25.1.1 tramp bug t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils
tramp-cache tramp-sh tramp tramp-compat auth-source cl-seq eieio
byte-opt bytecomp byte-compile cl-extra cconv eieio-core cl-macs gv
gnus-util mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib
mail-prsvr password-cache tramp-loaddefs trampver shell pcomplete comint
ansi-color ring format-spec advice dired time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win ucs-normalize term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 216764 9018)
 (symbols 48 22062 0)
 (miscs 40 59 298)
 (strings 32 24033 6626)
 (string-bytes 1 768617)
 (vectors 16 36983)
 (vector-slots 8 706708 7377)
 (floats 8 283 52)
 (intervals 56 539 0)
 (buffers 976 20))






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
  2017-05-21 10:12 bug#27009: 25.1; Tramp stuck on wrong host Devon Sean McCullough
@ 2017-05-22 12:03 ` Michael Albinus
       [not found]   ` <0BE42352-D06B-4466-A898-5B3EF5436428@csail.mit.edu>
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Albinus @ 2017-05-22 12:03 UTC (permalink / raw)
  To: Devon Sean McCullough; +Cc: 27009

"Devon Sean McCullough" <Emacs-Hacker2017@jovi.net> writes:

Hi Davon,

> Tramp connects to the wrong host -- the user may not notice, leading to
> devastating damage.

Tramp is almost agnostic to port numbers. It uses them for the command
raised for connecting, but everywhere else it ignores them. This happens
especially in managing internal data, like the name of the connection
buffer or access to cached values.

As a result, two remote file names are handled as identical if they
differ only in their port numbers. See also the todo entry in tramp.el:

;; * Use also port to distinguish connections.  This is needed for
;;   different hosts sitting behind a single router (distinguished by
;;   different port numbers).  (Tzvi Edelman)

I know, this is not satisfying. If time permits, I'll work on this next
time. Unfortunately, there's no trivial fix.

As a workaround, use different host names. In your example, you could
use something like

(let ((one "/scp:localhost#11111:")
      (two "/scp:localhost.#22222:"))

Name resolution for "localhost" and "localhost." will return the same IP
address. But from the Tramp pov, the host names are different strings.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
       [not found]     ` <87a864uiba.fsf@detlef>
@ 2017-05-24 14:28       ` Michael Albinus
  2017-05-24 17:22         ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Albinus @ 2017-05-24 14:28 UTC (permalink / raw)
  To: Devon Sean McCullough; +Cc: 27009

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Devon,

> I plan to reserve an own slot for the port in the tramp-file-name
> vector. Maybe even converting this to a defstruct. This would be
> future-proof, and it should show immediately the places I have missed to
> change.

I took the opportunity to implement this. Now, the bug is fixed.

If you have any chance to test the development version of Emacs (the
upcoming 26.1 release), you could crosscheck this.

Due to the new defstruct and its mechanery, I had to cut Emacs 23
backward compatibility for Tramp 2.3. I don't know how many users are
hit by this; hopefully not too many.

> But this will be a more complex change.

With the default settings for tramp-tests.el, all test cases pass. But
for some other methods, there are still failures. Will continue to test.

>> 		Peace
>> 			—Devon

Best regards, Michael.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
  2017-05-24 14:28       ` Michael Albinus
@ 2017-05-24 17:22         ` Glenn Morris
  2017-05-24 20:31           ` Michael Albinus
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2017-05-24 17:22 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 27009, Devon Sean McCullough

Michael Albinus wrote:

> Due to the new defstruct and its mechanery, I had to cut Emacs 23
> backward compatibility for Tramp 2.3. I don't know how many users are
> hit by this; hopefully not too many.

In 2016, we had one bug report from an Emacs 23 user.

https://debbugs.gnu.org/stats/emacs.html

So, I would guess that the number of people using Emacs 23 AND
upgrading to the latest Tramp version is... zero.

> With the default settings for tramp-tests.el, all test cases pass. But
> for some other methods, there are still failures. Will continue to test.

FYI, I think these changes cause some python tests to fail with

  (wrong-type-argument tramp-file-name nil)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
  2017-05-24 17:22         ` Glenn Morris
@ 2017-05-24 20:31           ` Michael Albinus
  2017-06-07 12:41             ` Devon Sean McCullough
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Albinus @ 2017-05-24 20:31 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 27009, Devon Sean McCullough

Glenn Morris <rgm@gnu.org> writes:

> FYI, I think these changes cause some python tests to fail with
>
>   (wrong-type-argument tramp-file-name nil)

Shall be fixed now in master.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
  2017-05-24 20:31           ` Michael Albinus
@ 2017-06-07 12:41             ` Devon Sean McCullough
  2017-06-07 14:26               ` Michael Albinus
  0 siblings, 1 reply; 8+ messages in thread
From: Devon Sean McCullough @ 2017-06-07 12:41 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 27009

[-- Attachment #1: Type: text/plain, Size: 4040 bytes --]

In the current nightly build, tramp fails to tell ssh to connect to the user-specified port
so it tries default port 22 instead.  Am I missing something really obvious here?

		Peace
			--Devon

bash$ Open -n -a /Applications/Emacs-2017f07w.app --args --no-init-file --no-site-file --no-site-lisp --eval '(dired "/scp:127.0.0.1#2222:”)’

ssh: connect to host 127.0.0.1 port 22: Connection Refused^M

U:**@  *tramp/scp 127.0.0.1#2222*  All  L2     (Fundamental)

In GNU Emacs 26.0.50 (build 1, x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
 of 2017-06-07 built on builder10-9.local
Windowing system distributor 'Apple', version 10.3.1404
Recent messages:

For information about GNU Emacs and the GNU system, type C-h C-a.
Tramp: Opening connection for 127.0.0.1 using scp...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none 127.0.0.1’
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for 127.0.0.1 using scp...failed
tramp-file-name-handler: Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq rfc822 mml
easymenu mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils tramp-cmds tramp-cache tramp-sh tramp
tramp-compat tramp-loaddefs trampver shell pcomplete comint ansi-color
ring parse-time format-spec advice auth-source cl-seq eieio byte-opt
bytecomp byte-compile cconv eieio-core cl-macs gv eieio-loaddefs
cl-loaddefs cl-lib password-cache dired dired-loaddefs time-date tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 218715 4885)
 (symbols 48 21515 1)
 (miscs 40 46 164)
 (strings 32 25033 7176)
 (string-bytes 1 865927)
 (vectors 16 38152)
 (vector-slots 8 729944 4504)
 (floats 8 65 283)
 (intervals 56 203 0)
 (buffers 976 12))


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3866 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
  2017-06-07 12:41             ` Devon Sean McCullough
@ 2017-06-07 14:26               ` Michael Albinus
  2017-07-14 13:19                 ` Michael Albinus
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Albinus @ 2017-06-07 14:26 UTC (permalink / raw)
  To: Devon Sean McCullough; +Cc: 27009

Devon Sean McCullough <devon@csail.mit.edu> writes:

Hi Devon,

> In the current nightly build, tramp fails to tell ssh to connect to
> the user-specified port so it tries default port 22 instead.

Oops, yes. Should be fixed now.

> 		Peace
> 			--Devon

Best regards, Michael.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#27009: 25.1; Tramp stuck on wrong host
  2017-06-07 14:26               ` Michael Albinus
@ 2017-07-14 13:19                 ` Michael Albinus
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Albinus @ 2017-07-14 13:19 UTC (permalink / raw)
  To: Devon Sean McCullough; +Cc: 27009-done

Version: 26.1

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Devon,

>> In the current nightly build, tramp fails to tell ssh to connect to
>> the user-specified port so it tries default port 22 instead.
>
> Oops, yes. Should be fixed now.

No further (negative) feedback, so I'm closing the bug.

>> 		Peace
>> 			--Devon

Best regards, Michael.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-14 13:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-21 10:12 bug#27009: 25.1; Tramp stuck on wrong host Devon Sean McCullough
2017-05-22 12:03 ` Michael Albinus
     [not found]   ` <0BE42352-D06B-4466-A898-5B3EF5436428@csail.mit.edu>
     [not found]     ` <87a864uiba.fsf@detlef>
2017-05-24 14:28       ` Michael Albinus
2017-05-24 17:22         ` Glenn Morris
2017-05-24 20:31           ` Michael Albinus
2017-06-07 12:41             ` Devon Sean McCullough
2017-06-07 14:26               ` Michael Albinus
2017-07-14 13:19                 ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).