]> code.delx.au - gnu-emacs/commitdiff
* net/tramp-sh.el (tramp-sh-handle-file-acl): Suppress basic attributes.
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 29 Dec 2012 19:11:11 +0000 (20:11 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 29 Dec 2012 19:11:11 +0000 (20:11 +0100)
(tramp-sh-handle-set-file-acl): Return `t' on success.

lisp/ChangeLog
lisp/net/tramp-sh.el

index c41cfe1b25fb9ddac25e8a9fdbed6a4a99a3f170..81b4978dba586d2496dc4097afc28e9a28d23c22 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-29  Michael Albinus  <michael.albinus@gmx.de>
+
+       * 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  <eliz@gnu.org>
 
        * files.el (backup-buffer-copy, basic-save-buffer-2): If
index 67459b4f9ca30e64a73a2705335d4c98605b5da8..ebc377c08c8743b010a6383607798425b62300f7 100644 (file)
@@ -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.