summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-02-16 09:27:53 +0100
committerMichael Albinus <michael.albinus@gmx.de>2019-02-16 09:27:53 +0100
commitaff0c585060b7cc92d52a32978c6aa64cf7e2a5e (patch)
tree18d589d25dadf5f9f67e5da17c241b345903edc4
parent3d9a56f00040cbfc8fb92c4379344d7e91e2dff2 (diff)
downloademacs-aff0c585060b7cc92d52a32978c6aa64cf7e2a5e.tar.gz
Port tramp-adb to various 'touch' platforms
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times): Try nanoseconds first, then plain seconds, then touch -t.
-rw-r--r--lisp/net/tramp-adb.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 22f2c5f6bf1..4fba4e14f3a 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -677,11 +677,22 @@ But handle the case, if the \"test\" command is not available."
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
(tramp-compat-time-equal-p time tramp-time-dont-know))
(current-time)
- time)))
+ time))
+ (quoted-name (tramp-shell-quote-argument localname)))
+ ;; Older versions of toybox 'touch' mishandle nanoseconds and/or
+ ;; trailing "Z", so fall back on plain seconds if nanoseconds+Z
+ ;; fails. Also, fall back on old POSIX 'touch -t' if 'touch -d'
+ ;; (introduced in POSIX.1-2008) fails.
(tramp-adb-send-command-and-check
- v (format "touch -d %s %s"
+ v (format (concat "touch -d %s %s 2>/dev/null || "
+ "touch -d %s %s 2>/dev/null || "
+ "touch -t %s %s")
+ (format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t)
+ quoted-name
(format-time-string "%Y-%m-%dT%H:%M:%S" time t)
- (tramp-shell-quote-argument localname))))))
+ quoted-name
+ (format-time-string "%Y%m%d%H%M.%S" time t)
+ quoted-name)))))
(defun tramp-adb-handle-copy-file
(filename newname &optional ok-if-already-exists keep-date