Tijs Mallaerts <tijs.mallae...@gmail.com> writes:

> Hi Michael,

Hi Tijs,

> Ok I see, a user option would be perfect in that case.

Please try the appended patch. Since it changes a macro, you must
recompile both tramp.el and tramp-sh.el (in that order).

Then try your test, again, setting the new user option
tramp-warn-only-if-setting-file-attributes-fail to t in advance.

> Thank you!
> Tijs

Best regards, Michael.

diff --git a/lisp/tramp.el b/lisp/tramp.el
index 5b101000..e4c8c1aa 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -3533,6 +3533,11 @@ on the same host.  Otherwise, TARGET is quoted."

        ,@body)))

+(defcustom tramp-warn-only-if-setting-file-attributes-fail nil
+  "Whether to warn only if `tramp-*-set-file-{modes,times,uid-gid}' fails."
+  :version "30.1"
+  :type 'boolean)
+
 (defmacro tramp-skeleton-set-file-modes-times-uid-gid
     (filename &rest body)
   "Skeleton for `tramp-*-set-file-{modes,times,uid-gid}'.
@@ -3548,7 +3553,11 @@ BODY is the backend specific code."
 	 ;; "file-writable-p".
 	 '("file-directory-p" "file-exists-p" "file-symlinkp" "file-truename")
        (tramp-flush-file-properties v localname))
-     ,@body))
+     (condition-case err
+	 (progn ,@body)
+       (error (if tramp-warn-only-if-setting-file-attributes-fail
+		  (display-warning 'tramp (error-message-string err))
+		(signal (car err) (cdr err)))))))

 (defmacro tramp-skeleton-write-region
   (start end filename append visit lockname mustbenew &rest body)

Reply via email to