must be non-negative integers.
The setgid bit of the upper directory is respected.
If FILENAME is remote, a file name handler is called."
- (unless (zerop (logand #o2000 (file-modes (file-name-directory filename))))
- (setq gid (tramp-compat-file-attribute-group-id
- (file-attributes (file-name-directory filename) 'integer))))
+ (let* ((dir (file-name-directory filename))
+ (modes (file-modes dir)))
+ (when (and modes (not (zerop (logand modes #o2000))))
+ (setq gid (tramp-compat-file-attribute-group-id (file-attributes dir)))))
+
(let ((handler (find-file-name-handler filename 'tramp-set-file-uid-gid)))
(if handler
(funcall handler 'tramp-set-file-uid-gid filename uid gid)
(defmacro tramp--test-instrument-test-case (verbose &rest body)
"Run BODY with `tramp-verbose' equal VERBOSE.
-Print the content of the Tramp debug buffer, if BODY does not
-eval properly in `should' or `should-not'. `should-error' is not
-handled properly. BODY shall not contain a timeout."
+Print the content of the Tramp connection and debug buffers, if
+`tramp-verbose' is greater than 3. `should-error' is not handled
+properly. BODY shall not contain a timeout."
(declare (indent 1) (debug (natnump body)))
`(let ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0)))
(tramp-message-show-message t)
"Check `copy-file'."
(skip-unless (tramp--test-enabled))
- (tramp--test-instrument-test-case (if (getenv "EMACS_EMBA_CI") 10 0)
;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
(dolist (quoted (if (and (tramp--test-expensive-test) (tramp--test-emacs27-p))
'(nil t) '(nil)))
(with-temp-buffer
(insert-file-contents target)
(should (string-equal (buffer-string) "foo")))
- ;; (when (tramp--test-expensive-test)
- ;; (should-error
- ;; (copy-file source target)
- ;; :type 'file-already-exists))
+ (when (tramp--test-expensive-test)
+ (should-error
+ (copy-file source target)
+ :type 'file-already-exists))
(copy-file source target 'ok))
;; Cleanup.
(should (file-exists-p source))
(make-directory target)
(should (file-directory-p target))
- ;; ;; This has been changed in Emacs 26.1.
- ;; (when (and (tramp--test-expensive-test) (tramp--test-emacs26-p))
- ;; (should-error
- ;; (copy-file source target)
- ;; :type 'file-already-exists))
+ ;; This has been changed in Emacs 26.1.
+ (when (and (tramp--test-expensive-test) (tramp--test-emacs26-p))
+ (should-error
+ (copy-file source target)
+ :type 'file-already-exists))
(copy-file source (file-name-as-directory target))
(should
(file-exists-p
;; Cleanup.
(ignore-errors (delete-directory source 'recursive))
- (ignore-errors (delete-directory target 'recursive)))))))))
+ (ignore-errors (delete-directory target 'recursive))))))))
(ert-deftest tramp-test12-rename-file ()
"Check `rename-file'."