(tramp-copy-keep-date t)))
(add-to-list 'tramp-default-method-alist
- `(,tramp-local-host-regexp "\\`root\\'" "su"))
+ `(,tramp-local-host-regexp
+ ,(format "\\`%s\\'" tramp-root-id-string) "su"))
(add-to-list 'tramp-default-user-alist
`(,(concat "\\`" (regexp-opt '("su" "sudo" "doas" "ksu")) "\\'")
- nil "root"))
+ nil ,tramp-root-id-string))
;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
;; Do not add "plink" based methods, they ask interactively for the user.
(add-to-list 'tramp-default-user-alist
;; ... uid and gid
(setq res-uid-string (read (current-buffer)))
(setq res-gid-string (read (current-buffer)))
+ (when (natnump res-uid-string)
+ (setq res-uid-string (number-to-string res-uid-string)))
(unless (stringp res-uid-string)
(setq res-uid-string (symbol-name res-uid-string)))
+ (when (natnump res-gid-string)
+ (setq res-gid-string (number-to-string res-gid-string)))
(unless (stringp res-gid-string)
(setq res-gid-string (symbol-name res-gid-string)))
;; ... size
(cond
;; Some predefined values, which aren't reported sometimes,
;; or would raise problems (all Stopped signals).
- ((= i 0) 0)
+ ((zerop i) 0)
((string-equal (nth i signals) "HUP") "Hangup")
((string-equal (nth i signals) "INT") "Interrupt")
((string-equal (nth i signals) "QUIT") "Quit")
(with-tramp-connection-property vec "remote-shell"
;; CCC: "root" does not exist always, see my QNAP
;; TS-459. Which check could we apply instead?
- (tramp-send-command vec "echo ~root" t)
- (if (or (string-match-p "^~root$" (buffer-string))
+ (tramp-send-command
+ vec (format "echo ~%s" tramp-root-id-string) t)
+ (if (or (string-match-p
+ (format "^~%s$" tramp-root-id-string) (buffer-string))
;; The default shell (ksh93) of OpenSolaris
;; and Solaris is buggy. We've got reports
;; for "SunOS 5.10" and "SunOS 5.11" so far.
(defconst tramp-unknown-id-integer -1
"Integer used to denote an unknown user or group.")
+(defconst tramp-root-id-string "root"
+ "String used to denote the root user or group.")
+
+(defconst tramp-root-id-integer 0
+ "Integer used to denote the root user or group.")
+
;;; File name format:
(defun tramp-build-remote-file-name-spec-regexp ()
(when (and (not tramp-allow-unsafe-temporary-files)
(not backup-inhibited)
(file-in-directory-p (car result) temporary-file-directory)
- (zerop (or (file-attribute-user-id
- (file-attributes filename 'integer))
- tramp-unknown-id-integer))
+ (= (or (file-attribute-user-id
+ (file-attributes filename 'integer))
+ tramp-unknown-id-integer)
+ tramp-root-id-integer)
(not (with-tramp-connection-property
(tramp-get-process v) "unsafe-temporary-file"
(yes-or-no-p
(when (and (not tramp-allow-unsafe-temporary-files)
create-lockfiles
(file-in-directory-p lockname temporary-file-directory)
- (zerop (or (file-attribute-user-id
- (file-attributes file 'integer))
- tramp-unknown-id-integer))
+ (= (or (file-attribute-user-id
+ (file-attributes file 'integer))
+ tramp-unknown-id-integer)
+ tramp-root-id-integer)
(not (with-tramp-connection-property
(tramp-get-process v) "unsafe-temporary-file"
(yes-or-no-p
;; User accessible and owned by user.
(and
(eq access (aref (file-attribute-modes file-attr) offset))
- (or (equal remote-uid tramp-unknown-id-integer)
+ (or (equal remote-uid tramp-root-id-integer)
+ (equal remote-uid tramp-unknown-id-integer)
(equal remote-uid (file-attribute-user-id file-attr))
(equal tramp-unknown-id-integer (file-attribute-user-id file-attr))))
;; Group accessible and owned by user's principal group.
(and
(eq access
(aref (file-attribute-modes file-attr) (+ offset 3)))
- (or (equal remote-gid tramp-unknown-id-integer)
+ (or (equal remote-gid tramp-root-id-integer)
+ (equal remote-gid tramp-unknown-id-integer)
(equal remote-gid (file-attribute-group-id file-attr))
(equal tramp-unknown-id-integer
(file-attribute-group-id file-attr)))))))
(tramp-make-tramp-file-name vec tramp-compat-temporary-file-directory))
;; On some systems, chown runs only for root.
(or (zerop (user-uid))
- (zerop (tramp-get-remote-uid vec 'integer))))))
+ (= (tramp-get-remote-uid vec 'integer) tramp-root-id-integer)))))
(defun tramp-get-remote-tmpdir (vec)
"Return directory for temporary files on the remote host identified by VEC."
(when (and (not tramp-allow-unsafe-temporary-files)
auto-save-default
(file-in-directory-p result temporary-file-directory)
- (zerop (or (file-attribute-user-id
- (file-attributes filename 'integer))
- tramp-unknown-id-integer))
+ (= (or (file-attribute-user-id
+ (file-attributes filename 'integer))
+ tramp-unknown-id-integer)
+ tramp-root-id-integer)
(not (with-tramp-connection-property
(tramp-get-process v) "unsafe-temporary-file"
(yes-or-no-p