summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2011-09-23 11:38:41 +0200
committerMichael Albinus <michael.albinus@gmx.de>2011-09-23 11:38:41 +0200
commit916830895691c3f7a944d195f5d0d38e3c109439 (patch)
treef6775605f3c498553cbaabc197e0d98a07cece2b
parent5bdd6fa4efa7825a6af14adb11eeea0eda8aa018 (diff)
downloademacs-916830895691c3f7a944d195f5d0d38e3c109439.tar.gz
* net/tramp-sh.el (tramp-sh-handle-file-name-all-completions): Fix
nasty bug using wrong cached values.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/tramp-sh.el18
2 files changed, 14 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 65315b303f1..ff0e18403a6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-23 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp-sh.el (tramp-sh-handle-file-name-all-completions): Fix
+ nasty bug using wrong cached values.
+
2011-09-23 Alan Mackenzie <acm@muc.de>
* progmodes/cc-defs.el (c-version): Increase to 5.31.9.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e94581392fa..56424f79476 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1738,7 +1738,9 @@ and gid of the corresponding user is taken. Both parameters must be integers."
"file-name-all-completions"
nil)))
(when cache-hit (list cache-hit))))
- (tramp-compat-number-sequence (length filename) 0 -1)))))
+ ;; We cannot use a length of 0, because file properties
+ ;; for "foo" and "foo/" are identical.
+ (tramp-compat-number-sequence (length filename) 1 -1)))))
;; Cache expired or no matching cache entry found so we need
;; to perform a remote operation.
@@ -1803,12 +1805,12 @@ and gid of the corresponding user is taken. Both parameters must be integers."
(with-current-buffer (tramp-get-buffer v)
(goto-char (point-max))
- ;; Check result code, found in last line of output
+ ;; Check result code, found in last line of output.
(forward-line -1)
(if (looking-at "^fail$")
(progn
;; Grab error message from line before last line
- ;; (it was put there by `cd 2>&1')
+ ;; (it was put there by `cd 2>&1').
(forward-line -1)
(tramp-error
v 'file-error
@@ -1829,9 +1831,8 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
(push (buffer-substring (point) (point-at-eol)) result)))
;; Because the remote op went through OK we know the
- ;; directory we `cd'-ed to exists
- (tramp-set-file-property
- v localname "file-exists-p" t)
+ ;; directory we `cd'-ed to exists.
+ (tramp-set-file-property v localname "file-exists-p" t)
;; Because the remote op went through OK we know every
;; file listed by `ls' exists.
@@ -1840,11 +1841,10 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
v (concat localname entry) "file-exists-p" t))
result)
- ;; Store result in the cache
+ ;; Store result in the cache.
(tramp-set-file-property
v (concat localname filename)
- "file-name-all-completions"
- result))))))))
+ "file-name-all-completions" result))))))))
;; cp, mv and ln