emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111397: * net/tramp-sh.el (tramp-sh-


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111397: * net/tramp-sh.el (tramp-sh-handle-set-file-acl): Add argument to
Date: Wed, 02 Jan 2013 11:15:31 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111397
committer: Michael Albinus <address@hidden
branch nick: trunk
timestamp: Wed 2013-01-02 11:15:31 +0100
message:
  * net/tramp-sh.el (tramp-sh-handle-set-file-acl): Add argument to
  `error' call.
  (tramp-do-copy-or-rename-file): Ignore errors when calling
  `set-file-extended-attributes'.
  
  * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
  handler for `file-acl'.
  (tramp-smb-handle-file-acl): New defun.
modified:
  lisp/ChangeLog
  lisp/net/tramp-sh.el
  lisp/net/tramp-smb.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-02 02:54:33 +0000
+++ b/lisp/ChangeLog    2013-01-02 10:15:31 +0000
@@ -1,3 +1,14 @@
+2013-01-02  Michael Albinus  <address@hidden>
+
+       * net/tramp-sh.el (tramp-sh-handle-set-file-acl): Add argument to
+       `error' call.
+       (tramp-do-copy-or-rename-file): Ignore errors when calling
+       `set-file-extended-attributes'.
+
+       * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
+       handler for `file-acl'.
+       (tramp-smb-handle-file-acl): New defun.
+
 2013-01-02  Jay Belanger  <address@hidden>
 
        * calc/README: Mention ISO 8601 week-numbering dates.

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2012-12-30 18:09:01 +0000
+++ b/lisp/net/tramp-sh.el      2013-01-02 10:15:31 +0000
@@ -1570,7 +1570,7 @@
                       v (format
                          "setfacl -m %s %s"
                          line (tramp-shell-quote-argument localname)))
-               (error))))
+               (error nil))))
        ;; In case of errors, we return `nil'.
        (error
         (tramp-set-file-property v localname "file-acl" 'undef)
@@ -2097,9 +2097,11 @@
          ;; One of them must be a Tramp file.
          (error "Tramp implementation says this cannot happen")))
 
-       ;; Handle `preserve-extended-attributes'.
+       ;; Handle `preserve-extended-attributes'.  We ignore possible
+       ;; errors, because ACL strings could be incompatible.
        (when attributes
-         (apply 'set-file-extended-attributes (list newname attributes)))
+         (ignore-errors
+           (apply 'set-file-extended-attributes (list newname attributes))))
 
        ;; In case of `rename', we must flush the cache of the source file.
        (when (and t1 (eq op 'rename))

=== modified file 'lisp/net/tramp-smb.el'
--- a/lisp/net/tramp-smb.el     2012-12-30 10:58:13 +0000
+++ b/lisp/net/tramp-smb.el     2013-01-02 10:15:31 +0000
@@ -195,7 +195,7 @@
     (dired-uncache . tramp-handle-dired-uncache)
     (expand-file-name . tramp-smb-handle-expand-file-name)
     (file-accessible-directory-p . tramp-smb-handle-file-directory-p)
-    (file-acl . ignore)
+    (file-acl . tramp-smb-handle-file-acl)
     (file-attributes . tramp-smb-handle-file-attributes)
     (file-directory-p .  tramp-smb-handle-file-directory-p)
     (file-executable-p . tramp-handle-file-exists-p)
@@ -641,6 +641,22 @@
        method user host
        (tramp-run-real-handler 'expand-file-name (list localname))))))
 
+(defun tramp-smb-handle-file-acl (filename)
+  "Like `file-acl' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-acl"
+      (when (tramp-smb-send-command
+            v (format "getfacl \"%s\"" (tramp-smb-get-localname v)))
+       (with-current-buffer (tramp-get-connection-buffer v)
+         (goto-char (point-min))
+         (while (looking-at-p "^#")
+           (forward-line)
+           (delete-region (point-min) (point)))
+         (goto-char (point-max))
+         (delete-blank-lines)
+         (when (> (point-max) (point-min))
+           (substring-no-properties (buffer-string))))))))
+
 (defun tramp-smb-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))
@@ -1815,6 +1831,5 @@
 ;; * Try to remove the inclusion of dummy "" directory.  Seems to be at
 ;;   several places, especially in `tramp-smb-handle-insert-directory'.
 ;; * Ignore case in file names.
-;; * Implement `tramp-smb-handle-file-acl' for proper Samba versions.
 
 ;;; tramp-smb.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]