mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-16 17:19:41 +00:00
Further Tramp fixes for Android 12
* lisp/net/tramp-adb.el (tramp-adb-handle-file-attributes) (tramp-adb-handle-directory-files-and-attributes) (tramp-adb-handle-file-name-all-completions): Pipe "ls" output through "cat", in order to avoid quoting special characters. (tramp-adb-sh-fix-ls-output): Remove fix for file names with spaces. * test/lisp/net/tramp-tests.el (tramp-test22-file-times): Adapt test.
This commit is contained in:
parent
e5bf2b942f
commit
b0653b27e2
@ -257,7 +257,7 @@ arguments to pass to the OPERATION."
|
|||||||
(tramp-convert-file-attributes v localname id-format
|
(tramp-convert-file-attributes v localname id-format
|
||||||
(and
|
(and
|
||||||
(tramp-adb-send-command-and-check
|
(tramp-adb-send-command-and-check
|
||||||
v (format "%s -d -l %s"
|
v (format "%s -d -l %s | cat"
|
||||||
(tramp-adb-get-ls-command v)
|
(tramp-adb-get-ls-command v)
|
||||||
(tramp-shell-quote-argument localname)))
|
(tramp-shell-quote-argument localname)))
|
||||||
(with-current-buffer (tramp-get-buffer v)
|
(with-current-buffer (tramp-get-buffer v)
|
||||||
@ -310,16 +310,15 @@ arguments to pass to the OPERATION."
|
|||||||
directory full match nosort id-format count
|
directory full match nosort id-format count
|
||||||
(with-current-buffer (tramp-get-buffer v)
|
(with-current-buffer (tramp-get-buffer v)
|
||||||
(when (tramp-adb-send-command-and-check
|
(when (tramp-adb-send-command-and-check
|
||||||
v (format "%s -a -l %s"
|
v (format "%s -a -l %s | cat"
|
||||||
(tramp-adb-get-ls-command v)
|
(tramp-adb-get-ls-command v)
|
||||||
(tramp-shell-quote-argument localname)))
|
(tramp-shell-quote-argument localname)))
|
||||||
;; We insert also filename/. and filename/.., because "ls"
|
;; We insert also filename/. and filename/.., because "ls"
|
||||||
;; doesn't. Looks like it does include them in toybox, since
|
;; doesn't on some file systems, like "sdcard".
|
||||||
;; Android 6.
|
|
||||||
(unless (re-search-backward "\\.$" nil t)
|
(unless (re-search-backward "\\.$" nil t)
|
||||||
(narrow-to-region (point-max) (point-max))
|
(narrow-to-region (point-max) (point-max))
|
||||||
(tramp-adb-send-command
|
(tramp-adb-send-command
|
||||||
v (format "%s -d -a -l %s %s"
|
v (format "%s -d -a -l %s %s | cat"
|
||||||
(tramp-adb-get-ls-command v)
|
(tramp-adb-get-ls-command v)
|
||||||
(tramp-shell-quote-argument
|
(tramp-shell-quote-argument
|
||||||
(tramp-compat-file-name-concat localname "."))
|
(tramp-compat-file-name-concat localname "."))
|
||||||
@ -362,10 +361,6 @@ arguments to pass to the OPERATION."
|
|||||||
Android's \"ls\" command doesn't insert size column for directories:
|
Android's \"ls\" command doesn't insert size column for directories:
|
||||||
Emacs dired can't find files."
|
Emacs dired can't find files."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
;; Fix file names with spaces.
|
|
||||||
;; FIXME: It would be better if we could call "ls" with proper
|
|
||||||
;; argument or environment variable.
|
|
||||||
(replace-string-in-region "\\ " " " (point-min))
|
|
||||||
;; Insert missing size.
|
;; Insert missing size.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while
|
(while
|
||||||
@ -460,7 +455,7 @@ Emacs dired can't find files."
|
|||||||
(with-parsed-tramp-file-name (expand-file-name directory) nil
|
(with-parsed-tramp-file-name (expand-file-name directory) nil
|
||||||
(with-tramp-file-property v localname "file-name-all-completions"
|
(with-tramp-file-property v localname "file-name-all-completions"
|
||||||
(tramp-adb-send-command
|
(tramp-adb-send-command
|
||||||
v (format "%s -a %s"
|
v (format "%s -a %s | cat"
|
||||||
(tramp-adb-get-ls-command v)
|
(tramp-adb-get-ls-command v)
|
||||||
(tramp-shell-quote-argument localname)))
|
(tramp-shell-quote-argument localname)))
|
||||||
(mapcar
|
(mapcar
|
||||||
@ -471,9 +466,8 @@ Emacs dired can't find files."
|
|||||||
(with-current-buffer (tramp-get-buffer v)
|
(with-current-buffer (tramp-get-buffer v)
|
||||||
(delete-dups
|
(delete-dups
|
||||||
(append
|
(append
|
||||||
;; In older Android versions, "." and ".." are not
|
;; On some file systems like "sdcard", "." and ".." are
|
||||||
;; included. In newer versions (toybox, since Android 6)
|
;; not included. We fix this by `delete-dups'.
|
||||||
;; they are. We fix this by `delete-dups'.
|
|
||||||
'("." "..")
|
'("." "..")
|
||||||
(delq
|
(delq
|
||||||
nil
|
nil
|
||||||
|
@ -4160,7 +4160,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||||||
(file-attributes tmp-name1))))
|
(file-attributes tmp-name1))))
|
||||||
;; Skip the test, if the remote handler is not able to set
|
;; Skip the test, if the remote handler is not able to set
|
||||||
;; the correct time.
|
;; the correct time.
|
||||||
(skip-unless (set-file-times tmp-name1 (seconds-to-time 1)))
|
;; Some remote machines cannot resolve seconds. So we use a minute.
|
||||||
|
(skip-unless (set-file-times tmp-name1 (seconds-to-time 60)))
|
||||||
;; Dumb remote shells without perl(1) or stat(1) are not
|
;; Dumb remote shells without perl(1) or stat(1) are not
|
||||||
;; able to return the date correctly. They say "don't know".
|
;; able to return the date correctly. They say "don't know".
|
||||||
(unless (tramp-compat-time-equal-p
|
(unless (tramp-compat-time-equal-p
|
||||||
@ -4168,16 +4169,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||||||
(file-attributes tmp-name1))
|
(file-attributes tmp-name1))
|
||||||
tramp-time-dont-know)
|
tramp-time-dont-know)
|
||||||
(should
|
(should
|
||||||
(or (tramp-compat-time-equal-p
|
(tramp-compat-time-equal-p
|
||||||
(file-attribute-modification-time
|
(file-attribute-modification-time (file-attributes tmp-name1))
|
||||||
(file-attributes tmp-name1))
|
(seconds-to-time 60)))
|
||||||
(seconds-to-time 1))
|
|
||||||
;; Some remote machines cannot resolve seconds.
|
|
||||||
;; The return the modification time `(0 0).
|
|
||||||
(tramp-compat-time-equal-p
|
|
||||||
(file-attribute-modification-time
|
|
||||||
(file-attributes tmp-name1))
|
|
||||||
(seconds-to-time 0))))
|
|
||||||
;; Setting the time for not existing files shall fail.
|
;; Setting the time for not existing files shall fail.
|
||||||
(should-error
|
(should-error
|
||||||
(set-file-times tmp-name2)
|
(set-file-times tmp-name2)
|
||||||
@ -4192,18 +4186,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||||||
;; regular files, there shouldn't be a difference.
|
;; regular files, there shouldn't be a difference.
|
||||||
(when (tramp--test-emacs28-p)
|
(when (tramp--test-emacs28-p)
|
||||||
(with-no-warnings
|
(with-no-warnings
|
||||||
(set-file-times tmp-name1 (seconds-to-time 1) 'nofollow)
|
(set-file-times tmp-name1 (seconds-to-time 60) 'nofollow)
|
||||||
(should
|
(should
|
||||||
(or (tramp-compat-time-equal-p
|
(tramp-compat-time-equal-p
|
||||||
(file-attribute-modification-time
|
(file-attribute-modification-time
|
||||||
(file-attributes tmp-name1))
|
(file-attributes tmp-name1))
|
||||||
(seconds-to-time 1))
|
(seconds-to-time 60)))))))
|
||||||
;; Some remote machines cannot resolve seconds.
|
|
||||||
;; The return the modification time `(0 0).
|
|
||||||
(tramp-compat-time-equal-p
|
|
||||||
(file-attribute-modification-time
|
|
||||||
(file-attributes tmp-name1))
|
|
||||||
(seconds-to-time 0))))))))
|
|
||||||
|
|
||||||
;; Cleanup.
|
;; Cleanup.
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
|
Loading…
Reference in New Issue
Block a user