aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-08-26 15:37:08 +0200
committerJoakim Verona2013-08-26 15:37:08 +0200
commit93797975c60e1f1503f998be728ccbdbe1e86ab3 (patch)
tree355e4797fb836ebf44ae7bef5cd2575582e44471
parent22fee396d08f331f962d793203a5cbf1cb003836 (diff)
parent78fc2530af6b5b36351542b5662ba5d9d5813d04 (diff)
downloademacs-93797975c60e1f1503f998be728ccbdbe1e86ab3.tar.gz
emacs-93797975c60e1f1503f998be728ccbdbe1e86ab3.zip
merge from trunk
-rw-r--r--lisp/ChangeLog17
-rw-r--r--lisp/minibuffer.el3
-rw-r--r--lisp/net/tramp-adb.el2
-rw-r--r--lisp/net/tramp-compat.el1
-rw-r--r--lisp/net/tramp-gvfs.el1
-rw-r--r--lisp/net/tramp-sh.el2
-rw-r--r--lisp/net/tramp-smb.el2
-rw-r--r--lisp/net/tramp.el61
8 files changed, 66 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 53fd1274937..31538258bb6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,20 @@
12013-08-26 Michael Albinus <michael.albinus@gmx.de>
2
3 * minibuffer.el: Revert change from 2013-08-20.
4
5 * net/tramp.el (tramp-find-method, tramp-find-user): Mark result
6 with text property `tramp-default', if appropriate.
7 (tramp-check-proper-host): New defun.
8 (tramp-dissect-file-name): Do not check hostname. Revert change
9 of 2013-03-18.
10 (tramp-backtrace): Make VEC-OR-PROC optional.
11
12 * net/tramp-adb.el (tramp-adb-maybe-open-connection):
13 * net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
14 * net/tramp-sh.el (tramp-maybe-open-connection):
15 * net/tramp-smb.el (tramp-smb-maybe-open-connection): Apply
16 `tramp-check-proper-host'.
17
12013-08-26 Tassilo Horn <tsdh@gnu.org> 182013-08-26 Tassilo Horn <tsdh@gnu.org>
2 19
3 * epa-hook.el (epa-file-encrypt-to): Quote `safe-local-variable' 20 * epa-hook.el (epa-file-encrypt-to): Quote `safe-local-variable'
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 72cb6f7e894..e07d28a54d0 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2246,8 +2246,7 @@ same as `substitute-in-file-name'."
2246 ;; - Cygwin (substitute-in-file-name "C:\bin") => "/usr/bin" 2246 ;; - Cygwin (substitute-in-file-name "C:\bin") => "/usr/bin"
2247 ;; (substitute-in-file-name "C:\") => "/" 2247 ;; (substitute-in-file-name "C:\") => "/"
2248 ;; (substitute-in-file-name "C:\bi") => "/bi" 2248 ;; (substitute-in-file-name "C:\bi") => "/bi"
2249 (let* ((non-essential t) 2249 (let* ((ustr (substitute-in-file-name qstr))
2250 (ustr (substitute-in-file-name qstr))
2251 (uprefix (substring ustr 0 upos)) 2250 (uprefix (substring ustr 0 upos))
2252 qprefix) 2251 qprefix)
2253 ;; Main assumption: nothing after qpos should affect the text before upos, 2252 ;; Main assumption: nothing after qpos should affect the text before upos,
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 8ddbe254380..ff6d0d10671 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1092,6 +1092,8 @@ FMT and ARGS are passed to `error'."
1092 "Maybe open a connection VEC. 1092 "Maybe open a connection VEC.
1093Does not do anything if a connection is already open, but re-opens the 1093Does not do anything if a connection is already open, but re-opens the
1094connection if a previous connection has died for some reason." 1094connection if a previous connection has died for some reason."
1095 (tramp-check-proper-host vec)
1096
1095 (let* ((buf (tramp-get-connection-buffer vec)) 1097 (let* ((buf (tramp-get-connection-buffer vec))
1096 (p (get-buffer-process buf)) 1098 (p (get-buffer-process buf))
1097 (host (tramp-file-name-host vec)) 1099 (host (tramp-file-name-host vec))
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 71703fe6ab1..f0905245dea 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -521,6 +521,7 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
521;; `user-error' has been added to Emacs 24.3. 521;; `user-error' has been added to Emacs 24.3.
522(defun tramp-compat-user-error (format &rest args) 522(defun tramp-compat-user-error (format &rest args)
523 "Signal a pilot error." 523 "Signal a pilot error."
524; (tramp-backtrace)
524 (apply (if (fboundp 'user-error) 'user-error 'error) format args)) 525 (apply (if (fboundp 'user-error) 'user-error 'error) format args))
525 526
526(add-hook 'tramp-unload-hook 527(add-hook 'tramp-unload-hook
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index f70074ba6e9..e26ffb26e84 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1469,6 +1469,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
1469 "Maybe open a connection VEC. 1469 "Maybe open a connection VEC.
1470Does not do anything if a connection is already open, but re-opens the 1470Does not do anything if a connection is already open, but re-opens the
1471connection if a previous connection has died for some reason." 1471connection if a previous connection has died for some reason."
1472 (tramp-check-proper-host vec)
1472 1473
1473 ;; We set the file name, in case there are incoming D-Bus signals or 1474 ;; We set the file name, in case there are incoming D-Bus signals or
1474 ;; D-Bus errors. 1475 ;; D-Bus errors.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index b76ac2fa11f..ac131765189 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4326,6 +4326,8 @@ Gateway hops are already opened."
4326 "Maybe open a connection VEC. 4326 "Maybe open a connection VEC.
4327Does not do anything if a connection is already open, but re-opens the 4327Does not do anything if a connection is already open, but re-opens the
4328connection if a previous connection has died for some reason." 4328connection if a previous connection has died for some reason."
4329 (tramp-check-proper-host vec)
4330
4329 (catch 'uname-changed 4331 (catch 'uname-changed
4330 (let ((p (tramp-get-connection-process vec)) 4332 (let ((p (tramp-get-connection-process vec))
4331 (process-name (tramp-get-connection-property vec "process-name" nil)) 4333 (process-name (tramp-get-connection-property vec "process-name" nil))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 39e87f994c2..569bfb9c874 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1564,6 +1564,8 @@ Does not do anything if a connection is already open, but re-opens the
1564connection if a previous connection has died for some reason. 1564connection if a previous connection has died for some reason.
1565If ARGUMENT is non-nil, use it as argument for 1565If ARGUMENT is non-nil, use it as argument for
1566`tramp-smb-winexe-program', and suppress any checks." 1566`tramp-smb-winexe-program', and suppress any checks."
1567 (tramp-check-proper-host vec)
1568
1567 (let* ((share (tramp-smb-get-share vec)) 1569 (let* ((share (tramp-smb-get-share vec))
1568 (buf (tramp-get-connection-buffer vec)) 1570 (buf (tramp-get-connection-buffer vec))
1569 (p (get-buffer-process buf))) 1571 (p (get-buffer-process buf)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index cd7d17b130c..5f473a496e2 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1239,23 +1239,31 @@ their replacement."
1239 ;; This works with the current set of `tramp-obsolete-methods'. 1239 ;; This works with the current set of `tramp-obsolete-methods'.
1240 ;; Must be improved, if their are more sophisticated replacements. 1240 ;; Must be improved, if their are more sophisticated replacements.
1241 (setq result (substring result 0 -1))) 1241 (setq result (substring result 0 -1)))
1242 result)) 1242 ;; We must mark, whether a default value has been used.
1243 (if (or method (null result))
1244 result
1245 (propertize result 'tramp-default t))))
1243 1246
1244(defun tramp-find-user (method user host) 1247(defun tramp-find-user (method user host)
1245 "Return the right user string to use. 1248 "Return the right user string to use.
1246This is USER, if non-nil. Otherwise, do a lookup in 1249This is USER, if non-nil. Otherwise, do a lookup in
1247`tramp-default-user-alist'." 1250`tramp-default-user-alist'."
1248 (or user 1251 (let ((result
1249 (let ((choices tramp-default-user-alist) 1252 (or user
1250 luser item) 1253 (let ((choices tramp-default-user-alist)
1251 (while choices 1254 luser item)
1252 (setq item (pop choices)) 1255 (while choices
1253 (when (and (string-match (or (nth 0 item) "") (or method "")) 1256 (setq item (pop choices))
1254 (string-match (or (nth 1 item) "") (or host ""))) 1257 (when (and (string-match (or (nth 0 item) "") (or method ""))
1255 (setq luser (nth 2 item)) 1258 (string-match (or (nth 1 item) "") (or host "")))
1256 (setq choices nil))) 1259 (setq luser (nth 2 item))
1257 luser) 1260 (setq choices nil)))
1258 tramp-default-user)) 1261 luser)
1262 tramp-default-user)))
1263 ;; We must mark, whether a default value has been used.
1264 (if (or user (null result))
1265 result
1266 (propertize result 'tramp-default t))))
1259 1267
1260(defun tramp-find-host (method user host) 1268(defun tramp-find-host (method user host)
1261 "Return the right host string to use. 1269 "Return the right host string to use.
@@ -1272,6 +1280,18 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
1272 lhost) 1280 lhost)
1273 tramp-default-host)) 1281 tramp-default-host))
1274 1282
1283(defun tramp-check-proper-host (vec)
1284 "Check host name of VEC."
1285 (let ((method (tramp-file-name-method vec))
1286 (user (tramp-file-name-user vec))
1287 (host (tramp-file-name-host vec)))
1288 (when (and (equal tramp-syntax 'ftp) host
1289 (or (null method) (get-text-property 0 'tramp-default method))
1290 (or (null user) (get-text-property 0 'tramp-default user))
1291 (member host (mapcar 'car tramp-methods)))
1292 (tramp-compat-user-error
1293 "Host name must not match method `%s'" host))))
1294
1275(defun tramp-dissect-file-name (name &optional nodefault) 1295(defun tramp-dissect-file-name (name &optional nodefault)
1276 "Return a `tramp-file-name' structure. 1296 "Return a `tramp-file-name' structure.
1277The structure consists of remote method, remote user, remote host 1297The structure consists of remote method, remote user, remote host
@@ -1290,12 +1310,7 @@ values."
1290 (when (string-match tramp-prefix-ipv6-regexp host) 1310 (when (string-match tramp-prefix-ipv6-regexp host)
1291 (setq host (replace-match "" nil t host))) 1311 (setq host (replace-match "" nil t host)))
1292 (when (string-match tramp-postfix-ipv6-regexp host) 1312 (when (string-match tramp-postfix-ipv6-regexp host)
1293 (setq host (replace-match "" nil t host))) 1313 (setq host (replace-match "" nil t host))))
1294 (when (and (equal tramp-syntax 'ftp) (null method) (null user)
1295 (member host (mapcar 'car tramp-methods))
1296 (not (tramp-completion-mode-p)))
1297 (tramp-compat-user-error
1298 "Host name must not match method `%s'" host)))
1299 (if nodefault 1314 (if nodefault
1300 (vector method user host localname hop) 1315 (vector method user host localname hop)
1301 (vector 1316 (vector
@@ -1537,10 +1552,14 @@ applicable)."
1537 (concat (format "(%d) # " level) fmt-string) 1552 (concat (format "(%d) # " level) fmt-string)
1538 arguments))))))) 1553 arguments)))))))
1539 1554
1540(defsubst tramp-backtrace (vec-or-proc) 1555(defsubst tramp-backtrace (&optional vec-or-proc)
1541 "Dump a backtrace into the debug buffer. 1556 "Dump a backtrace into the debug buffer.
1542This function is meant for debugging purposes." 1557If VEC-OR-PROC is nil, the buffer *debug tramp* is used. This
1543 (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace)))) 1558function is meant for debugging purposes."
1559 (if vec-or-proc
1560 (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace)))
1561 (if (<= 10 tramp-verbose)
1562 (with-output-to-temp-buffer "*debug tramp*" (backtrace)))))
1544 1563
1545(defsubst tramp-error (vec-or-proc signal fmt-string &rest arguments) 1564(defsubst tramp-error (vec-or-proc signal fmt-string &rest arguments)
1546 "Emit an error. 1565 "Emit an error.