aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-02-16 09:27:53 +0100
committerMichael Albinus2019-02-16 09:27:53 +0100
commitaff0c585060b7cc92d52a32978c6aa64cf7e2a5e (patch)
tree18d589d25dadf5f9f67e5da17c241b345903edc4
parent3d9a56f00040cbfc8fb92c4379344d7e91e2dff2 (diff)
downloademacs-aff0c585060b7cc92d52a32978c6aa64cf7e2a5e.tar.gz
emacs-aff0c585060b7cc92d52a32978c6aa64cf7e2a5e.zip
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."
677 (tramp-compat-time-equal-p time tramp-time-doesnt-exist) 677 (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
678 (tramp-compat-time-equal-p time tramp-time-dont-know)) 678 (tramp-compat-time-equal-p time tramp-time-dont-know))
679 (current-time) 679 (current-time)
680 time))) 680 time))
681 (quoted-name (tramp-shell-quote-argument localname)))
682 ;; Older versions of toybox 'touch' mishandle nanoseconds and/or
683 ;; trailing "Z", so fall back on plain seconds if nanoseconds+Z
684 ;; fails. Also, fall back on old POSIX 'touch -t' if 'touch -d'
685 ;; (introduced in POSIX.1-2008) fails.
681 (tramp-adb-send-command-and-check 686 (tramp-adb-send-command-and-check
682 v (format "touch -d %s %s" 687 v (format (concat "touch -d %s %s 2>/dev/null || "
688 "touch -d %s %s 2>/dev/null || "
689 "touch -t %s %s")
690 (format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t)
691 quoted-name
683 (format-time-string "%Y-%m-%dT%H:%M:%S" time t) 692 (format-time-string "%Y-%m-%dT%H:%M:%S" time t)
684 (tramp-shell-quote-argument localname)))))) 693 quoted-name
694 (format-time-string "%Y%m%d%H%M.%S" time t)
695 quoted-name)))))
685 696
686(defun tramp-adb-handle-copy-file 697(defun tramp-adb-handle-copy-file
687 (filename newname &optional ok-if-already-exists keep-date 698 (filename newname &optional ok-if-already-exists keep-date