changeset 107021:b38ac2be4408

Fix some busybox annoyances. * net/tramp.el (tramp-wrong-passwd-regexp): Add "Timeout, server not responding." string. (tramp-open-connection-setup-interactive-shell): Dump stty settings. Enable "neveropen" arg for all `tramp-send-command' calls. Handle "=" in variable values properly. (tramp-find-inline-encoding): Raise an error, when no encoding is found. (tramp-wait-for-output): Check, whether PROC buffer is available. Remove spurious " ^H" sequences, sent by busybox. (tramp-get-ls-command): Suppress coloring, if possible.
author Michael Albinus <albinus@detlef>
date Thu, 28 Jan 2010 07:06:41 +0100
parents e59c65208b1c
children 1b8ee4a690a1 6eaa332dd1b5
files lisp/ChangeLog lisp/net/tramp.el
diffstat 2 files changed, 53 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jan 27 21:54:48 2010 -0800
+++ b/lisp/ChangeLog	Thu Jan 28 07:06:41 2010 +0100
@@ -1,3 +1,18 @@
+2010-01-28  Michael Albinus  <michael.albinus@gmx.de>
+
+	Fix some busybox annoyances.
+
+	* net/tramp.el (tramp-wrong-passwd-regexp): Add "Timeout, server
+	not responding." string.
+	(tramp-open-connection-setup-interactive-shell): Dump stty
+	settings.  Enable "neveropen" arg for all `tramp-send-command'
+	calls.  Handle "=" in variable values properly.
+	(tramp-find-inline-encoding): Raise an error, when no encoding is
+	found.
+	(tramp-wait-for-output): Check, whether PROC buffer is available.
+	Remove spurious " ^H" sequences, sent by busybox.
+	(tramp-get-ls-command): Suppress coloring, if possible.
+
 2010-01-28  Glenn Morris  <rgm@gnu.org>
 
 	* vc-svn.el (vc-svn-update): Use "svn --non-interactive".  (Bug#4280)
--- a/lisp/net/tramp.el	Wed Jan 27 21:54:48 2010 -0800
+++ b/lisp/net/tramp.el	Thu Jan 28 07:06:41 2010 +0100
@@ -1085,6 +1085,7 @@
 			"Login Incorrect"
 			"Connection refused"
 			"Connection closed"
+			"Timeout, server not responding."
 			"Sorry, try again."
 			"Name or service not known"
 			"Host key verification failed."
@@ -6732,6 +6733,9 @@
 	;; because we're running on a non-MULE Emacs.  Let's try
 	;; stty, instead.
 	(tramp-send-command vec "stty -onlcr" t))))
+  ;; Dump stty settings in the traces.
+  (when (>= tramp-verbose 10)
+    (tramp-send-command vec "stty -a" t))
   (tramp-send-command vec "set +o vi +o emacs" t)
 
   ;; Check whether the output of "uname -sr" has been changed.  If
@@ -6801,15 +6805,16 @@
   ;; <http://bugs.opensolaris.org/view_bug.do?bug_id=6834184>.  We
   ;; apply the workaround.
   (if (string-equal (tramp-get-connection-property vec "uname" "") "SunOS 5.11")
-      (tramp-send-command vec "unset HISTFILE"))
+      (tramp-send-command vec "unset HISTFILE" t))
 
   (let ((env (copy-sequence tramp-remote-process-environment))
 	unset item)
     (while env
       (setq item (tramp-compat-split-string (car env) "="))
-      (if (and (stringp (cadr item)) (not (string-equal (cadr item) "")))
+      (setcdr item (mapconcat 'identity (cdr item) "="))
+      (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
 	  (tramp-send-command
-	   vec (format "%s=%s; export %s" (car item) (cadr item) (car item)) t)
+	   vec (format "%s=%s; export %s" (car item) (cdr item) (car item)) t)
 	(push (car item) unset))
       (setq env (cdr env)))
     (when unset
@@ -6981,7 +6986,8 @@
 
       ;; Did we find something?
       (unless found
-	(tramp-message vec 2 "Couldn't find an inline transfer encoding"))
+	(tramp-error
+	 vec 'file-error "Couldn't find an inline transfer encoding"))
 
       ;; Set connection properties.
       (tramp-message vec 5 "Using local encoding `%s'" loc-enc)
@@ -7301,7 +7307,10 @@
     (unless nooutput (tramp-wait-for-output p))))
 
 (defun tramp-wait-for-output (proc &optional timeout)
-  "Wait for output from remote rsh command."
+  "Wait for output from remote command."
+  (unless (buffer-live-p (process-buffer proc))
+    (delete-process proc)
+    (tramp-error proc 'file-error "Process `%s' not available, try again" proc))
   (with-current-buffer (process-buffer proc)
     (let* (;; Initially, `tramp-end-of-output' is "#$ ".  There might
 	   ;; be leading escape sequences, which must be ignored.
@@ -7313,6 +7322,14 @@
 	   (found (tramp-wait-for-regexp proc timeout regexp1)))
       (if found
 	  (let (buffer-read-only)
+	    ;; A simple-minded busybox has sent " ^H" sequences.
+	    ;; Delete them.
+	    (goto-char (point-min))
+	    (when (re-search-forward
+		   "^\\(.\b\\)+$" (tramp-compat-line-end-position) t)
+	      (forward-line 1)
+	      (delete-region (point-min) (point)))
+	    ;; Delete the prompt.
 	    (goto-char (point-max))
 	    (re-search-backward regexp nil t)
 	    (delete-region (point) (point-max)))
@@ -8002,9 +8019,14 @@
 	 (let ((dl (tramp-get-remote-path vec))
 	       result)
 	   (while (and dl (setq result (tramp-find-executable vec cmd dl t t)))
-	     ;; Check parameter.
+	     ;; Check parameters.  On busybox, "ls" output coloring is
+	     ;; enabled by default sometimes.  So we try to disable it
+	     ;; when possible.  $LS_COLORING is not supported there.
 	     (when (zerop (tramp-send-command-and-check
 			   vec (format "%s -lnd /" result)))
+	       (when (zerop (tramp-send-command-and-check
+			     vec (format "%s --color=never /" result)))
+		 (setq result (concat result " --color=never")))
 	       (throw 'ls-found result))
 	     (setq dl (cdr dl))))))
      (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))
@@ -8481,8 +8503,6 @@
 ;; * Don't use globbing for directories with many files, as this is
 ;;   likely to produce long command lines, and some shells choke on
 ;;   long command lines.
-;; * `vc-directory' does not work.  It never displays any files, even
-;;   if it does show files when run locally.
 ;; * How to deal with MULE in `insert-file-contents' and `write-region'?
 ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'?
 ;; * abbreviate-file-name
@@ -8529,8 +8549,6 @@
 ;; * Reconnect directly to a compliant shell without first going
 ;;   through the user's default shell. (Pete Forman)
 ;; * Make `tramp-default-user' obsolete.
-;; * Tramp shall reconnect automatically to its ssh connection when it
-;;   detects that the process "has died". (David Reitter)
 ;; * How can I interrupt the remote process with a signal
 ;;   (interrupt-process seems not to work)? (Markus Triska)
 ;; * Avoid the local shell entirely for starting remote processes.  If
@@ -8552,6 +8570,16 @@
 ;; * Keep a second connection open for out-of-band methods like scp or
 ;;   rsync.
 ;; * Support ptys in `tramp-handle-start-file-process'.
+;; * IMHO, it's a drawback that currently Tramp doesn't support
+;;   Unicode in Dired file names by default.  Is it possible to
+;;   improve Tramp to set LC_ALL to "C" only for commands where Tramp
+;;   expects English?  Or just to set LC_MESSAGES to "C" if Tramp
+;;   expects only English messages? (Juri Linkov)
+;; * Make shadowfile.el grok Tramp filenames.  (Bug#4526, Bug#4846)
+;; * Do not handle files with drive letter as remote.  (Bug#5447)
+;; * Load Tramp subpackages only when needed.  (Bug#1529, Bug#5448)
+;; * Try telnet+curl as new method.  It might be useful for busybox,
+;;   without built-in uuencode/uudecode.
 
 ;; Functions for file-name-handler-alist:
 ;; diff-latest-backup-file -- in diff.el