+2014-11-01 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp-cache.el (tramp-get-file-property)
+ (tramp-set-file-property): Check, that `tramp-cache-get-count-*'
+ and `tramp-cache-set-count-*' are bound. Otherwise, there might
+ be compiler warnings.
+
+ * net/tramp-sh.el (tramp-get-remote-uid, tramp-get-remote-gid):
+ Return -1 respective "UNKNOWN", if uid or gid cannot be determined.
+
2014-11-01 Eli Zaretskii <eliz@gnu.org>
* progmodes/compile.el (compilation-mode): Turn off deferred
(tramp-message key 8 "%s %s %s" file property value)
(when (>= tramp-verbose 10)
(let* ((var (intern (concat "tramp-cache-get-count-" property)))
- (val (or (ignore-errors (symbol-value var)) 0)))
+ (val (or (and (boundp var) (symbol-value var)) 0)))
(set var (1+ val))))
value))
(tramp-message key 8 "%s %s %s" file property value)
(when (>= tramp-verbose 10)
(let* ((var (intern (concat "tramp-cache-set-count-" property)))
- (val (or (ignore-errors (symbol-value var)) 0)))
+ (val (or (and (boundp var) (symbol-value var)) 0)))
(set var (1+ val))))
value))
(defun tramp-get-remote-uid (vec id-format)
(with-tramp-connection-property vec (format "uid-%s" id-format)
- (let ((res (cond
- ((tramp-get-remote-id vec)
- (tramp-get-remote-uid-with-id vec id-format))
- ((tramp-get-remote-perl vec)
- (tramp-get-remote-uid-with-perl vec id-format))
- ((tramp-get-remote-python vec)
- (tramp-get-remote-uid-with-python vec id-format))
- (t (tramp-error
- vec 'file-error "Cannot determine remote uid")))))
- ;; The command might not always return a number.
- (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
+ (let ((res
+ (ignore-errors
+ (cond
+ ((tramp-get-remote-id vec)
+ (tramp-get-remote-uid-with-id vec id-format))
+ ((tramp-get-remote-perl vec)
+ (tramp-get-remote-uid-with-perl vec id-format))
+ ((tramp-get-remote-python vec)
+ (tramp-get-remote-uid-with-python vec id-format))))))
+ ;; Ensure there is a valid result.
+ (cond
+ ((and (equal id-format 'integer) (not (integerp res))) -1)
+ ((and (equal id-format 'string) (not (stringp res))) "UNKNOWN")
+ (t res)))))
(defun tramp-get-remote-gid-with-id (vec id-format)
(tramp-send-command-and-read
(defun tramp-get-remote-gid (vec id-format)
(with-tramp-connection-property vec (format "gid-%s" id-format)
- (let ((res (cond
- ((tramp-get-remote-id vec)
- (tramp-get-remote-gid-with-id vec id-format))
- ((tramp-get-remote-perl vec)
- (tramp-get-remote-gid-with-perl vec id-format))
- ((tramp-get-remote-python vec)
- (tramp-get-remote-gid-with-python vec id-format))
- (t (tramp-error
- vec 'file-error "Cannot determine remote gid")))))
- ;; The command might not always return a number.
- (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
+ (let ((res
+ (ignore-errors
+ (cond
+ ((tramp-get-remote-id vec)
+ (tramp-get-remote-gid-with-id vec id-format))
+ ((tramp-get-remote-perl vec)
+ (tramp-get-remote-gid-with-perl vec id-format))
+ ((tramp-get-remote-python vec)
+ (tramp-get-remote-gid-with-python vec id-format))))))
+ ;; Ensure there is a valid result.
+ (cond
+ ((and (equal id-format 'integer) (not (integerp res))) -1)
+ ((and (equal id-format 'string) (not (stringp res))) "UNKNOWN")
+ (t res)))))
;; Some predefined connection properties.
(defun tramp-get-inline-compress (vec prop size)