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
|
||||
(and
|
||||
(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-shell-quote-argument localname)))
|
||||
(with-current-buffer (tramp-get-buffer v)
|
||||
@ -310,16 +310,15 @@ arguments to pass to the OPERATION."
|
||||
directory full match nosort id-format count
|
||||
(with-current-buffer (tramp-get-buffer v)
|
||||
(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-shell-quote-argument localname)))
|
||||
;; We insert also filename/. and filename/.., because "ls"
|
||||
;; doesn't. Looks like it does include them in toybox, since
|
||||
;; Android 6.
|
||||
;; doesn't on some file systems, like "sdcard".
|
||||
(unless (re-search-backward "\\.$" nil t)
|
||||
(narrow-to-region (point-max) (point-max))
|
||||
(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-shell-quote-argument
|
||||
(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:
|
||||
Emacs dired can't find files."
|
||||
(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.
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
@ -460,7 +455,7 @@ Emacs dired can't find files."
|
||||
(with-parsed-tramp-file-name (expand-file-name directory) nil
|
||||
(with-tramp-file-property v localname "file-name-all-completions"
|
||||
(tramp-adb-send-command
|
||||
v (format "%s -a %s"
|
||||
v (format "%s -a %s | cat"
|
||||
(tramp-adb-get-ls-command v)
|
||||
(tramp-shell-quote-argument localname)))
|
||||
(mapcar
|
||||
@ -471,9 +466,8 @@ Emacs dired can't find files."
|
||||
(with-current-buffer (tramp-get-buffer v)
|
||||
(delete-dups
|
||||
(append
|
||||
;; In older Android versions, "." and ".." are not
|
||||
;; included. In newer versions (toybox, since Android 6)
|
||||
;; they are. We fix this by `delete-dups'.
|
||||
;; On some file systems like "sdcard", "." and ".." are
|
||||
;; not included. We fix this by `delete-dups'.
|
||||
'("." "..")
|
||||
(delq
|
||||
nil
|
||||
|
@ -4160,7 +4160,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
||||
(file-attributes tmp-name1))))
|
||||
;; Skip the test, if the remote handler is not able to set
|
||||
;; 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
|
||||
;; able to return the date correctly. They say "don't know".
|
||||
(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))
|
||||
tramp-time-dont-know)
|
||||
(should
|
||||
(or (tramp-compat-time-equal-p
|
||||
(file-attribute-modification-time
|
||||
(file-attributes tmp-name1))
|
||||
(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))))
|
||||
(tramp-compat-time-equal-p
|
||||
(file-attribute-modification-time (file-attributes tmp-name1))
|
||||
(seconds-to-time 60)))
|
||||
;; Setting the time for not existing files shall fail.
|
||||
(should-error
|
||||
(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.
|
||||
(when (tramp--test-emacs28-p)
|
||||
(with-no-warnings
|
||||
(set-file-times tmp-name1 (seconds-to-time 1) 'nofollow)
|
||||
(set-file-times tmp-name1 (seconds-to-time 60) 'nofollow)
|
||||
(should
|
||||
(or (tramp-compat-time-equal-p
|
||||
(file-attribute-modification-time
|
||||
(file-attributes tmp-name1))
|
||||
(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))))))))
|
||||
(tramp-compat-time-equal-p
|
||||
(file-attribute-modification-time
|
||||
(file-attributes tmp-name1))
|
||||
(seconds-to-time 60)))))))
|
||||
|
||||
;; Cleanup.
|
||||
(ignore-errors
|
||||
|
Loading…
Reference in New Issue
Block a user