From: Michael Albinus Date: Sat, 1 Nov 2014 16:47:09 +0000 (+0100) Subject: * net/tramp-cache.el (tramp-get-file-property) X-Git-Tag: emacs-24.4.90~282 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7a2d5600451b377036d3c59ad78015c30ddfc154;p=emacs.git * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5a02735a3be..98f0d5e4ff8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2014-11-01 Michael Albinus + + * 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 * progmodes/compile.el (compilation-mode): Turn off deferred diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 056b1bdaf91..a6b7500433b 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -144,7 +144,7 @@ Returns DEFAULT if not set." (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)) @@ -161,7 +161,7 @@ Returns 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)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 186a51c5bb8..e120aedfc01 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5289,17 +5289,20 @@ Return ATTR." (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 @@ -5330,17 +5333,20 @@ Return ATTR." (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)