Please add the connection-property "touch-h"
Toru TSUNEYOSHI <[email protected]> Wed, 13 Aug 2025 00:46:08 +0900 (JST)
| Newsgroups | gmane.emacs.tramp |
|---|---|
| Message-ID | <TYYP286MB5954E96181D50CE37D62D1F5E22BA@TYYP286MB5954.JPNP286.PROD.OUTLOOK.COM> |
Hello, everyone. ( I post to this mailing list again after an interval of 15 years. :-) ) The touch command included in busybox (version 1.30.1-6) on OpenWrt does not have the option "-h". Therefore, the tramp-sh-handle-set-file-times function does not work properly if the argument flag is nofollow. Could you please add the connection-property "touch-h" to fix the problem? (I attach a sample patch based on TRAMP 22.1 for Emacs 30.1.)
tramp-sh.el.diff
(text/x-patch, 901 B)
--- tramp-sh.el.orig 2025-02-19 03:31:36.000000000 +0900
+++ tramp-sh.el 2025-08-12 23:35:03.827791100 +0900
@@ -1594,7 +1594,10 @@ (defun tramp-sh-handle-set-file-times (f
"-t %s"
(format-time-string "%Y%m%d%H%M.%S" (tramp-defined-time time) t))
"")
- (if (eq flag 'nofollow) "-h" "")
+ (if (and (eq flag 'nofollow)
+ (tramp-get-connection-property v "touch-h"))
+ "-h"
+ "")
(tramp-shell-quote-argument localname))))))
(defun tramp-sh-handle-get-home-directory (vec &optional user)
@@ -5833,6 +5836,14 @@ (defun tramp-get-remote-touch (vec)
result
(format-time-string "%Y%m%d%H%M.%S")
(tramp-file-local-name tmpfile))))
+ (tramp-set-connection-property
+ vec "touch-h"
+ (tramp-send-command-and-check
+ vec
+ (format
+ "%s -h %s"
+ result
+ (tramp-file-local-name tmpfile))))
(delete-file tmpfile))
result)))