From bf0503cba93003438209fef721af729d7913d345 Mon Sep 17 00:00:00 2001
From: Michael Albinus <michael.albinus@gmx.de>
Date: Mon, 12 Feb 2007 06:19:54 +0000
Subject: [PATCH] * net/tramp.el (tramp-get-ls-command,
 tramp-get-file-exists-command) (tramp-get-remote-ln): Handle error case. 
 Reported by Chris Moore <dooglus@gmail.com>.

---
 lisp/ChangeLog    |  6 ++++++
 lisp/net/tramp.el | 24 +++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4d9f1b3c047..d685e33b922 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-12  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-get-ls-command, tramp-get-file-exists-command)
+	(tramp-get-remote-ln): Handle error case.  Reported by Chris Moore
+	<dooglus@gmail.com>.
+
 2007-02-11  Kim F. Storm  <storm@cua.dk>
 
 	* bindings.el (ctl-x-map): Remove register compatibility bindings
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 257fbc4e47b..602c6d25eaa 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -7105,10 +7105,12 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in
 ;; Variables local to connection.
 
 (defun tramp-get-ls-command (multi-method method user host)
-  (save-excursion
-    (tramp-maybe-open-connection multi-method method user host)
-    (set-buffer (tramp-get-buffer multi-method method user host))
-    tramp-ls-command))
+  (or
+   (save-excursion
+     (tramp-maybe-open-connection multi-method method user host)
+     (set-buffer (tramp-get-buffer multi-method method user host))
+     tramp-ls-command)
+   (error "Couldn't find remote `ls' command")))
 
 (defun tramp-get-test-groks-nt (multi-method method user host)
   (save-excursion
@@ -7117,16 +7119,20 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in
     tramp-test-groks-nt))
 
 (defun tramp-get-file-exists-command (multi-method method user host)
-  (save-excursion
-    (tramp-maybe-open-connection multi-method method user host)
-    (set-buffer (tramp-get-buffer multi-method method user host))
-    tramp-file-exists-command))
+  (or
+   (save-excursion
+     (tramp-maybe-open-connection multi-method method user host)
+     (set-buffer (tramp-get-buffer multi-method method user host))
+     tramp-file-exists-command)
+   (error "Couldn't find remote `test -e' command")))
 
 (defun tramp-get-remote-perl (multi-method method user host)
   (tramp-get-connection-property "perl" nil multi-method method user host))
 
 (defun tramp-get-remote-ln (multi-method method user host)
-  (tramp-get-connection-property "ln" nil multi-method method user host))
+  (or
+   (tramp-get-connection-property "ln" nil multi-method method user host)
+   (error "Couldn't find remote `ln' command")))
 
 (defun tramp-get-remote-uid (multi-method method user host)
   (tramp-get-connection-property "uid" nil multi-method method user host))
-- 
2.39.5