tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tramp (2.0.12); Strange error message; no password prompt


From: Kai Großjohann
Subject: Re: tramp (2.0.12); Strange error message; no password prompt
Date: Sat, 17 Aug 2002 22:11:22 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Rainer Thiel <address@hidden> writes:

> I am using tramp 2.0.12.  The local machine is a Notebook with Windows
> 98 (cygwin installed) where connections with plink work as expected when
> run from a shell prompt.  The remote machine is
> <applin.hrz.uni-marburg.de>, an application server of Marburg University
> (Germany) run under Unix.  My username on that machine is thielr.
>
> Problem description:
>
> When trying to access a file in a subdirectory on my home directory on
> the server specified above, I try to do as follows:
>
> C-x C-f /plink:address@hidden:thiel/Temp/Hotels-Bonn.txt RET
>
> (The file I am trying to access is named 'Hotels-Bonn.txt' and lives in
> the directory 'Temp' which is inside the directory 'thiel' which is in
> my home directory on the Server.)
>
> When doing so, I get the following message in the minibuffer:
>
> tramp: Looking for Are you sure you want to continue connecting
> (yes/no)\?
>
> Answering either 'yes' or 'no' has no obvious effect.

Whee.  How can I solve this problem?  The message means that Tramp is
waiting for stuff from the remote end, and it looks to see whether
that stuff contains a specific pattern which happens to look like a
question.

It does NOT mean that Tramp is asking the user a question, it just
looks for a question mark in the remote shell prompt (say).

Do you have some idea how to make it more obvious?

> Especially, I don't get a prompt for the password needed to connect
> to the server (I did get a password prompt with previous versions of
> tramp, I think 2.0.3 or 2.04, without being able to actually access
> the remote file).
>
> After a while, a debugger message (which I do not understand) appears.
> Since it appears to contain control characters, I enclose it as
> attachment1.txt.
>
>  >> attachment1.txt

Hm.  Let me have a look at that attachment...  Ah, just the
backtrace, not so useful.

> In another attempt to access the same file in the same way, I also found
> another buffer with the following messages:
>
> ---
> The server's host key is not cached in the registry. You
> have no guarantee that the server is the computer you
> think it is.
> The server's key fingerprint is:
> 1024 8c:65:66:63:20:75:bd:61:3d:14:79:9d:60:0a:c3:73
> If you trust this host, enter "y" to add the key to
> PuTTY's cache and carry on connecting.
> If you want to carry on connecting just once, without
> adding the key to the cache, enter "n".
> If you do not trust this host, press Return to abandon the
> connection.
> Store key in cache? (y/n)
> ---

Aha!  So it seems that it ought to be sufficient to teach Tramp about
this pattern, in addition to the "continue" one.  Just a
second...  Yes.  Please try this patch:

Index: tramp.el
===================================================================
RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v
retrieving revision 2.180
retrieving revision 2.181
diff -u -u -r2.180 -r2.181
--- tramp.el    8 Aug 2002 20:06:24 -0000       2.180
+++ tramp.el    17 Aug 2002 20:09:27 -0000      2.181
@@ -731,13 +731,27 @@
   :type 'regexp)
 
 (defcustom tramp-yesno-prompt-regexp
-  "Are you sure you want to continue connecting (yes/no)\\? *"
-  "Regular expression matching all queries which need to be confirmed.
+  (concat
+   (regexp-opt '("Are you sure you want to continue connecting (yes/no)?") t)
+   "\\s-*")
+  "Regular expression matching all yes/no queries which need to be confirmed.
 The confirmation should be done with yes or no.
-The regexp should match at end of buffer."
+The regexp should match at end of buffer.
+See also `tramp-yn-prompt-regexp'."
   :group 'tramp
   :type 'regexp)
 
+(defcustom tramp-yn-prompt-regexp
+  (concat (regexp-opt '("Store key in cache? (y/n)") t)
+         "\\s-*")
+  "Regular expression matching all y/n queries which need to be confirmed.
+The confirmation should be done with y or n.
+The regexp should match at end of buffer.
+See also `tramp-yesno-prompt-regexp'."
+  :group 'tramp
+  :type 'regexp)
+  
+
 (defcustom tramp-temp-name-prefix "tramp."
   "*Prefix to use for temporary files.
 If this is a relative file name (such as \"tramp.\"), it is considered
@@ -1057,7 +1071,8 @@
     (tramp-login-prompt-regexp tramp-action-login)
     (shell-prompt-pattern tramp-action-succeed)
     (tramp-wrong-passwd-regexp tramp-action-permission-denied)
-    (tramp-yesno-prompt-regexp tramp-action-yesno))
+    (tramp-yesno-prompt-regexp tramp-action-yesno)
+    (tramp-yn-prompt-regexp tramp-action-yn))
   "List of pattern/action pairs.
 Whenever a pattern matches, the corresponding action is performed.
 Each item looks like (PATTERN ACTION).
@@ -3634,7 +3649,9 @@
   (throw 'tramp-action 'permission-denied))
 
 (defun tramp-action-yesno (p multi-method method user host)
-  "Ask the user if he is sure."
+  "Ask the user for confirmation using `yes-or-no-p'.
+Send \"yes\" to remote process on confirmation, abort otherwise.
+See also `tramp-action-yn'."
   (save-window-excursion
     (pop-to-buffer (tramp-get-buffer multi-method method user host))
     (unless (yes-or-no-p (match-string 0))
@@ -3644,6 +3661,18 @@
     (process-send-string p (concat "yes" tramp-rsh-end-of-line))
     (erase-buffer)))
 
+(defun tramp-action-yn (p multi-method method user host)
+  "Ask the user for confirmation using `y-or-n-p'.
+Send \"y\" to remote process on confirmation, abort otherwise.
+See also `tramp-action-yesno'."
+  (save-window-excursion
+    (pop-to-buffer (tramp-get-buffer multi-method method user host))
+    (unless (y-or-n-p (match-string 0))
+      (kill-process p)
+      (erase-buffer)
+      (throw 'tramp-action 'permission-denied))
+    (process-send-string p (concat "y" tramp-rsh-end-of-line))))
+
 ;; The following functions are specifically for multi connections.
 
 (defun tramp-multi-action-login (p method user host)
@@ -5668,6 +5697,7 @@
        tramp-password-prompt-regexp
        tramp-wrong-passwd-regexp
        tramp-yesno-prompt-regexp
+       tramp-yn-prompt-regexp
        tramp-temp-name-prefix
        tramp-file-name-structure
        tramp-file-name-regexp


> (The buffer didn't make itself visible while trying to connect.)

This is another problem.  Hm.  Maybe when Tramp times out it should
display the buffer to make it clear what happened?

> Hope this helps to understand the problem ...

Especially the excerpt from the *tramp/foo* buffer was very valuable!

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]