Function: tramp-smb-handle-set-file-acl
tramp-smb-handle-set-file-acl is a byte-compiled function defined in
tramp-smb.el.gz.
Signature
(tramp-smb-handle-set-file-acl FILENAME ACL-STRING)
Documentation
Like set-file-acl for Tramp files.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-smb.el.gz
(defun tramp-smb-handle-set-file-acl (filename acl-string)
"Like `set-file-acl' for Tramp files."
(ignore-errors
(with-parsed-tramp-file-name filename nil
(tramp-flush-file-property v localname "file-acl")
(when (and (stringp acl-string) (tramp-smb-remote-acl-p v))
(let* ((share (tramp-smb-get-share v))
(localname (tramp-compat-string-replace
"\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E" "-S"
(tramp-compat-string-replace
"\n" "," acl-string)))
(options tramp-smb-options))
(if (tramp-string-empty-or-nil-p user)
(setq args (append args (list "-N")))
(setq args (append args (list "-U" user))))
(when domain (setq args (append args (list "-W" domain))))
(when port (setq args (append args (list "-p" port))))
(when tramp-smb-conf
(setq args (append args (list "-s" tramp-smb-conf))))
(while options
(setq args
(append args `("--option" ,(format "%s" (car options))))
options (cdr options)))
(setq
args
(append args (list (tramp-unquote-shell-quote-argument localname)
"&&" "echo" "tramp_exit_status" "0"
"||" "echo" "tramp_exit_status" "1")))
(with-tramp-saved-connection-properties
v '("process-name" "process-buffer")
(with-temp-buffer
;; Set the transfer process properties.
(tramp-set-connection-property
v "process-name" (buffer-name (current-buffer)))
(tramp-set-connection-property
v "process-buffer" (current-buffer))
;; Use an asynchronous process. By this, password
;; can be handled.
(let ((p (apply
#'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
(tramp-post-process-creation p v)
(tramp-process-actions p v nil tramp-smb-actions-set-acl)
;; This is meant for traces, and returning from
;; the function. No error is propagated outside,
;; due to the `ignore-errors' closure.
(unless
(tramp-search-regexp (rx "tramp_exit_status " (+ digit)))
(tramp-error
v 'file-error
"Couldn't find exit status of `%s'"
tramp-smb-acl-program))
(skip-chars-forward "^ ")
(when (zerop (read (current-buffer)))
;; Success.
(tramp-set-file-property v localname "file-acl" acl-string)
t)))))))))