+2013-01-24 Michael Albinus <michael.albinus@gmx.de>
+
+ * 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 <dmantipov@yandex.ru>
* doc-view.el (doc-view-display): Force mode line update until all
(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))
(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.
;;;###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.