Re: error while changing file’s mode when saving file with ACL permissions
Tijs Mallaerts 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 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 body)
Re: error while changing file’s mode when saving file with ACL permissions
Hi Michael, Ok I see, a user option would be perfect in that case. Thank you! Tijs Op do 18 apr 2024 om 09:17 schreef Michael Albinus : > Tijs Mallaerts writes: > > > Hi Michael, > > Hi Tijs, > > > Would it be an idea to check first if the user can run the chmod > > command before calling the tramp-sh-handle-set-file-modes function? > > Too much hassle, because this would be checked for everybody, with > performance degradation. > > What about a user option, which (when non-nil) transforms the error into > a warning? > > > Thank you, > > Tijs > > Best regards, Michael. >
Re: error while changing file’s mode when saving file with ACL permissions
Tijs Mallaerts writes: > Hi Michael, Hi Tijs, > Would it be an idea to check first if the user can run the chmod > command before calling the tramp-sh-handle-set-file-modes function? Too much hassle, because this would be checked for everybody, with performance degradation. What about a user option, which (when non-nil) transforms the error into a warning? > Thank you, > Tijs Best regards, Michael.
Re: error while changing file’s mode when saving file with ACL permissions
Hi Michael, As I understand it, only the file owner can run the chmod command on the file, but my user is not the owner in this case. When I skip the call to tramp-sh-handle-set-file-modes editing the file seems to work correctly. Would it be an idea to check first if the user can run the chmod command before calling the tramp-sh-handle-set-file-modes function? Thank you, Tijs Op wo 17 apr 2024 om 20:19 schreef Michael Albinus : > Tijs Mallaerts writes: > > > Hi Michael, > > Hi Tijs, > > > This is the output of the command: > > > > chmod: changing permissions of ‘/var/www/aaa/index.htm’: Operation not > > permitted > > tramp_exit_status 1 > > This doesn't tell us much. Hmm. > > Could you try to find out, why chmod on that machine does not have > proper permissions for that file? And are you sure, that it is ACL and > not the SELinux security context which is in the way? Perhaps you can > play with chmod's --role and --type arguments, if it supports them? > > > Thank you! > > Tijs > > Best regards, Michael. >