1 new commit in tramp:
https://bitbucket.org/xemacs/tramp/commits/1706a2b82aef/
changeset: 1706a2b82aef
user: albinus
date: 2013-03-15 17:02:30
summary: Version 2.2.7 released.
affected #: 14 files
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-03-15 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * Makefile (AUTHOR_VERSION): Bump to 2.2.7.
+
2013-02-08 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.44 released.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 ChangeLog.upstream
--- a/ChangeLog.upstream
+++ b/ChangeLog.upstream
@@ -1,3 +1,12 @@
+2013-03-15 Michael Albinus <michael.albinus(a)gmx.de>
+
+ Version 2.2.7 released.
+
+ * configure.ac: Bump version.
+
+ * Makefile.in (gittag): Renamed from cvstag. Adapt commands.
+ (tar): Remove temporary directory.
+
2012-12-14 Michael Albinus <michael.albinus(a)gmx.de>
* README: Mention README-GIT and download.sh.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 Makefile
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@
# Boston, MA 02111-1307, USA.
VERSION = 1.44
-AUTHOR_VERSION = 2.2.7-pre
+AUTHOR_VERSION = 2.2.7
MAINTAINER = Michael Albinus <michael.albinus(a)gmx.de>
PACKAGE = tramp
PKG_TYPE = regular
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,222 @@
+2013-03-15 Michael Albinus <michael.albinus(a)gmx.de>
+
+ Version 2.2.7 released.
+
+2013-03-13 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-sh.el (tramp-sh-handle-insert-directory): Check, whether
+ `default-file-name-coding-system' is bound. It isn't in XEmacs.
+
+2013-03-09 Michael Albinus <michael.albinus(a)gmx.de>
+
+ Major rewrite due to changed D-Bus interface of GVFS 1.14.
+
+ * tramp-gvfs.el (top): Extend check for gvfs availability.
+ (tramp-gvfs-methods-mounttracker, tramp-gvfs-listmounts)
+ (tramp-gvfs-mountlocation, tramp-gvfs-mountlocation-signature):
+ New defconst.
+ (tramp-gvfs-file-name-handler-alist) [directory-files]:
+ [directory-files-and-attributes, file-exists-p, file-modes]: Use
+ Tramp default handler.
+ [file-acl, file-selinux-context, process-file, set-file-acl]:
+ [set-file-modes, set-file-selinux-context, shell-command]:
+ [start-file-process ]: Remove handler.
+ [verify-visited-file-modtime]: New handler.
+ (tramp-gvfs-dbus-string-to-byte-array)
+ (tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all
+ calls of `dbus-string-to-byte-array' and
+ `tramp-gvfs-dbus-byte-array-to-string'.
+ (tramp-gvfs-handle-copy-file)
+ (tramp-gvfs-handle-delete-directory)
+ (tramp-gvfs-handle-delete-file, tramp-gvfs-handle-file-attributes)
+ (tramp-gvfs-handle-file-directory-p)
+ (tramp-gvfs-handle-file-executable-p)
+ (tramp-gvfs-handle-file-name-all-completions)
+ (tramp-gvfs-handle-file-readable-p)
+ (tramp-gvfs-handle-file-writable-p)
+ (tramp-gvfs-handle-insert-directory)
+ (tramp-gvfs-handle-insert-file-contents)
+ (tramp-gvfs-handle-make-directory, tramp-gvfs-handle-rename-file)
+ (tramp-gvfs-handle-set-visited-file-modtime)
+ (tramp-gvfs-handle-write-region): Rewrite.
+ (tramp-gvfs-handle-file-acl)
+ (tramp-gvfs-handle-file-selinux-context)
+ (tramp-gvfs-handle-process-file, tramp-gvfs-handle-set-file-acl)
+ (tramp-gvfs-handle-set-file-modes)
+ (tramp-gvfs-handle-set-file-selinux-context)
+ (tramp-gvfs-handle-shell-command)
+ (tramp-gvfs-handle-start-file-process)
+ (tramp-gvfs-handle-verify-visited-file-modtime): Remove defuns.
+ (tramp-gvfs-url-file-name): Do not use `file-truename', we work
+ over the symlinks. Fix user handling.
+ (top, tramp-gvfs-handler-mounted-unmounted): Handle different names
+ of the D-Bus signals.
+ (tramp-gvfs-connection-mounted-p): Handle different names of the
+ D-Bus methods.
+ (tramp-gvfs-mount-spec-entry): New defun.
+ (tramp-gvfs-mount-spec): Use it.
+ (tramp-gvfs-maybe-open-connection): Check, that in case of "smb"
+ there is a share name. Handle different names of the D-Bus
+ signals and methods. Set connection properties needed for
+ `tramp-check-cached-permissions'.
+ (tramp-gvfs-send-command): Apply `tramp-gvfs-maybe-open-connection'.
+ Return t or nil.
+
+ * tramp.el (tramp-backtrace): Move up.
+ (tramp-error): Dump a backtrace into the debug buffer when
+ `tramp-verbose > 9.
+ (tramp-file-mode-type-map, tramp-file-mode-from-int)
+ (tramp-file-mode-permissions, tramp-get-local-uid)
+ (tramp-get-local-gid, tramp-check-cached-permissions): Move from
+ tramp-sh.el.
+
+ * tramp-sh.el (tramp-file-mode-type-map)
+ (tramp-check-cached-permissions, tramp-file-mode-from-int)
+ (tramp-file-mode-permissions, tramp-get-local-uid)
+ (tramp-get-local-gid): Move to tramp.el.
+
+2013-03-05 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-compat.el (tramp-compat-delete-directory): Implement TRASH
+ argument.
+
+2013-03-03 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-adb.el (tramp-adb-maybe-open-connection): Cache, whether
+ the "su" command is available on the device.
+
+2013-03-01 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-adb.el (tramp-adb-prompt): Extend regexp.
+ (tramp-adb-handle-process-file): Remove superfluous setting.
+ (tramp-adb-command-exit-status): Handle case that COMMAND is nil.
+ (tramp-adb-barf-unless-okay): Use `tramp-adb-command-exit-status'.
+ (tramp-adb-maybe-open-connection): Apply "su" if user is defined.
+
+ * tramp.el (tramp-obsolete-methods): New defconst.
+ (tramp-warned-obsolete-methods): New defvar.
+ (tramp-find-method): Check for obsolete methods. Map them to a
+ replacement method if appropriate.
+
+ * tramp-sh.el (tramp-methods) [scp1, scp2, ssh1, ssh2, plink1]:
+ Remove methods.
+ (top): Remove completion functions for "scp1", "scp2",
"ssh1",
+ "ssh2" and "plink1".
+
+2013-02-28 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-adb.el (tramp-adb-sdk-dir): Remove. Replaced by ...
+ (tramp-adb-program): New defcustom. Remove function. Adapt calls.
+
+2013-02-27 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-adb.el (tramp-adb-parse-device-names)
+ (tramp-adb-maybe-open-connection): Add timeouts. (Bug#13299)
+
+2013-02-26 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-sh.el (tramp-sh-handle-insert-directory): Add
+ "2>/dev/null" to the ls command, in case "en_US.utf8" is not
+ defined. POSIX environments fall back to the "C" locale then and
+ emit a warning, which shall be suppressed.
+
+2013-02-23 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.el (tramp-methods): Fix docstring.
+ (tramp-ssh-controlmaster-options): Rename it from
+ `tramp-ssh-controlmaster-template'. Return a string.
+ (tramp-default-method): Adapt check for
+ `tramp-ssh-controlmaster-options'.
+
+ * tramp-sh.el (tramp-methods): Replace
+ `tramp-ssh-controlmaster-template' by "%c".
+ (tramp-do-copy-or-rename-file-out-of-band)
+ (tramp-maybe-open-connection): Use it in format spec. Ensure,
+ that it is applied for the first hop only.
+
+2013-02-22 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.el (tramp-tramp-file-p): Fix docstring.
+
+ * tramp-sh.el (tramp-sh-handle-insert-directory): Handle multibyte
+ file names.
+
+2013-02-21 Glenn Morris <rgm(a)gnu.org>
+
+ * tramp.el (tramp-get-debug-buffer): Ensure outline.el is not
+ loaded while outline-regexp is let bound. (Bug#9584)
+
+2013-02-21 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.el (tramp-ssh-controlmaster-template): Make it a
+ defconst. Apply independent check for ControlPersist.
+
+ * tramp-sh.el (tramp-sh-handle-set-file-times): Set $UTC only
+ temporarily, via "env".
+
+2013-02-19 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-cache.el (tramp-get-hash-table): New defun.
+ (tramp-get-file-property, tramp-set-file-property)
+ (tramp-get-connection-property, tramp-set-connection-property): Use it.
+ (tramp-flush-file-property, tramp-flush-directory-property):
+ Rename argument to KEY.
+ (tramp-flush-connection-property): Simplify a little bit.
+ (tramp-connection-property-p): New defun.
+ (top): Reapply saved values only if there isn't a corresponding
+ entry in `tramp-connection-properties'.
+
+2013-02-17 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-sh.el (tramp-sh-handle-start-file-process): Let-bind
+ `tramp-current-connection' in order to avoid an error when several
+ commands are invoked in a short time in eshell and friends.
+
+2013-02-16 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-cache.el (tramp-connection-properties): New customer option.
+ (tramp-get-connection-property): Use it.
+
+ * tramp-compat.el (top): Require 'trampver.
+
+ * tramp-sh.el (tramp-remote-process-environment): Set
+ tramp-autoload cookie.
+
+2013-02-14 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.el (tramp-debug-message): Add
+ `tramp-condition-case-unless-debug'.
+ (tramp-debug-on-error): New defvar.
+ (tramp-condition-case-unless-debug): New defun.
+ (tramp-file-name-handler): Use it.
+
+2013-02-13 Michael Albinus <michael.albinus(a)gmx.de>
+
+ Use ControlMaster where applicable. (Bug#13677)
+
+ * tramp.el (tramp-ssh-controlmaster-template): New defvar,
+ replacing `tramp-detect-ssh-controlmaster'.
+ (tramp-default-method): Use it.
+
+ * tramp-sh.el (tramp-methods) [scp, scp1, scp2, scpx, sftp]:
+ [rsync, ssh, ssh1, ssh2, sshx]: Add ControlPath and ControlMaster
+ arguments.
+ [scpc, rsyncc]: Remove methods.
+ (top): Remove completion functions for "scpc", "rsyncc",
"ssh1_old"
+ and "ssh2_old".
+ (tramp-do-copy-or-rename-file-out-of-band): Change trace level.
+ (tramp-maybe-open-connection): Reuse tmpfile for ControlPath.
+
+2013-02-12 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp-adb.el (tramp-adb-handle-start-file-process): Rewrite.
+
+ * tramp-compat.el (top): Declare `remote-file-name-inhibit-cache'
+ only if it doesn't exist.
+
+ * tramp-sh.el (tramp-sh-handle-start-file-process): Set process
+ marker.
+
2013-02-03 Michael Albinus <michael.albinus(a)gmx.de>
* tramp.el (tramp-debug-message): Extend function exclude list.
@@ -184,7 +403,7 @@
2012-12-31 Jürgen Hötzel <juergen(a)archlinux.org>
* tramp-adb.el (tramp-adb-maybe-open-connection): Handle errors
- (No device connected, invalid device name). (Bug #13299)
+ (No device connected, invalid device name). (Bug #13299)
2012-12-30 Michael Albinus <michael.albinus(a)gmx.de>
@@ -222,7 +441,7 @@
* tramp-adb.el (tramp-adb-get-ls-command): New defun. Suppress
coloring, if possible (required for BusyBox based systems like
- CynagenMod).
+ CyanogenMod).
2012-12-22 Michael Albinus <michael.albinus(a)gmx.de>
@@ -275,7 +494,7 @@
2012-12-14 Paul Eggert <eggert(a)cs.ucla.edu>
- Fix permissions bugs with setgid directories etc. (Bug#13125)
+ Fix permissions bugs with setgid directories etc. (Bug#13125)
* tramp-sh.el (tramp-sh-handle-file-ownership-preserved-p): New
optional arg GROUP.
@@ -329,7 +548,7 @@
(tramp-adb-handle-file-writable-p): Use it. Use also
`file-directory-p' and `file-writable-p' in order to force caching.
-2012-12-02 Juergen Hoetzel <juergen(a)archlinux.org>
+2012-12-02 Jürgen Hötzel <juergen(a)archlinux.org>
* tramp-adb.el (top): Remove dependency on CL sequence functions.
(tramp-adb-prompt): Add prompt used on Android > 4.0 devices.
@@ -356,7 +575,7 @@
`tramp-with-progress-reporter' and `string-to-number' instead of
`string-to-int.
-2012-11-23 Juergen Hoetzel <juergen(a)archlinux.org>
+2012-11-23 Jürgen Hötzel <juergen(a)archlinux.org>
* tramp-adb.el: New package.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/Makefile
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -31,14 +31,14 @@
MKDIR = @mkdir -p
RM = -rm -f
-builddir = /home/albinus/src/tramp/lisp
+builddir = /usr/local/src/tramp/lisp
prefix = /usr/local
datarootdir = ${prefix}/share
datadir = ${datarootdir}
lispdir = ${datadir}/emacs/site-lisp
DESTDIR =
-CONTRIB_FILES =
+CONTRIB_FILES =
CLEAN_FILES = .\\\#* \\\#* .*~ *~ *.aux *.cp *.cps *.diff *.dvi *.elc *.fn *.fns *.html
*.info *.ky *.log *.pg *.tmp *.toc *.tp *.vr *.vrs
# trampver.el and tramp.el must be handled first due to dependencies.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/tramp-adb.el
--- a/lisp/tramp-adb.el
+++ b/lisp/tramp-adb.el
@@ -23,10 +23,11 @@
;;; Commentary:
-;; The Android Debug Bridge must be installed on your local machine.
-;; Add the following form into your .emacs:
+;; The Android Debug Bridge "adb" must be installed on your local
+;; machine. If it is not in your $PATH, add the following form into
+;; your .emacs:
;;
-;; (setq tramp-adb-sdk-dir "/path/to/android/sdk")
+;; (setq tramp-adb-program "/path/to/adb")
;;
;; Due to security it is not possible to access non-root devices.
@@ -37,18 +38,18 @@
(defvar dired-move-to-filename-regexp)
-(defcustom tramp-adb-sdk-dir "~/Android/sdk"
- "Set to the directory containing the Android SDK."
-:type 'string
+(defcustom tramp-adb-program "adb"
+ "Name of the Android Debug Bridge program."
+:group 'tramp
:version "24.4"
-:group 'tramp)
+:type 'string)
;;;###tramp-autoload
(defconst tramp-adb-method "adb"
"*When this method name is used, forward all calls to Android Debug
Bridge.")
(defcustom tramp-adb-prompt
- "^\\(?:[[:alnum:]]*@[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
+
"^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]]*@[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
"Regexp used as prompt in almquist shell."
:type 'string
:version "24.4"
@@ -149,21 +150,17 @@
(save-match-data (apply (cdr fn) args))
(tramp-run-real-handler operation args))))
-;; This cannot be a constant, because `tramp-adb-sdk-dir' is customizable.
-(defun tramp-adb-program ()
- "The Android Debug Bridge."
- (expand-file-name "platform-tools/adb" tramp-adb-sdk-dir))
-
;;;###tramp-autoload
(defun tramp-adb-parse-device-names (ignore)
"Return a list of (nil host) tuples allowed to access."
- (with-temp-buffer
- (when (zerop (call-process (tramp-adb-program) nil t nil "devices"))
- (let (result)
- (goto-char (point-min))
- (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t)
- (add-to-list 'result (list nil (match-string 1))))
- result))))
+ (with-timeout (10)
+ (with-temp-buffer
+ (when (zerop (call-process tramp-adb-program nil t nil "devices"))
+ (let (result)
+ (goto-char (point-min))
+ (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t)
+ (add-to-list 'result (list nil (match-string 1))))
+ result)))))
(defun tramp-adb-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for Tramp files."
@@ -778,13 +775,11 @@
;; directory.
(condition-case nil
(progn
- (setq ret 0
- ret
- (tramp-adb-barf-unless-okay
- v (format "(cd %s; %s)"
- (tramp-shell-quote-argument localname)
- command)
- ""))
+ (setq ret 0)
+ (tramp-adb-barf-unless-okay
+ v (format "(cd %s; %s)"
+ (tramp-shell-quote-argument localname) command)
+ "")
;; We should show the output anyway.
(when outbuf
(with-current-buffer outbuf
@@ -902,42 +897,76 @@
(defun tramp-adb-handle-start-file-process (name buffer program &rest args)
"Like `start-file-process' for Tramp files."
(with-parsed-tramp-file-name default-directory nil
- ;; When PROGRAM is nil, we just provide a tty.
+ ;; When PROGRAM is nil, we should provide a tty. This is not
+ ;; possible here.
+ (unless (stringp program)
+ (tramp-error v 'file-error "PROGRAM must be a string"))
+
(let ((command
- (when (stringp program)
- (format "cd %s; %s"
- (tramp-shell-quote-argument localname)
- (mapconcat 'tramp-shell-quote-argument
- (cons program args) " "))))
+ (format "cd %s; %s"
+ (tramp-shell-quote-argument localname)
+ (mapconcat 'tramp-shell-quote-argument
+ (cons program args) " ")))
(tramp-process-connection-type
(or (null program) tramp-process-connection-type))
+ (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
(name1 name)
(i 0))
- (unwind-protect
- (save-excursion
- (save-restriction
- (while (get-process name1)
- ;; NAME must be unique as process name.
- (setq i (1+ i)
- name1 (format "%s<%d>" name i)))
- (setq name name1)
- ;; Set the new process properties.
- (tramp-set-connection-property v "process-name" name)
- (when command
- (let* ((host (tramp-file-name-host v))
- (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))
- (args (if (> (length host) 0)
- (list "-s" host "shell" command)
- (list "shell" command)))
- (p (apply 'start-process (tramp-get-connection-name v) buffer
- (tramp-adb-program) args)))
- ;; Set sentinel and query flag for this process.
- (tramp-set-connection-property p "vector" v)
- (set-process-sentinel p 'tramp-process-sentinel)
- (tramp-compat-set-process-query-on-exit-flag p t)
- ;; Return process.
- p))))
- (tramp-set-connection-property v "process-name" nil)))))
+
+ (unless buffer
+ ;; BUFFER can be nil. We use a temporary buffer.
+ (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
+ (while (get-process name1)
+ ;; NAME must be unique as process name.
+ (setq i (1+ i)
+ name1 (format "%s<%d>" name i)))
+ (setq name name1)
+ ;; Set the new process properties.
+ (tramp-set-connection-property v "process-name" name)
+ (tramp-set-connection-property v "process-buffer" buffer)
+
+ (with-current-buffer (tramp-get-connection-buffer v)
+ (unwind-protect
+ ;; We catch this event. Otherwise, `start-process' could
+ ;; be called on the local host.
+ (save-excursion
+ (save-restriction
+ ;; Activate narrowing in order to save BUFFER
+ ;; contents. Clear also the modification time;
+ ;; otherwise we might be interrupted by
+ ;; `verify-visited-file-modtime'.
+ (let ((buffer-undo-list t)
+ (buffer-read-only nil)
+ (mark (point)))
+ (clear-visited-file-modtime)
+ (narrow-to-region (point-max) (point-max))
+ ;; We call `tramp-adb-maybe-open-connection', in
+ ;; order to cleanup the prompt afterwards.
+ (tramp-adb-maybe-open-connection v)
+ (widen)
+ (delete-region mark (point))
+ (narrow-to-region (point-max) (point-max))
+ ;; Send the command.
+ (let ((tramp-adb-prompt (regexp-quote command)))
+ (tramp-adb-send-command v command))
+ (let ((p (tramp-get-connection-process v)))
+ ;; Set query flag and process marker for this
+ ;; process. We ignore errors, because the process
+ ;; could have finished already.
+ (ignore-errors
+ (tramp-compat-set-process-query-on-exit-flag p t)
+ (set-marker (process-mark p) (point)))
+ ;; Return process.
+ p))))
+
+ ;; Save exit.
+ (if (string-match tramp-temp-buffer-name (buffer-name))
+ (ignore-errors
+ (set-process-buffer (tramp-get-connection-process v) nil)
+ (kill-buffer (current-buffer)))
+ (set-buffer-modified-p bmp))
+ (tramp-set-connection-property v "process-name" nil)
+ (tramp-set-connection-property v "process-buffer" nil))))))
;; Helper functions.
@@ -947,11 +976,11 @@
(setq args (append (list "-s" (tramp-file-name-host vec)) args)))
(with-temp-buffer
(prog1
- (unless (zerop (apply 'call-process (tramp-adb-program) nil t nil args))
+ (unless (zerop (apply 'call-process tramp-adb-program nil t nil args))
(buffer-string))
(tramp-message
vec 6 "%s %s\n%s"
- (tramp-adb-program) (mapconcat 'identity args " ")
(buffer-string)))))
+ tramp-adb-program (mapconcat 'identity args " ")
(buffer-string)))))
(defun tramp-adb-find-test-command (vec)
"Checks, whether the ash has a builtin \"test\" command.
@@ -980,34 +1009,31 @@
(while (re-search-forward "\r+$" nil t)
(replace-match "" nil nil)))))
-(defun tramp-adb-barf-unless-okay (vec command fmt &rest args)
- "Run COMMAND, check exit status, throw error if exit status not okay.
-FMT and ARGS are passed to `error'."
- (tramp-adb-send-command vec (format "%s; echo tramp_exit_status $?"
command))
+(defun tramp-adb-command-exit-status
+ (vec command)
+ "Run COMMAND and return its exit status.
+Sends `echo $?' along with the COMMAND for checking the exit status. If
+COMMAND is nil, just sends `echo $?'. Returns the exit status found."
+ (tramp-adb-send-command
+ vec (if command
+ (format "%s; echo tramp_exit_status $?" command)
+ "echo tramp_exit_status $?"))
(with-current-buffer (tramp-get-connection-buffer vec)
(goto-char (point-max))
(unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
(tramp-error
vec 'file-error "Couldn't find exit status of `%s'"
command))
(skip-chars-forward "^ ")
- (unless (zerop (read (current-buffer)))
- (apply 'tramp-error vec 'file-error fmt args))
- (let (buffer-read-only)
- (delete-region (match-beginning 0) (point-max)))))
+ (prog1
+ (read (current-buffer))
+ (let (buffer-read-only)
+ (delete-region (match-beginning 0) (point-max))))))
-(defun tramp-adb-command-exit-status
- (vec command)
- "Run COMMAND and return its exit status.
-Sends `echo $?' along with the COMMAND for checking the exit status. If
-COMMAND is nil, just sends `echo $?'. Returns the exit status found."
- (tramp-adb-send-command vec (format "%s; echo tramp_exit_status $?"
command))
- (with-current-buffer (tramp-get-connection-buffer vec)
- (goto-char (point-max))
- (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
- (tramp-error
- vec 'file-error "Couldn't find exit status of `%s'"
command))
- (skip-chars-forward "^ ")
- (read (current-buffer))))
+(defun tramp-adb-barf-unless-okay (vec command fmt &rest args)
+ "Run COMMAND, check exit status, throw error if exit status not okay.
+FMT and ARGS are passed to `error'."
+ (unless (zerop (tramp-adb-command-exit-status vec command))
+ (apply 'tramp-error vec 'file-error fmt args)))
(defun tramp-adb-wait-for-output (proc &optional timeout)
"Wait for output from remote command."
@@ -1046,7 +1072,15 @@
(let* ((buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf))
(host (tramp-file-name-host vec))
+ (user (tramp-file-name-user vec))
(devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
+
+ ;; Maybe we know already that "su" is not supported. We cannot
+ ;; use a connection property, because we have not checked yet
+ ;; whether it is still the same device.
+ (when (and user (not (tramp-get-file-property vec ""
"su-command-p" t)))
+ (tramp-error vec 'file-error "Cannot switch to user `%s'" user))
+
(unless
(and p (processp p) (memq (process-status p) '(run open)))
(save-match-data
@@ -1068,11 +1102,11 @@
(p (let ((default-directory
(tramp-compat-temporary-file-directory)))
(apply 'start-process (tramp-get-connection-name vec) buf
- (tramp-adb-program) args))))
+ tramp-adb-program args))))
(tramp-message
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
;; Wait for initial prompt.
- (tramp-adb-wait-for-output p)
+ (tramp-adb-wait-for-output p 30)
(unless (eq 'run (process-status p))
(tramp-error vec 'file-error "Terminated!"))
(tramp-compat-set-process-query-on-exit-flag p nil)
@@ -1101,6 +1135,15 @@
old-getprop new-getprop)
(tramp-adb-maybe-open-connection vec)))
+ ;; Change user if indicated.
+ (when user
+ (tramp-adb-send-command vec (format "su %s" user))
+ (unless (zerop (tramp-adb-command-exit-status vec nil))
+ (delete-process p)
+ (tramp-set-file-property vec "" "su-command-p" nil)
+ (tramp-error
+ vec 'file-error "Cannot switch to user `%s'" user)))
+
;; Set "remote-path" connection property. This is needed
;; for eshell.
(tramp-adb-send-command vec "echo \\\"$PATH\\\"")
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/tramp-cache.el
--- a/lisp/tramp-cache.el
+++ b/lisp/tramp-cache.el
@@ -58,6 +58,19 @@
(defvar tramp-cache-data (make-hash-table :test 'equal)
"Hash table for remote files properties.")
+;;;###tramp-autoload
+(defcustom tramp-connection-properties nil
+ "List of static connection properties.
+Every entry has the form (REGEXP PROPERTY VALUE). The regexp
+matches remote file names. It can be nil. PROPERTY is a string,
+and VALUE the corresponding value. They are used, if there is no
+matching entry in for PROPERTY in `tramp-cache-data'."
+:group 'tramp
+:version "24.4"
+:type '(repeat (list (choice :tag "File Name regexp" regexp (const nil))
+ (choice :tag " Property" string)
+ (choice :tag " Value" sexp))))
+
(defcustom tramp-persistency-file-name
(cond
;; GNU Emacs.
@@ -85,16 +98,30 @@
(defvar tramp-cache-data-changed nil
"Whether persistent cache data have been changed.")
+(defun tramp-get-hash-table (key)
+ "Returns the hash table for KEY.
+If it doesn't exist yet, it is created and initialized with
+matching entries of `tramp-connection-properties'."
+ (or (gethash key tramp-cache-data)
+ (let ((hash
+ (puthash key (make-hash-table :test 'equal) tramp-cache-data)))
+ (when (vectorp key)
+ (dolist (elt tramp-connection-properties)
+ (when (string-match
+ (or (nth 0 elt) "")
+ (tramp-make-tramp-file-name
+ (aref key 0) (aref key 1) (aref key 2) nil))
+ (tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))))
+ hash)))
+
;;;###tramp-autoload
-(defun tramp-get-file-property (vec file property default)
- "Get the PROPERTY of FILE from the cache context of VEC.
+(defun tramp-get-file-property (key file property default)
+ "Get the PROPERTY of FILE from the cache context of KEY.
Returns DEFAULT if not set."
;; Unify localname.
- (setq vec (copy-sequence vec))
- (aset vec 3 (tramp-run-real-handler 'directory-file-name (list file)))
- (let* ((hash (or (gethash vec tramp-cache-data)
- (puthash vec (make-hash-table :test 'equal)
- tramp-cache-data)))
+ (setq key (copy-sequence key))
+ (aset key 3 (tramp-run-real-handler 'directory-file-name (list file)))
+ (let* ((hash (tramp-get-hash-table key))
(value (when (hash-table-p hash) (gethash property hash))))
(if
;; We take the value only if there is any, and
@@ -112,7 +139,7 @@
(setq value (cdr value))
(setq value default))
- (tramp-message vec 8 "%s %s %s" file property value)
+ (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)))
@@ -120,18 +147,16 @@
value))
;;;###tramp-autoload
-(defun tramp-set-file-property (vec file property value)
- "Set the PROPERTY of FILE to VALUE, in the cache context of VEC.
+(defun tramp-set-file-property (key file property value)
+ "Set the PROPERTY of FILE to VALUE, in the cache context of KEY.
Returns VALUE."
;; Unify localname.
- (setq vec (copy-sequence vec))
- (aset vec 3 (tramp-run-real-handler 'directory-file-name (list file)))
- (let ((hash (or (gethash vec tramp-cache-data)
- (puthash vec (make-hash-table :test 'equal)
- tramp-cache-data))))
+ (setq key (copy-sequence key))
+ (aset key 3 (tramp-run-real-handler 'directory-file-name (list file)))
+ (let ((hash (tramp-get-hash-table key)))
;; We put the timestamp there.
(puthash property (cons (current-time) value) hash)
- (tramp-message vec 8 "%s %s %s" file property 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)))
@@ -139,26 +164,26 @@
value))
;;;###tramp-autoload
-(defun tramp-flush-file-property (vec file)
- "Remove all properties of FILE in the cache context of VEC."
+(defun tramp-flush-file-property (key file)
+ "Remove all properties of FILE in the cache context of KEY."
;; Remove file property of symlinks.
- (let ((truename (tramp-get-file-property vec file "file-truename" nil)))
+ (let ((truename (tramp-get-file-property key file "file-truename" nil)))
(when (and (stringp truename)
(not (string-equal file truename)))
- (tramp-flush-file-property vec truename)))
+ (tramp-flush-file-property key truename)))
;; Unify localname.
- (setq vec (copy-sequence vec))
- (aset vec 3 (tramp-run-real-handler 'directory-file-name (list file)))
- (tramp-message vec 8 "%s" file)
- (remhash vec tramp-cache-data))
+ (setq key (copy-sequence key))
+ (aset key 3 (tramp-run-real-handler 'directory-file-name (list file)))
+ (tramp-message key 8 "%s" file)
+ (remhash key tramp-cache-data))
;;;###tramp-autoload
-(defun tramp-flush-directory-property (vec directory)
- "Remove all properties of DIRECTORY in the cache context of VEC.
+(defun tramp-flush-directory-property (key directory)
+ "Remove all properties of DIRECTORY in the cache context of KEY.
Remove also properties of all files in subdirectories."
(let ((directory (tramp-run-real-handler
'directory-file-name (list directory))))
- (tramp-message vec 8 "%s" directory)
+ (tramp-message key 8 "%s" directory)
(maphash
(lambda (key value)
(when (and (stringp (tramp-file-name-localname key))
@@ -203,7 +228,7 @@
(when (vectorp key)
(setq key (copy-sequence key))
(aset key 3 nil))
- (let* ((hash (gethash key tramp-cache-data))
+ (let* ((hash (tramp-get-hash-table key))
(value (if (hash-table-p hash)
(gethash property hash default)
default)))
@@ -220,15 +245,19 @@
(when (vectorp key)
(setq key (copy-sequence key))
(aset key 3 nil))
- (let ((hash (or (gethash key tramp-cache-data)
- (puthash key (make-hash-table :test 'equal)
- tramp-cache-data))))
+ (let ((hash (tramp-get-hash-table key)))
(puthash property value hash)
(setq tramp-cache-data-changed t)
(tramp-message key 7 "%s %s" property value)
value))
;;;###tramp-autoload
+(defun tramp-connection-property-p (key property)
+ "Check whether named PROPERTY of a connection is defined.
+KEY identifies the connection, it is either a process or a vector."
+ (not (eq (tramp-get-connection-property key property 'undef) 'undef)))
+
+;;;###tramp-autoload
(defun tramp-flush-connection-property (key)
"Remove all properties identified by KEY.
KEY identifies the connection, it is either a process or a vector."
@@ -241,10 +270,8 @@
key 7 "%s %s" key
(let ((hash (gethash key tramp-cache-data))
properties)
- (if (hash-table-p hash)
- (maphash
- (lambda (x y) (add-to-list 'properties x 'append))
- (gethash key tramp-cache-data)))
+ (when (hash-table-p hash)
+ (maphash (lambda (x y) (add-to-list 'properties x 'append)) hash))
properties))
(setq tramp-cache-data-changed t)
(remhash key tramp-cache-data))
@@ -365,7 +392,11 @@
(while (setq element (pop list))
(setq key (pop element))
(while (setq item (pop element))
- (tramp-set-connection-property key (pop item) (car item)))))
+ ;; We set only values which are not contained in
+ ;; `tramp-connection-properties'. The cache is
+ ;; initialized properly by side effect.
+ (unless (tramp-connection-property-p key (car item))
+ (tramp-set-connection-property key (pop item) (car item))))))
(setq tramp-cache-data-changed nil))
(file-error
;; Most likely because the file doesn't exist yet. No message.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/tramp-compat.el
--- a/lisp/tramp-compat.el
+++ b/lisp/tramp-compat.el
@@ -52,6 +52,7 @@
(require 'format-spec)
(require 'shell)
+ (require 'trampver)
(require 'tramp-loaddefs)
;; As long as password.el is not part of (X)Emacs, it shouldn't be
@@ -96,7 +97,8 @@
;; `remote-file-name-inhibit-cache' has been introduced with Emacs 24.1.
;; Besides `t', `nil', and integer, we use also timestamps (as
;; returned by `current-time') internally.
- (defvar remote-file-name-inhibit-cache nil)
+ (unless (boundp 'remote-file-name-inhibit-cache)
+ (defvar remote-file-name-inhibit-cache nil))
;; For not existing functions, or functions with a changed argument
;; list, there are compiler warnings. We want to avoid them in
@@ -382,25 +384,30 @@
trash)))
(delete-file filename)))))
-;; RECURSIVE has been introduced with Emacs 23.2.
-(defun tramp-compat-delete-directory (directory &optional recursive)
+;; RECURSIVE has been introduced with Emacs 23.2. TRASH has been
+;; introduced with Emacs 24.1.
+(defun tramp-compat-delete-directory (directory &optional recursive trash)
"Like `delete-directory' for Tramp files (compat function)."
- (if (null recursive)
- (delete-directory directory)
- (condition-case nil
- (tramp-compat-funcall 'delete-directory directory recursive)
- ;; This Emacs version does not support the RECURSIVE flag. We
- ;; use the implementation from Emacs 23.2.
- (wrong-number-of-arguments
- (setq directory (directory-file-name (expand-file-name directory)))
- (if (not (file-symlink-p directory))
- (mapc (lambda (file)
- (if (eq t (car (file-attributes file)))
- (tramp-compat-delete-directory file recursive)
- (delete-file file)))
- (directory-files
- directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
- (delete-directory directory)))))
+ (condition-case nil
+ (cond
+ (trash
+ (tramp-compat-funcall 'delete-directory directory recursive trash))
+ (recursive
+ (tramp-compat-funcall 'delete-directory directory recursive))
+ (t
+ (delete-directory directory)))
+ ;; This Emacs version does not support the RECURSIVE or TRASH flag. We
+ ;; use the implementation from Emacs 23.2.
+ (wrong-number-of-arguments
+ (setq directory (directory-file-name (expand-file-name directory)))
+ (if (not (file-symlink-p directory))
+ (mapc (lambda (file)
+ (if (eq t (car (file-attributes file)))
+ (tramp-compat-delete-directory file recursive trash)
+ (tramp-compat-delete-file file trash)))
+ (directory-files
+ directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
+ (delete-directory directory))))
;; `number-sequence' does not exist in XEmacs. Implementation is
;; taken from Emacs 23.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/tramp-sh.el
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -109,69 +109,15 @@
(tramp-copy-keep-date t)))
;;;###tramp-autoload
(add-to-list 'tramp-methods
- '("scp"
- (tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p") ("-e" "none") ("%h")))
- (tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-copy-program "scp")
- (tramp-copy-args (("-P" "%p") ("-p"
"%k") ("-q") ("-r")))
- (tramp-copy-keep-date t)
- (tramp-copy-recursive t)
- (tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
- ("-o" "UserKnownHostsFile=/dev/null")
- ("-o" "StrictHostKeyChecking=no")))
- (tramp-default-port 22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
- '("scp1"
+ '("scp"
(tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-1") ("-e" "none") ("%h")))
- (tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-copy-program "scp")
- (tramp-copy-args (("-1") ("-P" "%p")
("-p" "%k") ("-q") ("-r")))
- (tramp-copy-keep-date t)
- (tramp-copy-recursive t)
- (tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
- ("-o" "UserKnownHostsFile=/dev/null")
- ("-o" "StrictHostKeyChecking=no")))
- (tramp-default-port 22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
- '("scp2"
- (tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-2") ("-e" "none") ("%h")))
- (tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-copy-program "scp")
- (tramp-copy-args (("-2") ("-P" "%p")
("-p" "%k") ("-q") ("-r")))
- (tramp-copy-keep-date t)
- (tramp-copy-recursive t)
- (tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
- ("-o" "UserKnownHostsFile=/dev/null")
- ("-o" "StrictHostKeyChecking=no")))
- (tramp-default-port 22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
- '("scpc"
- (tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-o" "ControlPath=%t.%%r@%%h:%%p")
- ("-o" "ControlMaster=yes")
+ (tramp-login-args (("-l" "%u") ("-p"
"%p") ("%c")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
- (tramp-copy-args (("-P" "%p") ("-p"
"%k") ("-q") ("-r")
- ("-o" "ControlPath=%t.%%r@%%h:%%p")
- ("-o" "ControlMaster=auto")))
+ (tramp-copy-args (("-P" "%p") ("-p"
"%k") ("-q") ("-r") ("%c")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)
(tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
@@ -182,14 +128,14 @@
(add-to-list 'tramp-methods
'("scpx"
(tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-e" "none") ("-t" "-t")
- ("%h") ("/bin/sh")))
+ (tramp-login-args (("-l" "%u") ("-p"
"%p") ("%c")
+ ("-e" "none") ("-t" "-t") ("%h")
("/bin/sh")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
- (tramp-copy-args (("-P" "%p") ("-p"
"%k") ("-q") ("-r")))
+ (tramp-copy-args (("-P" "%p") ("-p"
"%k")
+ ("-q") ("-r") ("%c")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)
(tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
@@ -200,42 +146,25 @@
(add-to-list 'tramp-methods
'("sftp"
(tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p") ("-e" "none") ("%h")))
+ (tramp-login-args (("-l" "%u") ("-p"
"%p") ("%c")
+ ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
- (tramp-copy-program "sftp")))
-;;;###tramp-autoload
+ (tramp-copy-program "sftp")
+ (tramp-copy-args ("%c"))))
+ ;;;###tramp-autoload
(add-to-list 'tramp-methods
'("rsync"
(tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p") ("-e" "none") ("%h")))
- (tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-copy-program "rsync")
- (tramp-copy-args (("-e" "ssh") ("-t"
"%k") ("-r")))
- (tramp-copy-keep-date t)
- (tramp-copy-keep-tmpfile t)
- (tramp-copy-recursive t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
- `("rsyncc"
- (tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-o" "ControlPath=%t.%%r@%%h:%%p")
- ("-o" "ControlMaster=yes")
+ (tramp-login-args (("-l" "%u") ("-p"
"%p") ("%c")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rsync")
(tramp-copy-args (("-t" "%k") ("-r")))
- (tramp-copy-env (("RSYNC_RSH")
- (,(concat
- "ssh"
- " -o ControlPath=%t.%%r@%%h:%%p"
- " -o ControlMaster=auto"))))
+ (tramp-copy-env (("RSYNC_RSH") ("ssh"
"%c")))
(tramp-copy-keep-date t)
(tramp-copy-keep-tmpfile t)
(tramp-copy-recursive t)))
@@ -257,33 +186,8 @@
(add-to-list 'tramp-methods
'("ssh"
(tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p") ("-e" "none") ("%h")))
- (tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
- ("-o" "UserKnownHostsFile=/dev/null")
- ("-o" "StrictHostKeyChecking=no")))
- (tramp-default-port 22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
- '("ssh1"
- (tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-1") ("-e" "none") ("%h")))
- (tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-gw-args (("-o"
"GlobalKnownHostsFile=/dev/null")
- ("-o" "UserKnownHostsFile=/dev/null")
- ("-o" "StrictHostKeyChecking=no")))
- (tramp-default-port 22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
- '("ssh2"
- (tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-2") ("-e" "none") ("%h")))
+ (tramp-login-args (("-l" "%u") ("-p"
"%p") ("%c")
+ ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
@@ -295,9 +199,8 @@
(add-to-list 'tramp-methods
'("sshx"
(tramp-login-program "ssh")
- (tramp-login-args (("-l" "%u") ("-p"
"%p")
- ("-e" "none") ("-t" "-t")
- ("%h") ("/bin/sh")))
+ (tramp-login-args (("-l" "%u") ("-p"
"%p") ("%c")
+ ("-e" "none") ("-t" "-t") ("%h")
("/bin/sh")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
@@ -351,14 +254,6 @@
(tramp-default-port 22)))
;;;###tramp-autoload
(add-to-list 'tramp-methods
- '("plink1"
- (tramp-login-program "plink")
- (tramp-login-args (("-l" "%u") ("-P"
"%p") ("-1" "-ssh") ("%h")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-args ("-c"))
- (tramp-default-port 22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
`("plinkx"
(tramp-login-program "plink")
;; ("%h") must be a single element, see
@@ -471,23 +366,12 @@
(tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh)
(tramp-set-completion-function "remcp"
tramp-completion-function-alist-rsh)
(tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
- (tramp-set-completion-function "scp1"
tramp-completion-function-alist-ssh)
- (tramp-set-completion-function "scp2"
tramp-completion-function-alist-ssh)
- (tramp-set-completion-function "scpc"
tramp-completion-function-alist-ssh)
(tramp-set-completion-function "scpx"
tramp-completion-function-alist-ssh)
(tramp-set-completion-function "sftp"
tramp-completion-function-alist-ssh)
(tramp-set-completion-function "rsync"
tramp-completion-function-alist-ssh)
- (tramp-set-completion-function
- "rsyncc" tramp-completion-function-alist-ssh)
(tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh)
(tramp-set-completion-function "remsh"
tramp-completion-function-alist-rsh)
(tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
- (tramp-set-completion-function "ssh1"
tramp-completion-function-alist-ssh)
- (tramp-set-completion-function "ssh2"
tramp-completion-function-alist-ssh)
- (tramp-set-completion-function
- "ssh1_old" tramp-completion-function-alist-ssh)
- (tramp-set-completion-function
- "ssh2_old" tramp-completion-function-alist-ssh)
(tramp-set-completion-function "sshx"
tramp-completion-function-alist-ssh)
(tramp-set-completion-function
"telnet" tramp-completion-function-alist-telnet)
@@ -498,8 +382,6 @@
"krlogin" tramp-completion-function-alist-rsh)
(tramp-set-completion-function "plink"
tramp-completion-function-alist-ssh)
(tramp-set-completion-function
- "plink1" tramp-completion-function-alist-ssh)
- (tramp-set-completion-function
"plinkx" tramp-completion-function-alist-putty)
(tramp-set-completion-function "pscp"
tramp-completion-function-alist-ssh)
(tramp-set-completion-function "fcp"
tramp-completion-function-alist-ssh)))
@@ -538,6 +420,7 @@
(const :tag "Private Directories" tramp-own-remote-path)
(string :tag "Directory"))))
+;;;###tramp-autoload
(defcustom tramp-remote-process-environment
`("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1"
"LC_ALL=C"
,(format "TERM=%s" tramp-terminal-type)
@@ -905,25 +788,6 @@
here-document, otherwise the command could exceed maximum length
of command line.")
-(defconst tramp-file-mode-type-map
- '((0 . "-") ; Normal file (SVID-v2 and XPG2)
- (1 . "p") ; fifo
- (2 . "c") ; character device
- (3 . "m") ; multiplexed character device (v7)
- (4 . "d") ; directory
- (5 . "?") ; Named special file (XENIX)
- (6 . "b") ; block device
- (7 . "?") ; multiplexed block device (v7)
- (8 . "-") ; regular file
- (9 . "n") ; network special file (HP-UX)
- (10 . "l") ; symlink
- (11 . "?") ; ACL shadow inode (Solaris, not userspace)
- (12 . "s") ; socket
- (13 . "D") ; door special (Solaris)
- (14 . "w")) ; whiteout (BSD)
- "A list of file types returned from the `stat' system call.
-This is used to map a mode number to a permission string.")
-
;; New handlers should be added here. The following operations can be
;; handled using the normal primitives: file-name-sans-versions,
;; get-file-buffer.
@@ -1436,7 +1300,7 @@
(utc (not (featurep 'xemacs))))
(tramp-send-command-and-check
v (format "%s touch -t %s %s"
- (if utc "TZ=UTC; export TZ;" "")
+ (if utc "env TZ=UTC" "")
(if utc
(format-time-string "%Y%m%d%H%M.%S" time t)
(format-time-string "%Y%m%d%H%M.%S" time))
@@ -2300,7 +2164,7 @@
(t2 (tramp-tramp-file-p newname))
(orig-vec (tramp-dissect-file-name (if t1 filename newname)))
copy-program copy-args copy-env copy-keep-date port spec
- source target)
+ options source target)
(with-parsed-tramp-file-name (if t1 filename newname) nil
(if (and t1 t2)
@@ -2368,9 +2232,11 @@
user (or user "")
port (or port "")
spec (format-spec-make
- ?h host ?u user ?p port
?t (tramp-get-connection-property
- (tramp-get-connection-process v) "temp-file" "")
+ (tramp-get-connection-process v) "temp-file" ""))
+ options (format-spec tramp-ssh-controlmaster-options spec)
+ spec (format-spec-make
+ ?h host ?u user ?p port ?c options
?k (if keep-date " " ""))
copy-program (tramp-get-method-parameter
method 'tramp-copy-program)
@@ -2420,7 +2286,7 @@
v "process-buffer" (current-buffer))
(while copy-env
(tramp-message
- orig-vec 5 "%s=\"%s\"" (car copy-env) (cadr copy-env))
+ orig-vec 6 "%s=\"%s\"" (car copy-env) (cadr copy-env))
(setenv (pop copy-env) (pop copy-env)))
;; Use an asynchronous process. By this, password can
@@ -2632,10 +2498,13 @@
(if full-directory-p "yes" "no"))
;; If `full-directory-p', we just say `ls -l FILENAME'.
;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
+ ;; "--dired" returns byte positions. Therefore, the file names
+ ;; must be encoded, which is guaranteed by "LC_ALL=en_US.utf8
+ ;; LC_CTYPE=''".
(if full-directory-p
(tramp-send-command
v
- (format "%s %s %s 2>/dev/null"
+ (format "env LC_ALL=en_US.utf8 LC_CTYPE='' %s %s %s
2>/dev/null"
(tramp-get-ls-command v)
switches
(if wildcard
@@ -2651,7 +2520,7 @@
(tramp-run-real-handler 'file-name-directory (list localname))))
(tramp-send-command
v
- (format "%s %s %s"
+ (format "env LC_ALL=en_US.utf8 LC_CTYPE='' %s %s %s 2>/dev/null"
(tramp-get-ls-command v)
switches
(if (or wildcard
@@ -2697,6 +2566,13 @@
(while (re-search-forward tramp-color-escape-sequence-regexp nil t)
(replace-match "")))
+ ;; Decode the output, it could be multibyte.
+ (decode-coding-region
+ beg (point-max)
+ (or file-name-coding-system
+ (and (boundp 'default-file-name-coding-system)
+ (symbol-value 'default-file-name-coding-system))))
+
;; The inserted file could be from somewhere else.
(when (and (not wildcard) (not full-directory-p))
(goto-char (point-max))
@@ -2810,7 +2686,11 @@
(or (null program) tramp-process-connection-type))
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
(name1 name)
- (i 0))
+ (i 0)
+ ;; We do not want to raise an error when
+ ;; `start-file-process' has been started several time in
+ ;; `eshell' and friends.
+ (tramp-current-connection nil))
(unless buffer
;; BUFFER can be nil. We use a temporary buffer.
@@ -2857,10 +2737,12 @@
v 'file-error
"pty association is not supported for `%s'" name))))
(let ((p (tramp-get-connection-process v)))
- ;; Set query flag for this process. We ignore errors,
- ;; because the process could have finished already.
+ ;; Set query flag and process marker for this
+ ;; process. We ignore errors, because the process
+ ;; could have finished already.
(ignore-errors
- (tramp-compat-set-process-query-on-exit-flag p t))
+ (tramp-compat-set-process-query-on-exit-flag p t)
+ (set-marker (process-mark p) (point)))
;; Return process.
p))))
@@ -4474,6 +4356,9 @@
(setenv "PROMPT_COMMAND")
(setenv "PS1" tramp-initial-end-of-output)
(let* ((target-alist (tramp-compute-multi-hops vec))
+ ;; We will apply `tramp-ssh-controlmaster-options'
+ ;; only for the first hop.
+ (options tramp-ssh-controlmaster-options)
(process-connection-type tramp-process-connection-type)
(process-adaptive-read-buffering nil)
(coding-system-for-read nil)
@@ -4535,14 +4420,16 @@
;; temporary file has another name, and it is
;; created and protected by ssh. It is also
;; removed by ssh when the connection is
- ;; closed.
+ ;; closed. The temporary file name is cached
+ ;; in the main connection process, therefore
+ ;; we cannot use `tramp-get-connection-process'.
(tmpfile
- (tramp-set-connection-property
- p "temp-file"
- (make-temp-name
- (expand-file-name
- tramp-temp-name-prefix
- (tramp-compat-temporary-file-directory)))))
+ (with-tramp-connection-property
+ (get-process (tramp-buffer-name vec)) "temp-file"
+ (make-temp-name
+ (expand-file-name
+ tramp-temp-name-prefix
+ (tramp-compat-temporary-file-directory)))))
spec r-shell)
;; Add arguments for asynchronous processes.
@@ -4576,8 +4463,10 @@
l-host (or l-host "")
l-user (or l-user "")
l-port (or l-port "")
+ spec (format-spec-make ?t tmpfile)
+ options (format-spec options spec)
spec (format-spec-make
- ?h l-host ?u l-user ?p l-port ?t tmpfile)
+ ?h l-host ?u l-user ?p l-port ?c options)
command
(concat
;; We do not want to see the trailing local
@@ -4604,7 +4493,8 @@
(tramp-message
vec 3 "Found remote shell prompt on `%s'" l-host))
;; Next hop.
- (setq target-alist (cdr target-alist)))
+ (setq options ""
+ target-alist (cdr target-alist)))
;; Make initial shell settings.
(tramp-open-connection-setup-interactive-shell p vec))))
@@ -4806,76 +4696,6 @@
(tramp-get-device vec))
attr))
-(defun tramp-check-cached-permissions (vec access)
- "Check `file-attributes' caches for VEC.
-Return t if according to the cache access type ACCESS is known to
-be granted."
- (let ((result nil)
- (offset (cond
- ((eq ?r access) 1)
- ((eq ?w access) 2)
- ((eq ?x access) 3))))
- (dolist (suffix '("string" "integer") result)
- (setq
- result
- (or
- result
- (let ((file-attr
- (tramp-get-file-property
- vec (tramp-file-name-localname vec)
- (concat "file-attributes-" suffix) nil))
- (remote-uid
- (tramp-get-connection-property
- vec (concat "uid-" suffix) nil))
- (remote-gid
- (tramp-get-connection-property
- vec (concat "gid-" suffix) nil)))
- (and
- file-attr
- (or
- ;; Not a symlink
- (eq t (car file-attr))
- (null (car file-attr)))
- (or
- ;; World accessible.
- (eq access (aref (nth 8 file-attr) (+ offset 6)))
- ;; User accessible and owned by user.
- (and
- (eq access (aref (nth 8 file-attr) offset))
- (equal remote-uid (nth 2 file-attr)))
- ;; Group accessible and owned by user's
- ;; principal group.
- (and
- (eq access (aref (nth 8 file-attr) (+ offset 3)))
- (equal remote-gid (nth 3 file-attr)))))))))))
-
-(defun tramp-file-mode-from-int (mode)
- "Turn an integer representing a file mode into an ls(1)-like string."
- (let ((type (cdr
- (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map)))
- (user (logand (lsh mode -6) 7))
- (group (logand (lsh mode -3) 7))
- (other (logand (lsh mode -0) 7))
- (suid (> (logand (lsh mode -9) 4) 0))
- (sgid (> (logand (lsh mode -9) 2) 0))
- (sticky (> (logand (lsh mode -9) 1) 0)))
- (setq user (tramp-file-mode-permissions user suid "s"))
- (setq group (tramp-file-mode-permissions group sgid "s"))
- (setq other (tramp-file-mode-permissions other sticky "t"))
- (concat type user group other)))
-
-(defun tramp-file-mode-permissions (perm suid suid-text)
- "Convert a permission bitset into a string.
-This is used internally by `tramp-file-mode-from-int'."
- (let ((r (> (logand perm 4) 0))
- (w (> (logand perm 2) 0))
- (x (> (logand perm 1) 0)))
- (concat (or (and r "r") "-")
- (or (and w "w") "-")
- (or (and suid x suid-text) ; suid, execute
- (and suid (upcase suid-text)) ; suid, !execute
- (and x "x") "-")))) ; !suid
-
(defun tramp-shell-case-fold (string)
"Converts STRING to shell glob pattern which ignores case."
(mapconcat
@@ -5149,14 +4969,6 @@
;; The command might not always return a number.
(if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
-(defun tramp-get-local-uid (id-format)
- (if (equal id-format 'integer) (user-uid) (user-login-name)))
-
-(defun tramp-get-local-gid (id-format)
- (if (and (fboundp 'group-gid) (equal id-format 'integer))
- (tramp-compat-funcall 'group-gid)
- (nth 3 (tramp-compat-file-attributes "~/" id-format))))
-
;; Some predefined connection properties.
(defun tramp-get-inline-compress (vec prop size)
"Return the compress command related to PROP.
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/tramp.el
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -220,7 +220,8 @@
argument. By this, arguments like (\"-l\" \"%u\") are optional.
\"%t\" is replaced by the temporary file name produced with
`tramp-make-tramp-temp-file'. \"%k\" indicates the keep-date
- parameter of a program, if exists.
+ parameter of a program, if exists. \"%c\" adds additional
+ `tramp-ssh-controlmaster-options' options for the first hop.
* `tramp-async-args'
When an asynchronous process is started, we know already that
the connection works. Therefore, we can pass additional
@@ -280,15 +281,24 @@
`localhost' or the name of the local host. Another host name is
useful only in combination with `tramp-default-proxies-alist'.")
-(defun tramp-detect-ssh-controlmaster ()
- "Call ssh to detect whether it supports the ControlMaster argument.
-This function may return nil when the argument is supported, but
-shouldn't return t when it isn't."
- (ignore-errors
- (with-temp-buffer
- (call-process "ssh" nil t nil "-o" "ControlMaster")
- (goto-char (point-min))
- (search-forward-regexp "Missing ControlMaster argument" nil t))))
+;;;###tramp-autoload
+(defconst tramp-ssh-controlmaster-options
+ (let ((result ""))
+ (ignore-errors
+ (with-temp-buffer
+ (call-process "ssh" nil t nil "-o" "ControlMaster")
+ (goto-char (point-min))
+ (when (search-forward-regexp "Missing ControlMaster argument" nil t)
+ (setq result "-o ControlPath=%t.%%r@%%h:%%p -o ControlMaster=auto")))
+ (when result
+ (with-temp-buffer
+ (call-process "ssh" nil t nil "-o" "ControlPersist")
+ (goto-char (point-min))
+ (when (search-forward-regexp "Missing ControlPersist argument" nil t)
+ (setq result (concat result " -o ControlPersist=no"))))))
+ result)
+ "Call ssh to detect whether it supports the Control* arguments.
+Return a string to be used in `tramp-methods'.")
(defcustom tramp-default-method
;; An external copy method seems to be preferred, because it performs
@@ -297,8 +307,9 @@
;; permanent password queries. Either a password agent like
;; "ssh-agent" or "Pageant" shall run, or the optional
;; password-cache.el or auth-sources.el packages shall be active for
- ;; password caching. "scpc" is chosen if we detect that the user is
- ;; running OpenSSH 4.0 or newer.
+ ;; password caching. If we detect that the user is running OpenSSH
+ ;; 4.0 or newer, we could reuse the connection, which calls also for
+ ;; an external method.
(cond
;; PuTTY is installed. We don't take it, if it is installed on a
;; non-windows system, or pscp from the pssh (parallel ssh) package
@@ -314,16 +325,16 @@
"plink"))
;; There is an ssh installation.
((executable-find "scp")
- (cond
- ((tramp-detect-ssh-controlmaster) "scpc")
- ((or (fboundp 'password-read)
- (fboundp 'auth-source-user-or-password)
- (fboundp 'auth-source-search)
- ;; ssh-agent is running.
- (getenv "SSH_AUTH_SOCK")
- (getenv "SSH_AGENT_PID"))
- "scp")
- (t "ssh")))
+ (if (or (fboundp 'password-read)
+ (fboundp 'auth-source-user-or-password)
+ (fboundp 'auth-source-search)
+ ;; ssh-agent is running.
+ (getenv "SSH_AUTH_SOCK")
+ (getenv "SSH_AGENT_PID")
+ ;; We could reuse the connection.
+ (> (length tramp-ssh-controlmaster-options) 0))
+ "scp"
+ "ssh"))
;; Fallback.
(t "ftp"))
"Default method to use for transferring files.
@@ -1154,28 +1165,50 @@
;;;###tramp-autoload
(defun tramp-tramp-file-p (name)
- "Return t if NAME is a string with Tramp file name syntax.
-It checks also, whether NAME is unibyte encoded."
+ "Return t if NAME is a string with Tramp file name syntax."
(save-match-data
(and (stringp name)
-; (string-equal name (string-as-unibyte name))
(string-match tramp-file-name-regexp name))))
+;; Obsoleted with Tramp 2.2.7.
+(defconst tramp-obsolete-methods
+ '("ssh1" "ssh2" "scp1" "scp2"
"scpc" "rsyncc" "plink1")
+ "Obsolete methods.")
+
+(defvar tramp-warned-obsolete-methods nil
+ "Which methods the user has been warned to be obsolete.")
+
(defun tramp-find-method (method user host)
"Return the right method string to use.
This is METHOD, if non-nil. Otherwise, do a lookup in
-`tramp-default-method-alist'."
- (or method
- (let ((choices tramp-default-method-alist)
- lmethod item)
- (while choices
- (setq item (pop choices))
- (when (and (string-match (or (nth 0 item) "") (or host ""))
- (string-match (or (nth 1 item) "") (or user "")))
- (setq lmethod (nth 2 item))
- (setq choices nil)))
- lmethod)
- tramp-default-method))
+`tramp-default-method-alist'. It maps also obsolete methods to
+their replacement."
+ (let ((result
+ (or method
+ (let ((choices tramp-default-method-alist)
+ lmethod item)
+ (while choices
+ (setq item (pop choices))
+ (when (and (string-match (or (nth 0 item) "") (or host ""))
+ (string-match (or (nth 1 item) "") (or user "")))
+ (setq lmethod (nth 2 item))
+ (setq choices nil)))
+ lmethod)
+ tramp-default-method)))
+ ;; This is needed for a transition period only.
+ (when (member result tramp-obsolete-methods)
+ (unless (member result tramp-warned-obsolete-methods)
+ (if noninteractive
+ (warn "Method %s is obsolete, using %s"
+ result (substring result 0 -1))
+ (unless (y-or-n-p (format "Method %s is obsolete, use %s? "
+ result (substring result 0 -1)))
+ (error 'file-error "Method \"%s\" not supported" result)))
+ (add-to-list 'tramp-warned-obsolete-methods result))
+ ;; This works with the current set of `tramp-obsolete-methods'.
+ ;; Must be improved, if their are more sophisticated replacements.
+ (setq result (substring result 0 -1)))
+ result))
(defun tramp-find-user (method user host)
"Return the right user string to use.
@@ -1342,6 +1375,8 @@
(get-buffer-create (tramp-debug-buffer-name vec))
(when (bobp)
(setq buffer-undo-list t)
+ ;; So it does not get loaded while `outline-regexp' is let-bound.
+ (require 'outline)
;; Activate `outline-mode'. This runs `text-mode-hook' and
;; `outline-mode-hook'. We must prevent that local processes
;; die. Yes: I've seen `flyspell-mode', which starts "ispell".
@@ -1395,6 +1430,7 @@
"tramp-compat-condition-case-unless-debug"
"tramp-compat-funcall"
"tramp-compat-with-temp-message"
+ "tramp-condition-case-unless-debug"
"tramp-debug-message"
"tramp-error"
"tramp-error-with-buffer"
@@ -1469,12 +1505,18 @@
(concat (format "(%d) # " level) fmt-string)
args)))))))
+(defsubst tramp-backtrace (vec-or-proc)
+ "Dump a backtrace into the debug buffer.
+This function is meant for debugging purposes."
+ (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace))))
+
(defsubst tramp-error (vec-or-proc signal fmt-string &rest args)
"Emit an error.
VEC-OR-PROC identifies the connection to use, SIGNAL is the
signal identifier to be raised, remaining args passed to
`tramp-message'. Finally, signal SIGNAL is raised."
(let (tramp-message-show-message)
+ (tramp-backtrace vec-or-proc)
(tramp-message
vec-or-proc 1 "%s"
(error-message-string
@@ -1507,11 +1549,6 @@
"`M-x tramp-cleanup-this-connection'"))
(sit-for 30))))))
-(defsubst tramp-backtrace (vec-or-proc)
- "Dump a backtrace into the debug buffer.
-This function is meant for debugging purposes."
- (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace))))
-
(defmacro with-parsed-tramp-file-name (filename var &rest body)
"Parse a Tramp filename and make components available in the body.
@@ -2007,6 +2044,15 @@
res (cdr elt))))
res))))
+(defvar tramp-debug-on-error nil
+ "Like `debug-on-error' but used Tramp internal.")
+
+(defmacro tramp-condition-case-unless-debug
+ (var bodyform &rest handlers)
+ "Like `condition-case-unless-debug' but `tramp-debug-on-error'."
+ `(let ((debug-on-error tramp-debug-on-error))
+ (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers)))
+
;; Main function.
;;;###autoload
(defun tramp-file-name-handler (operation &rest args)
@@ -2022,7 +2068,7 @@
(with-parsed-tramp-file-name filename nil
;; Call the backend function.
(if foreign
- (tramp-compat-condition-case-unless-debug err
+ (tramp-condition-case-unless-debug err
(let ((sf (symbol-function foreign))
result)
;; Some packages set the default directory to a
@@ -2075,7 +2121,7 @@
;; in order to give the user a chance to correct the
;; file name in the minibuffer.
;; In order to get a full backtrace, one could apply
- ;; (setq debug-on-error t debug-on-signal t)
+ ;; (setq tramp-debug-on-error t)
(error
(cond
((and completion (zerop (length localname))
@@ -3615,6 +3661,107 @@
(t (error "Tenth char `%c' must be one of `xtT-'"
other-execute-or-sticky)))))))
+(defconst tramp-file-mode-type-map
+ '((0 . "-") ; Normal file (SVID-v2 and XPG2)
+ (1 . "p") ; fifo
+ (2 . "c") ; character device
+ (3 . "m") ; multiplexed character device (v7)
+ (4 . "d") ; directory
+ (5 . "?") ; Named special file (XENIX)
+ (6 . "b") ; block device
+ (7 . "?") ; multiplexed block device (v7)
+ (8 . "-") ; regular file
+ (9 . "n") ; network special file (HP-UX)
+ (10 . "l") ; symlink
+ (11 . "?") ; ACL shadow inode (Solaris, not userspace)
+ (12 . "s") ; socket
+ (13 . "D") ; door special (Solaris)
+ (14 . "w")) ; whiteout (BSD)
+ "A list of file types returned from the `stat' system call.
+This is used to map a mode number to a permission string.")
+
+;;;###tramp-autoload
+(defun tramp-file-mode-from-int (mode)
+ "Turn an integer representing a file mode into an ls(1)-like string."
+ (let ((type (cdr
+ (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map)))
+ (user (logand (lsh mode -6) 7))
+ (group (logand (lsh mode -3) 7))
+ (other (logand (lsh mode -0) 7))
+ (suid (> (logand (lsh mode -9) 4) 0))
+ (sgid (> (logand (lsh mode -9) 2) 0))
+ (sticky (> (logand (lsh mode -9) 1) 0)))
+ (setq user (tramp-file-mode-permissions user suid "s"))
+ (setq group (tramp-file-mode-permissions group sgid "s"))
+ (setq other (tramp-file-mode-permissions other sticky "t"))
+ (concat type user group other)))
+
+(defun tramp-file-mode-permissions (perm suid suid-text)
+ "Convert a permission bitset into a string.
+This is used internally by `tramp-file-mode-from-int'."
+ (let ((r (> (logand perm 4) 0))
+ (w (> (logand perm 2) 0))
+ (x (> (logand perm 1) 0)))
+ (concat (or (and r "r") "-")
+ (or (and w "w") "-")
+ (or (and suid x suid-text) ; suid, execute
+ (and suid (upcase suid-text)) ; suid, !execute
+ (and x "x") "-")))) ; !suid
+
+;;;###tramp-autoload
+(defun tramp-get-local-uid (id-format)
+ (if (equal id-format 'integer) (user-uid) (user-login-name)))
+
+;;;###tramp-autoload
+(defun tramp-get-local-gid (id-format)
+ (if (and (fboundp 'group-gid) (equal id-format 'integer))
+ (tramp-compat-funcall 'group-gid)
+ (nth 3 (tramp-compat-file-attributes "~/" id-format))))
+
+;;;###tramp-autoload
+(defun tramp-check-cached-permissions (vec access)
+ "Check `file-attributes' caches for VEC.
+Return t if according to the cache access type ACCESS is known to
+be granted."
+ (let ((result nil)
+ (offset (cond
+ ((eq ?r access) 1)
+ ((eq ?w access) 2)
+ ((eq ?x access) 3))))
+ (dolist (suffix '("string" "integer") result)
+ (setq
+ result
+ (or
+ result
+ (let ((file-attr
+ (tramp-get-file-property
+ vec (tramp-file-name-localname vec)
+ (concat "file-attributes-" suffix) nil))
+ (remote-uid
+ (tramp-get-connection-property
+ vec (concat "uid-" suffix) nil))
+ (remote-gid
+ (tramp-get-connection-property
+ vec (concat "gid-" suffix) nil)))
+ (and
+ file-attr
+ (or
+ ;; Not a symlink
+ (eq t (car file-attr))
+ (null (car file-attr)))
+ (or
+ ;; World accessible.
+ (eq access (aref (nth 8 file-attr) (+ offset 6)))
+ ;; User accessible and owned by user.
+ (and
+ (eq access (aref (nth 8 file-attr) offset))
+ (equal remote-uid (nth 2 file-attr)))
+ ;; Group accessible and owned by user's
+ ;; principal group.
+ (and
+ (eq access (aref (nth 8 file-attr) (+ offset 3)))
+ (equal remote-gid (nth 3 file-attr)))))))))))
+
;;;###tramp-autoload
(defun tramp-local-host-p (vec)
"Return t if this points to the local host, nil otherwise."
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 lisp/trampver.el
--- a/lisp/trampver.el
+++ b/lisp/trampver.el
@@ -31,7 +31,7 @@
;; should be changed only there.
;;;###tramp-autoload
-(defconst tramp-version "2.2.7-pre"
+(defconst tramp-version "2.2.7"
"This version of Tramp.")
;;;###tramp-autoload
@@ -44,7 +44,7 @@
(= emacs-major-version 21)
(>= emacs-minor-version 4)))
"ok"
- (format "Tramp 2.2.7-pre is not fit for %s"
+ (format "Tramp 2.2.7 is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
diff -r bf836625da53d6f8c34176e1dda9a506a829260f -r
1706a2b82aef886d67e20d8bd720b0f055ecbce5 texi/ChangeLog
--- a/texi/ChangeLog
+++ b/texi/ChangeLog
@@ -1,3 +1,62 @@
+2013-03-15 Michael Albinus <michael.albinus(a)gmx.de>
+
+ Version 2.2.7 released.
+
+2013-03-03 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (External methods): Tramp does not connect Android
+ devices by itself.
+
+2013-03-01 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (Inline methods): Remove "ssh1", "ssh2",
"plink1"
+ and "plink2" entries. "plink2" is obsolete for a long time.
+ (External methods): Remove "scp1" and "scp2" entries. Explain
+ user name and host name specification for "adb".
+
+2013-02-28 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (External methods): Mention `tramp-adb-program'.
+
+2013-02-25 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (top) [xxx, yyy, trampfn]: Provide two versions of
+ the macros, for Texinfo 4.13 and 5.0.
+
+2013-02-24 Michael Albinus <michael.albinus(a)gmx.de>
+
+ Port documentation to Texinfo 5.0.
+
+ * tramp.texi (top) [xxx, yyy, trampfn]: Remove superfluous @c.
+ (Filename Syntax): Do not use @trampfn{} in @item.
+ (Filename completion): Use @columnfractions in @multitable.
+
+2013-02-21 Paul Eggert <eggert(a)cs.ucla.edu>
+
+ * tramp.texi (Top): Move index entries down.
+
+2013-02-20 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (Android shell setup): Improve. Reported by Thierry
+ Volpiatto <thierry.volpiatto(a)gmail.com>.
+
+2013-02-16 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (Top, Configuration): Insert section `Android shell
+ setup' in menu.
+ (Android shell setup): New section.
+
+2013-02-13 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (Connection types, Default Method)
+ (Frequently Asked Questions): Mention "scp" instead of "scpc".
+ (External methods): Remove "scpc" and "rsyncc" entries.
+ (Frequently Asked Questions): Remove entry about ControlPersist.
+
+2013-01-24 Michael Albinus <michael.albinus(a)gmx.de>
+
+ * tramp.texi (Filename Syntax): Filenames must be unibyte strings.
+
2013-01-10 Michael Albinus <michael.albinus(a)gmx.de>
* tramp.texi (Default Host): Introduce `tramp-default-host-alist'.
This diff is so big that we needed to truncate the remainder.
Repository URL:
https://bitbucket.org/xemacs/tramp/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches