aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJürgen Hötzel2015-08-13 20:59:16 +0200
committerMichael Albinus2015-08-13 20:59:16 +0200
commit57adf425f511b90153f128e7679b5f432df13fb5 (patch)
tree06577c4e3e411bd91a2049de65b9b8aae0b1a6fe
parent0382fd42c6979bbedc9230b789503258a5e963eb (diff)
downloademacs-57adf425f511b90153f128e7679b5f432df13fb5.tar.gz
emacs-57adf425f511b90153f128e7679b5f432df13fb5.zip
; Fix caching problem in tramp-adb.el
* lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes): Make a copy of result to prevent modification of the tramp-cache by side effects. Use the correct cache key.
-rw-r--r--lisp/net/tramp-adb.el71
1 files changed, 36 insertions, 35 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index d04d8f63af1..ca76f626b13 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -394,41 +394,42 @@ pass to the OPERATION."
394 "Like `directory-files-and-attributes' for Tramp files." 394 "Like `directory-files-and-attributes' for Tramp files."
395 (when (file-directory-p directory) 395 (when (file-directory-p directory)
396 (with-parsed-tramp-file-name (expand-file-name directory) nil 396 (with-parsed-tramp-file-name (expand-file-name directory) nil
397 (with-tramp-file-property 397 (copy-tree
398 v localname (format "directory-files-attributes-%s-%s-%s-%s" 398 (with-tramp-file-property
399 full match id-format nosort) 399 v localname (format "directory-files-and-attributes-%s-%s-%s-%s"
400 (with-current-buffer (tramp-get-buffer v) 400 full match id-format nosort)
401 (when (tramp-adb-send-command-and-check 401 (with-current-buffer (tramp-get-buffer v)
402 v (format "%s -a -l %s" 402 (when (tramp-adb-send-command-and-check
403 (tramp-adb-get-ls-command v) 403 v (format "%s -a -l %s"
404 (tramp-shell-quote-argument localname))) 404 (tramp-adb-get-ls-command v)
405 ;; We insert also filename/. and filename/.., because "ls" doesn't. 405 (tramp-shell-quote-argument localname)))
406 (narrow-to-region (point) (point)) 406 ;; We insert also filename/. and filename/.., because "ls" doesn't.
407 (tramp-adb-send-command 407 (narrow-to-region (point) (point))
408 v (format "%s -d -a -l %s %s" 408 (tramp-adb-send-command
409 (tramp-adb-get-ls-command v) 409 v (format "%s -d -a -l %s %s"
410 (tramp-shell-quote-argument 410 (tramp-adb-get-ls-command v)
411 (concat (file-name-as-directory localname) ".")) 411 (tramp-shell-quote-argument
412 (tramp-shell-quote-argument 412 (concat (file-name-as-directory localname) "."))
413 (concat (file-name-as-directory localname) "..")))) 413 (tramp-shell-quote-argument
414 (widen)) 414 (concat (file-name-as-directory localname) ".."))))
415 (tramp-adb-sh-fix-ls-output) 415 (widen))
416 (let ((result (tramp-do-parse-file-attributes-with-ls 416 (tramp-adb-sh-fix-ls-output)
417 v (or id-format 'integer)))) 417 (let ((result (tramp-do-parse-file-attributes-with-ls
418 (when full 418 v (or id-format 'integer))))
419 (setq result 419 (when full
420 (mapcar 420 (setq result
421 (lambda (x) 421 (mapcar
422 (cons (expand-file-name (car x) directory) (cdr x))) 422 (lambda (x)
423 result))) 423 (cons (expand-file-name (car x) directory) (cdr x)))
424 (unless nosort 424 result)))
425 (setq result 425 (unless nosort
426 (sort result (lambda (x y) (string< (car x) (car y)))))) 426 (setq result
427 (delq nil 427 (sort result (lambda (x y) (string< (car x) (car y))))))
428 (mapcar (lambda (x) 428 (delq nil
429 (if (or (not match) (string-match match (car x))) 429 (mapcar (lambda (x)
430 x)) 430 (if (or (not match) (string-match match (car x)))
431 result)))))))) 431 x))
432 result)))))))))
432 433
433(defun tramp-adb-get-ls-command (vec) 434(defun tramp-adb-get-ls-command (vec)
434 (with-tramp-connection-property vec "ls" 435 (with-tramp-connection-property vec "ls"