From eff2eb5812e964024c3aa20197b21f12d37155dd Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 29 Dec 2012 20:11:11 +0100 Subject: [PATCH] * net/tramp-sh.el (tramp-sh-handle-file-acl): Suppress basic attributes. (tramp-sh-handle-set-file-acl): Return `t' on success. --- lisp/ChangeLog | 5 +++++ lisp/net/tramp-sh.el | 28 +++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c41cfe1b25f..81b4978dba5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-12-29 Michael Albinus + + * net/tramp-sh.el (tramp-sh-handle-file-acl): Suppress basic attributes. + (tramp-sh-handle-set-file-acl): Return `t' on success. + 2012-12-29 Eli Zaretskii * files.el (backup-buffer-copy, basic-save-buffer-2): If diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 67459b4f9ca..ebc377c08c8 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1547,25 +1547,31 @@ and gid of the corresponding user is taken. Both parameters must be integers." (when (and (tramp-remote-acl-p v) (tramp-send-command-and-check v (format - "getfacl -ac %s 2>/dev/null" + "getfacl -acs %s 2>/dev/null" (tramp-shell-quote-argument localname)))) (with-current-buffer (tramp-get-connection-buffer v) (goto-char (point-max)) (delete-blank-lines) - (substring-no-properties (buffer-string))))))) + (when (> (point-max) (point-min)) + (substring-no-properties (buffer-string)))))))) (defun tramp-sh-handle-set-file-acl (filename acl-string) "Like `set-file-acl' for Tramp files." (with-parsed-tramp-file-name filename nil - (if (and (stringp acl-string) - (tramp-remote-acl-p v) - (tramp-send-command-and-check - v (format "setfacl --set-file=- %s <<'EOF'\n%s\nEOF\n" - (tramp-shell-quote-argument localname) acl-string))) - (tramp-set-file-property v localname "file-acl" acl-string) - (tramp-set-file-property v localname "file-acl-string" 'undef))) - ;; We always return nil. - nil) + (when (tramp-remote-acl-p v) + (condition-case nil + (when (stringp acl-string) + (tramp-set-file-property v localname "file-acl" acl-string) + (dolist (line (split-string acl-string nil t) t) + (unless (tramp-send-command-and-check + v (format + "setfacl -m %s %s" + line (tramp-shell-quote-argument localname))) + (error)))) + ;; In case of errors, we return `nil'. + (error + (tramp-set-file-property v localname "file-acl" 'undef) + nil))))) ;; Simple functions using the `test' command. -- 2.39.5