From: Michael Albinus Date: Thu, 24 Jan 2013 09:50:02 +0000 (+0100) Subject: * net/tramp.el (tramp-tramp-file-p): Check, whether NAME is unibyte. X-Git-Tag: emacs-24.3.90~173^2~7^2~225 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e1ffa412b4ebd244c834854098031756743236e0;p=emacs.git * net/tramp.el (tramp-tramp-file-p): Check, whether NAME is unibyte. * net/tramp-sh.el (tramp-sh-handle-set-file-acl): Do not suppress basic attributes. (tramp-sh-handle-set-file-acl): Improve error checking. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index afab39e6efc..9c4f8f37a9b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2013-01-24 Michael Albinus + + * net/tramp.el (tramp-tramp-file-p): Check, whether NAME is unibyte. + + * net/tramp-sh.el (tramp-sh-handle-set-file-acl): Do not suppress + basic attributes. + (tramp-sh-handle-set-file-acl): Improve error checking. + 2013-01-24 Dmitry Antipov * doc-view.el (doc-view-display): Force mode line update until all diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 743c8dbe0f9..21c747967af 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1549,7 +1549,7 @@ be non-negative integers." (when (and (tramp-remote-acl-p v) (tramp-send-command-and-check v (format - "getfacl -acs %s 2>/dev/null" + "getfacl -ac %s 2>/dev/null" (tramp-shell-quote-argument localname)))) (with-current-buffer (tramp-get-connection-buffer v) (goto-char (point-max)) @@ -1560,21 +1560,20 @@ be non-negative integers." (defun tramp-sh-handle-set-file-acl (filename acl-string) "Like `set-file-acl' for Tramp files." - (with-parsed-tramp-file-name filename 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 nil)))) - ;; In case of errors, we return `nil'. - (error - (tramp-set-file-property v localname "file-acl" 'undef) - nil))))) + (with-parsed-tramp-file-name (expand-file-name filename) nil + (if (and (stringp acl-string) (tramp-remote-acl-p v) + (progn + (tramp-send-command + v (format "setfacl --set-file=- %s <<'EOF'\n%s\nEOF\n" + (tramp-shell-quote-argument localname) acl-string)) + (tramp-send-command-and-check v nil))) + ;; Success. + (progn + (tramp-set-file-property v localname "file-acl" acl-string) + t) + ;; In case of errors, we return `nil'. + (tramp-set-file-property v localname "file-acl-string" 'undef) + nil))) ;; Simple functions using the `test' command. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 69e82de3f7f..045304cbc4f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1140,9 +1140,12 @@ If the `tramp-methods' entry does not exist, return nil." ;;;###tramp-autoload (defun tramp-tramp-file-p (name) - "Return t if NAME is a string with Tramp file name syntax." + "Return t if NAME is a string with Tramp file name syntax. +It checks also, whether NAME is unibyte encoded." (save-match-data - (and (stringp name) (string-match tramp-file-name-regexp name)))) + (and (stringp name) + (string-equal name (string-as-unibyte name)) + (string-match tramp-file-name-regexp name)))) (defun tramp-find-method (method user host) "Return the right method string to use.