]> git.eshelyaron.com Git - emacs.git/commitdiff
Sync with Tramp 2.0.52.
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 22 Jan 2006 21:59:55 +0000 (21:59 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 22 Jan 2006 21:59:55 +0000 (21:59 +0000)
lisp/ChangeLog
lisp/net/tramp-ftp.el
lisp/net/tramp-util.el
lisp/net/tramp-vc.el
lisp/net/tramp.el
lisp/net/trampver.el
man/ChangeLog
man/tramp.texi
man/trampver.texi

index 8a831ee01d8226c53f014d7fdaa5493c13a467a2..893c8ba68ef298f9487c22a023b948cf1e5e9b93 100644 (file)
@@ -1,3 +1,45 @@
+2006-01-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       Sync with Tramp 2.0.52.
+
+       * net/tramp.el, net/tramp-ftp.el, net/tramp-util.el,
+       net/tramp-vc.el: Add code for unloading Tramp.  See comment before
+       `tramp-unload-tramp' for checklist.
+
+       * net/tramp.el: Require `timer-funcs' instead of `timer' if in
+       XEmacs.  Contributed by Steve Youngs <steve@sxemacs.org>.
+       (tramp-unload-file-name-handler-alist)
+       (tramp-unload-tramp): New defuns.
+       (tramp-advice-PC-expand-many-files): New defadvice.
+       (tramp-save-PC-expand-many-files, tramp-setup-complete) Defuns
+       removed.
+       (tramp-handle-expand-file-name): Remove double slash.
+       (tramp-handle-file-attributes-with-ls): Return t as 9th attribute.
+       It doesn't matter, because it will be converted later on.
+       (tramp-handle-file-ownership-preserved-p): Rewritten.  The old
+       implementation was just heuristic.
+       (tramp-post-connection): Set uid and gid properties.
+       (tramp-convert-file-attributes): Set file's gid change bit.
+       (tramp-get-remote-uid, tramp-get-remote-gid): New defuns.
+       (tramp-handle-expand-file-name): Use "~root" for tilde expansion
+       in case of su(do)? methods.  The home directory of the local user
+       will be taken else.
+       (tramp-open-connection-telnet)
+       (tramp-open-connection-rsh, tramp-open-connection-su)
+       (tramp-open-connection-multi): Set PS1 to "$ ".  Otherwise, a
+       local shell prompt could hurt.  Reported by Romain Francoise
+       <romain@orebokech.com>.
+       (tramp-let-maybe): Add `edebug-form-spec' property.
+       (tramp-handle-expand-file-name): Bind `default-directory' locally
+       to "/" in order to avoid problems with UNC shares or Cygwin
+       mounts.
+       (tramp-md5-function): Fix typo in error message.
+
+       * net/tramp-ftp.el (tramp-ftp-enable-ange-ftp): New defun.
+
+       * net/tramp-util.el (top): Apply `ignore' instead of `identity'
+       for byte-compiler pacification.
+
 2006-01-22  Andre Spiegel  <spiegel@gnu.org>
 
        * vc-rcs.el (vc-rcs-state-heuristic): Use file-attributes with
index 53cc392ad7ab84a4619028ffc83c7374ac37fbc2..dc3742c231a422c1715ff3dda98bad8fd1c0d9c4 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- coding: iso-8859-1; -*-
 
-;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -63,8 +63,40 @@ present for backward compatibility."
        (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)))
     (setq file-name-handler-alist
          (delete a1 (delete a2 file-name-handler-alist)))))
-(tramp-disable-ange-ftp)
-(eval-after-load "ange-ftp" '(tramp-disable-ange-ftp))
+
+(eval-after-load "ange-ftp"
+  '(when (functionp 'tramp-disable-ange-ftp)
+     (tramp-disable-ange-ftp)))
+
+;;;###autoload
+(defun tramp-ftp-enable-ange-ftp ()
+  ;; The following code is commented out in Ange-FTP.
+
+  ;;; This regexp takes care of real ange-ftp file names (with a slash
+  ;;; and colon).
+  ;;; Don't allow the host name to end in a period--some systems use /.:
+  (or (assoc "^/[^/:]*[^/:.]:" file-name-handler-alist)
+      (setq file-name-handler-alist
+           (cons '("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
+                 file-name-handler-alist)))
+
+  ;;; This regexp recognizes absolute filenames with only one component,
+  ;;; for the sake of hostname completion.
+  (or (assoc "^/[^/:]*\\'" file-name-handler-alist)
+      (setq file-name-handler-alist
+           (cons '("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
+                 file-name-handler-alist)))
+
+  ;;; This regexp recognizes absolute filenames with only one component
+  ;;; on Windows, for the sake of hostname completion.
+  (and (memq system-type '(ms-dos windows-nt))
+       (or (assoc "^[a-zA-Z]:/[^/:]*\\'" file-name-handler-alist)
+          (setq file-name-handler-alist
+                (cons '("^[a-zA-Z]:/[^/:]*\\'" .
+                        ange-ftp-completion-hook-function)
+                      file-name-handler-alist)))))
+
+(add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp)
 
 ;; Define FTP method ...
 (defcustom tramp-ftp-method "ftp"
index acb10727d46081482bcb29980b65eaaca3b75295..666471d64296180eb6d51f2bf34b507f1a4abae8 100644 (file)
@@ -1,7 +1,8 @@
 ;;; -*- coding: iso-2022-7bit; -*-
 ;;; tramp-util.el --- Misc utility functions to use with Tramp
 
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005,
+;;   2006 Free Software Foundation, Inc.
 
 ;; Author: kai.grossjohann@gmx.net
 ;; Keywords: comm, extensions, processes
 (eval-when-compile (require 'cl))
 (require 'compile)
 (require 'tramp)
+(add-hook 'tramp-util-unload-hook
+         '(lambda ()
+            (when (featurep 'tramp)
+              (unload-feature 'tramp 'force))))
 
 ;; Define a Tramp minor mode. It's intention is to redefine some keys for Tramp
 ;; specific functions, like compilation.
@@ -42,7 +47,7 @@
       (defalias 'define-minor-mode 'identity)
       (defvar tramp-minor-mode))
   (unless (featurep 'xemacs)
-      (defalias 'add-menu-button 'identity)))
+    (defalias 'add-menu-button 'ignore)))
 
 (defvar tramp-minor-mode-map (make-sparse-keymap)
   "Keymap for Tramp minor mode.")
        (and tramp-minor-mode (tramp-tramp-file-p default-directory))))
 
 (add-hook 'find-file-hooks 'tramp-minor-mode t)
+(add-hook 'tramp-util-unload-hook
+         '(lambda ()
+            (remove-hook 'find-file-hooks 'tramp-minor-mode)))
+
 (add-hook 'dired-mode-hook 'tramp-minor-mode t)
+(add-hook 'tramp-util-unload-hook
+         '(lambda ()
+            (remove-hook 'dired-mode-hook 'tramp-minor-mode)))
 
 (defun tramp-remap-command (old-command new-command)
   "Replaces bindings of OLD-COMMAND by NEW-COMMAND.
index c1806a4be2409175ba75fe212ae9bdf4a0efccf9..368d85c8e57b593e0261ff6b6479414831404cc6 100644 (file)
@@ -1,7 +1,7 @@
 ;;; tramp-vc.el --- Version control integration for TRAMP.el
 
 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pittman <daniel@danann.net>
 ;; Keywords: comm, processes
@@ -220,34 +220,37 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
 ;; Daniel Pittman <daniel@danann.net>
 ;;-(if (fboundp 'vc-call-backend)
 ;;-    () ;; This is the new VC for which we don't have an appropriate advice yet
+;;-)
 (unless (fboundp 'process-file)
-(if (fboundp 'vc-call-backend)
+  (if (fboundp 'vc-call-backend)
+      (defadvice vc-do-command
+       (around tramp-advice-vc-do-command
+               (buffer okstatus command file &rest flags)
+               activate)
+       "Invoke tramp-vc-do-command for tramp files."
+       (let ((file (symbol-value 'file)))    ;pacify byte-compiler
+         (if (or (and (stringp file)     (tramp-tramp-file-p file))
+                 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
+             (setq ad-return-value
+                   (apply 'tramp-vc-do-command-new buffer okstatus command
+                          file ;(or file (buffer-file-name))
+                          flags))
+           ad-do-it)))
     (defadvice vc-do-command
       (around tramp-advice-vc-do-command
-              (buffer okstatus command file &rest flags)
-              activate)
+             (buffer okstatus command file last &rest flags)
+             activate)
       "Invoke tramp-vc-do-command for tramp files."
-      (let ((file (symbol-value 'file)))    ;pacify byte-compiler
-        (if (or (and (stringp file)     (tramp-tramp-file-p file))
-                (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
-            (setq ad-return-value
-                  (apply 'tramp-vc-do-command-new buffer okstatus command
-                         file ;(or file (buffer-file-name))
-                         flags))
-          ad-do-it)))
-  (defadvice vc-do-command
-    (around tramp-advice-vc-do-command
-            (buffer okstatus command file last &rest flags)
-            activate)
-    "Invoke tramp-vc-do-command for tramp files."
-    (let ((file (symbol-value 'file)))  ;pacify byte-compiler
-      (if (or (and (stringp file)     (tramp-tramp-file-p file))
-              (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
-          (setq ad-return-value
-                (apply 'tramp-vc-do-command buffer okstatus command
-                       (or file (buffer-file-name)) last flags))
-        ad-do-it)))))
-;;-)
+      (let ((file (symbol-value 'file)))  ;pacify byte-compiler
+       (if (or (and (stringp file)     (tramp-tramp-file-p file))
+               (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
+           (setq ad-return-value
+                 (apply 'tramp-vc-do-command buffer okstatus command
+                        (or file (buffer-file-name)) last flags))
+         ad-do-it))))
+
+  (add-hook 'tramp-unload-hook
+           '(lambda () (ad-unadvise 'vc-do-command))))
 
 
 ;; XEmacs uses this to do some of its work. Like vc-do-command, we
@@ -324,6 +327,9 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
                      (or file (buffer-file-name)) args))
       ad-do-it)))
 
+(add-hook 'tramp-unload-hook
+         '(lambda () (ad-unadvise 'vc-simple-command)))
+
 
 ;; `vc-workfile-unchanged-p'
 ;; This function does not deal well with remote files, so we do the
@@ -364,6 +370,9 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
             (tramp-vc-workfile-unchanged-p filename want-differences-if-changed))
     ad-do-it))
 
+(add-hook 'tramp-unload-hook
+         '(lambda () (ad-unadvise 'vc-workfile-unchanged-p)))
+
 
 ;; Redefine a function from vc.el -- allow tramp files.
 ;; `save-match-data' seems not to be required -- it isn't in
@@ -445,6 +454,9 @@ filename we are thinking about..."
                     (tramp-handle-vc-user-login-name uid)))) ; get the owner name
         ad-do-it)))                     ; else call the original
 
+(add-hook 'tramp-unload-hook
+         '(lambda () (ad-unadvise 'vc-user-login-name)))
+
 
 ;; Determine the name of the user owning a file.
 (defun tramp-file-owner (filename)
@@ -486,6 +498,9 @@ filename we are thinking about..."
                     (tramp-file-owner filename)))) ; get the owner name
         ad-do-it)))                     ; else call the original
 
+(add-hook 'tramp-unload-hook
+         '(lambda () (ad-unadvise 'vc-file-owner)))
+
 
 ;; We need to make the version control software backend version
 ;; information local to the current buffer. This is because each TRAMP
@@ -506,7 +521,11 @@ This makes remote VC work correctly at the cost of some processing time."
              (tramp-tramp-file-p (buffer-file-name)))
     (make-local-variable 'vc-rcs-release)
     (setq vc-rcs-release nil)))
+
 (add-hook 'find-file-hooks 'tramp-vc-setup-for-remote t)
+(add-hook 'tramp-unload-hook
+         '(lambda ()
+            (remove-hook 'find-file-hooks 'tramp-vc-setup-for-remote)))
 
 ;; No need to load this again if anyone asks.
 (provide 'tramp-vc)
index 8555c9a83c583238b768eb396adf4c59d992e792..10a5dd9eedf82a2a7302cc9d61f26144db6dbf2b 100644 (file)
@@ -2,7 +2,7 @@
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol
 
 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Kai Gro\e,A_\e(Bjohann <kai.grossjohann@gmx.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
 
 ;; The Tramp version number and bug report address, as prepared by configure.
 (require 'trampver)
+(add-hook 'tramp-unload-hook
+         '(lambda ()
+            (when (featurep 'trampver)
+              (unload-feature 'trampver 'force))))
+
+(if (featurep 'xemacs)
+    (require 'timer-funcs)
+  (require 'timer))
 
-(require 'timer)
 (require 'format-spec)                  ;from Gnus 5.8, also in tar ball
 ;; As long as password.el is not part of (X)Emacs, it shouldn't
 ;; be mandatory
 
 (autoload 'tramp-uuencode-region "tramp-uu"
   "Implementation of `uuencode' in Lisp.")
+(add-hook 'tramp-unload-hook
+         '(lambda ()
+            (when (featurep 'tramp-uu)
+              (unload-feature 'tramp-uu 'force))))
 
 (unless (fboundp 'uudecode-decode-region)
   (autoload 'uudecode-decode-region "uudecode"))
@@ -110,10 +121,20 @@ Nil means to use a separate filename syntax for Tramp.")
 ;; tramp-ftp supports Ange-FTP only.  Not suited for XEmacs therefore.
 (unless (featurep 'xemacs)
   (eval-after-load "tramp"
-    '(require 'tramp-ftp)))
+    '(progn
+       (require 'tramp-ftp)
+       (add-hook 'tramp-unload-hook
+                '(lambda ()
+                   (when (featurep 'tramp-ftp)
+                     (unload-feature 'tramp-ftp 'force)))))))
 (when (and tramp-unified-filenames (featurep 'xemacs))
   (eval-after-load "tramp"
-    '(require 'tramp-efs)))
+    '(progn
+       (require 'tramp-efs)
+       (add-hook 'tramp-unload-hook
+                '(lambda ()
+                   (when (featurep 'tramp-efs)
+                     (unload-feature 'tramp-efs 'force)))))))
 
 ;; tramp-smb uses "smbclient" from Samba.
 ;; Not available under Cygwin and Windows, because they don't offer
@@ -121,7 +142,12 @@ Nil means to use a separate filename syntax for Tramp.")
 ;; UNC file names like "//host/share/localname".
 (unless (memq system-type '(cygwin windows-nt))
   (eval-after-load "tramp"
-    '(require 'tramp-smb)))
+    '(progn
+       (require 'tramp-smb)
+       (add-hook 'tramp-unload-hook
+                '(lambda ()
+                   (when (featurep 'tramp-smb)
+                     (unload-feature 'tramp-smb 'force)))))))
 
 (eval-when-compile
   (require 'cl)
@@ -1445,7 +1471,7 @@ the visited file modtime.")
        ((fboundp 'md5-encode)
         (lambda (x) (base64-encode-string
                      (funcall (symbol-function 'md5-encode) x))))
-       (t (error "Coulnd't find an `md5' function")))
+       (t (error "Couldn't find an `md5' function")))
   "Function to call for running the MD5 algorithm.")
 
 (defvar tramp-end-of-output
@@ -2012,6 +2038,7 @@ The intent is to protect against `obsolete variable' warnings."
      (let ((,variable ,value))
        ,@body)))
 (put 'tramp-let-maybe 'lisp-indent-function 2)
+(put 'tramp-let-maybe 'edebug-form-spec t)
 
 ;;; Config Manipulation Functions:
 
@@ -2370,8 +2397,8 @@ target of the symlink differ."
      ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
      res-filemodes
      ;; 9. t iff file's gid would change if file were deleted and
-     ;; recreated.
-     nil                               ;hm?
+     ;; recreated.  Will be set in `tramp-convert-file-attributes'
+     t
      ;; 10. inode number.
      res-inode
      ;; 11. Device number.  Will be replaced by a virtual device number.
@@ -2627,9 +2654,12 @@ of."
 (defun tramp-handle-file-ownership-preserved-p (filename)
   "Like `file-ownership-preserved-p' for tramp files."
   (with-parsed-tramp-file-name filename nil
-    (or (not (file-exists-p filename))
-       ;; Existing files must be writable.
-       (zerop (tramp-run-test "-O" filename)))))
+    (let ((attributes (file-attributes filename)))
+      ;; Return t if the file doesn't exist, since it's true that no
+      ;; information would be lost by an (attempted) delete and create.
+      (or (null attributes)
+         (= (nth 2 attributes)
+            (tramp-get-remote-uid multi-method method user host))))))
 
 ;; Other file name ops.
 
@@ -3487,6 +3517,17 @@ the result will be a local, non-Tramp, filename."
        (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
          (let ((uname (match-string 1 localname))
                (fname (match-string 2 localname)))
+           ;; We cannot simply apply "~/", because under sudo "~/" is
+           ;; expanded to the local user home directory but to the
+           ;; root home directory.  On the other hand, using always
+           ;; the default user name for tilde expansion is not
+           ;; appropriate either, because ssh and companions might
+           ;; use a user name from the config file.
+           (when (and (string-equal uname "~")
+                      (string-match
+                       "\\`su\\(do\\)?\\'"
+                       (tramp-find-method multi-method method user host)))
+             (setq uname (concat uname (or user "root"))))
            ;; CCC fanatic error checking?
            (set-buffer (tramp-get-buffer multi-method method user host))
            (erase-buffer)
@@ -3499,17 +3540,24 @@ the result will be a local, non-Tramp, filename."
            (setq uname (buffer-substring (point) (tramp-line-end-position)))
            (setq localname (concat uname fname))
            (erase-buffer)))
+       ;; There might be a double slash, for example when "~/"
+       ;; expands to "/". Remove this.
+       (while (string-match "//" localname)
+         (setq localname (replace-match "/" t t localname)))
        ;; No tilde characters in file name, do normal
        ;; expand-file-name (this does "/./" and "/../").  We bind
-       ;; directory-sep-char here for XEmacs on Windows, which
-       ;; would otherwise use backslash.
+       ;; directory-sep-char here for XEmacs on Windows, which would
+       ;; otherwise use backslash.  `default-directory' is bound to
+       ;; "/", because on Windows there would be problems with UNC
+       ;; shares or Cygwin mounts.
        (tramp-let-maybe directory-sep-char ?/
-         (tramp-make-tramp-file-name
-          multi-method (or method (tramp-find-default-method user host))
-          user host
-          (tramp-drop-volume-letter
-           (tramp-run-real-handler 'expand-file-name
-                                   (list localname)))))))))
+         (let ((default-directory "/"))
+           (tramp-make-tramp-file-name
+            multi-method (or method (tramp-find-default-method user host))
+            user host
+            (tramp-drop-volume-letter
+             (tramp-run-real-handler 'expand-file-name
+                                     (list localname))))))))))
 
 ;; old version follows.  it uses ".." to cross file handler
 ;; boundaries.
@@ -4294,6 +4342,17 @@ Falls back to normal file name handler if no tramp file name handler exists."
             (cons tramp-completion-file-name-regexp
                   'tramp-completion-file-name-handler))
 
+;;;###autoload
+(defun tramp-unload-file-name-handler-alist ()
+  (setq file-name-handler-alist
+       (delete (rassoc 'tramp-file-name-handler
+                       file-name-handler-alist)
+               (delete (rassoc 'tramp-completion-file-name-handler
+                               file-name-handler-alist)
+                       file-name-handler-alist))))
+
+(add-hook 'tramp-unload-hook 'tramp-unload-file-name-handler-alist)
+
 (defun tramp-repair-jka-compr ()
   "If jka-compr is already loaded, move it to the front of
 `file-name-handler-alist'.  On Emacs 22 or so this will not be
@@ -4353,22 +4412,16 @@ necessary anymore."
                 (read (current-buffer))))))
        (list (expand-file-name name))))))
 
-;; Check for complete.el and override PC-expand-many-files if appropriate.
-(eval-and-compile
-  (defun tramp-save-PC-expand-many-files (name))); avoid compiler warning
-
-(defun tramp-setup-complete ()
-  (fset 'tramp-save-PC-expand-many-files
-        (symbol-function 'PC-expand-many-files))
-  (defun PC-expand-many-files (name)
-    (if (tramp-tramp-file-p name)
-        (funcall (symbol-function 'expand-many-files) name)
-      (tramp-save-PC-expand-many-files name))))
-
-;; Why isn't eval-after-load sufficient?
-(if (fboundp 'PC-expand-many-files)
-    (tramp-setup-complete)
-  (eval-after-load "complete" '(tramp-setup-complete)))
+(eval-after-load "complete"
+  '(progn
+     (defadvice PC-expand-many-files
+       (around tramp-advice-PC-expand-many-files (name) activate)
+       "Invoke `tramp-handle-expand-many-files' for tramp files."
+       (if (tramp-tramp-file-p name)
+          (setq ad-return-value (tramp-handle-expand-many-files name))
+        ad-do-it))
+     (add-hook 'tramp-unload-hook
+              '(lambda () (ad-unadvise 'PC-expand-many-files)))))
 
 ;;; File name handler functions for completion mode
 
@@ -4940,6 +4993,9 @@ Function may have 0-3 parameters."
              auto-save-default)
     (auto-save-mode 1)))
 (add-hook 'find-file-hooks 'tramp-set-auto-save t)
+(add-hook 'tramp-unload-hook
+         '(lambda ()
+            (remove-hook 'find-file-hooks 'tramp-set-auto-save)))
 
 (defun tramp-run-test (switch filename)
   "Run `test' on the remote system, given a SWITCH and a FILENAME.
@@ -5532,6 +5588,7 @@ Maybe the different regular expressions need to be tuned.
                   (or user (user-login-name)) host method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional here, then we would use
             ;; `undecided-dos' in some cases.  With the conditional,
@@ -5608,6 +5665,7 @@ arguments, and xx will be used as the host name to connect to.
        (setq login-args (cons "-p" (cons (match-string 2 host) login-args)))
        (setq real-host (match-string 1 host)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional, we would use
             ;; `undecided-dos' in some cases.  With the conditional,
@@ -5659,6 +5717,7 @@ prompt than you do, so it is not at all unlikely that the variable
                   (or user "<root>") method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional, we use `undecided-dos' in
             ;; some cases.  With the conditional, we use nil in these
@@ -5723,6 +5782,7 @@ log in as u2 to h2."
     (tramp-message 7 "Opening `%s' connection..." multi-method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional, we use `undecided-dos' in
             ;; some cases.  With the conditional, we use nil in these
@@ -6203,8 +6263,17 @@ locale to C and sets up the remote shell search path."
                                   "ln" tramp-remote-path nil)))
     (when ln
       (tramp-set-connection-property "ln" ln multi-method method user host)))
+  ;; Set uid and gid.
   (erase-buffer)
+  (tramp-send-command multi-method method user host "id -u; id -g")
+  (tramp-wait-for-output)
+  (goto-char (point-min))
+  (tramp-set-connection-property
+   "uid" (read (current-buffer)) multi-method method user host)
+  (tramp-set-connection-property
+   "gid" (read (current-buffer)) multi-method method user host)
   ;; Find the right encoding/decoding commands to use.
+  (erase-buffer)
   (unless (tramp-method-out-of-band-p multi-method method user host)
     (tramp-find-inline-encoding multi-method method user host))
   ;; If encoding/decoding command are given, test to see if they work.
@@ -6700,6 +6769,10 @@ Return ATTR."
   (unless (stringp (nth 8 attr))
     ;; Convert file mode bits to string.
     (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))))
+  ;; Set file's gid change bit.
+  (setcar (nthcdr 9 attr)
+         (not (= (nth 3 attr)
+                 (tramp-get-remote-gid multi-method method user host))))
   ;; Set virtual device number.
   (setcar (nthcdr 11 attr)
           (tramp-get-device multi-method method user host))
@@ -6957,6 +7030,12 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in
 (defun tramp-get-remote-ln (multi-method method user host)
   (tramp-get-connection-property "ln" nil multi-method method user host))
 
+(defun tramp-get-remote-uid (multi-method method user host)
+  (tramp-get-connection-property "uid" nil multi-method method user host))
+
+(defun tramp-get-remote-gid (multi-method method user host)
+  (tramp-get-connection-property "gid" nil multi-method method user host))
+
 ;; Get a property of a TRAMP connection.
 (defun tramp-get-connection-property
   (property default multi-method method user host)
@@ -6967,7 +7046,7 @@ If the value is not set for the connection, return `default'"
     (let (error)
       (condition-case nil
          (symbol-value (intern (concat "tramp-connection-property-" property)))
-       (error  default)))))
+       (error default)))))
 
 ;; Set a property of a TRAMP connection.
 (defun tramp-set-connection-property
@@ -7045,7 +7124,9 @@ as default."
     "Invoke `tramp-handle-make-auto-save-file-name' for tramp files."
     (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))
        (setq ad-return-value (tramp-handle-make-auto-save-file-name))
-      ad-do-it)))
+      ad-do-it))
+  (add-hook 'tramp-unload-hook
+           '(lambda () (ad-unadvise 'make-auto-save-file-name))))
 
 ;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have
 ;; permission 0666 minus umask. This is a security threat.
@@ -7069,7 +7150,10 @@ as default."
            (and (featurep 'xemacs)
                 (= emacs-major-version 21)
                 (> emacs-minor-version 4)))
-  (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))
+  (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)
+  (add-hook 'tramp-unload-hook
+           '(lambda ()
+              (remove-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))))
 
 (defun tramp-subst-strs-in-string (alist string)
   "Replace all occurrences of the string FROM with TO in STRING.
@@ -7296,7 +7380,9 @@ Only works for Bourne-like shells."
              (setq ad-return-value (list name))))
        ;; If it is not a Tramp file, just run the original function.
        (let ((res ad-do-it))
-         (setq ad-return-value (or res (list name))))))))
+         (setq ad-return-value (or res (list name)))))))
+  (add-hook 'tramp-unload-hook
+           '(lambda () (ad-unadvise 'file-expand-wildcards))))
 
 ;; Tramp version is useful in a number of situations.
 
@@ -7521,6 +7607,25 @@ Therefore, the contents of files might be included in the debug buffer(s).")
 
 (defalias 'tramp-submit-bug 'tramp-bug)
 
+;; Checklist for `tramp-unload-hook'
+;; - Unload all `tramp-*' packages
+;; - Reset `file-name-handler-alist'
+;; - Cleanup hooks where Tramp functions are in
+;; - Cleanup advised functions
+;; - Cleanup autoloads
+;;;###autoload
+(defun tramp-unload-tramp ()
+  (interactive)
+  ;; When Tramp is not loaded yet, its autoloads are still active.
+  (tramp-unload-file-name-handler-alist)
+  ;; ange-ftp settings must be enabled.
+  (when (functionp 'tramp-ftp-enable-ange-ftp)
+    (funcall (symbol-function 'tramp-ftp-enable-ange-ftp)))
+  ;; `tramp-util' unloads also `tramp'.
+  (condition-case nil ;; maybe its not loaded yet.
+      (unload-feature (if (featurep 'tramp-util) 'tramp-util 'tramp) 'force)
+    (error nil)))
+
 (provide 'tramp)
 
 ;; Make sure that we get integration with the VC package.
@@ -7528,7 +7633,12 @@ Therefore, the contents of files might be included in the debug buffer(s).")
 ;; This must come after (provide 'tramp) because tramp-vc.el
 ;; requires tramp.
 (eval-after-load "vc"
-  '(require 'tramp-vc))
+  '(progn
+     (require 'tramp-vc)
+     (add-hook 'tramp-unload-hook
+              '(lambda ()
+                 (when (featurep 'tramp-vc)
+                   (unload-feature 'tramp-vc 'force))))))
 
 ;;; TODO:
 
index 650f1a727a77d093ae44465453b292c4c45e2868..632d958249d0197111904fec62b8184c454900ab 100644 (file)
@@ -30,7 +30,7 @@
 ;; are auto-frobbed from configure.ac, so you should edit that file and run
 ;; "autoconf && ./configure" to change them.
 
-(defconst tramp-version "2.0.51"
+(defconst tramp-version "2.0.52"
   "This version of Tramp.")
 
 (defconst tramp-bug-report-address "tramp-devel@gnu.org"
index 8e6506c47c63f724d205cdd329c21763d21f7fa3..8b306687f0c1522947f552668fbde10674e0c1c2 100644 (file)
@@ -1,3 +1,13 @@
+2006-01-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       Sync with Tramp 2.0.52.
+
+       * tramp.texi (Frequently Asked Questions): Remove Ange-FTP item.
+       Add Tramp disabling item.  New item for common connection
+       problems.
+       (various): Apply "ftp" as method for the download URL.
+       (Bug Reports): Refer to FAQ for common problems.
+
 2006-01-21  Eli Zaretskii  <eliz@gnu.org>
 
        * widget.texi (User Interface): Use @key for TAB.
index ccaa0cd3c61adbd17c878a9856888e2c360d9338..89773534096b9abc61061c730f256e877da9288f 100644 (file)
@@ -25,8 +25,8 @@
 @end macro
 
 @copying
-Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004,
-   2005 Free Software Foundation, Inc.
+Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -111,7 +111,7 @@ Japanese translation}.
 @end ifset
 
 The latest release of @value{tramp} is available for
-@uref{http://ftp.gnu.org/gnu/tramp/, download}, or you may see
+@uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see
 @ref{Obtaining Tramp} for more details, including the CVS server
 details.
 
@@ -378,7 +378,7 @@ behind the scenes when you open a file with @value{tramp}.
 
 @value{tramp} is freely available on the Internet and the latest
 release may be downloaded from
-@uref{http://ftp.gnu.org/gnu/tramp/}. This release includes the full
+@uref{ftp://ftp.gnu.org/gnu/tramp/}. This release includes the full
 documentation and code for @value{tramp}, suitable for installation.
 But GNU Emacs (22 or later) includes @value{tramp} already, and there
 is a @value{tramp} package for XEmacs, as well.  So maybe it is easier
@@ -1946,7 +1946,9 @@ will automatically generate a buffer with the details of your system and
 
 When submitting a bug report, please try to describe in excruciating
 detail the steps required to reproduce the problem, the setup of the
-remote machine and any special conditions that exist.
+remote machine and any special conditions that exist.  You should also
+check that your problem is not described already in @xref{Frequently
+Asked Questions}.
 
 If you can identify a minimal test case that reproduces the problem,
 include that with your bug report. This will make it much easier for the
@@ -1964,7 +1966,7 @@ Where can I get the latest @value{tramp}?
 @value{tramp} is available under the URL below.
 
 @noindent
-@uref{http://ftp.gnu.org/gnu/tramp/}
+@uref{ftp://ftp.gnu.org/gnu/tramp/}
 
 @noindent
 There is also a Savannah project page.
@@ -1972,6 +1974,7 @@ There is also a Savannah project page.
 @noindent
 @uref{http://savannah.gnu.org/projects/tramp/}
 
+
 @item
 Which systems does it work on?
 
@@ -2003,49 +2006,32 @@ Emacs?  I think there was some issue with @command{ssh}?
 
 
 @item
-I can't stop @value{ftppackagename} starting with @value{emacsname}
+@value{tramp} does not connect to the remote host
 
-@ifset emacs
-@value{ftppackagename} is loaded from @value{tramp} automatically if you
-require a file by the ftp method.  Unfortunately, there are some Lisp
-packages which make @value{ftppackagename} file name handlers active.
-You can see it applying @kbd{C-h v file-name-handler-alist}:
+When @value{tramp} does not connect to the remote host, there are two
+reasons heading the bug mailing list:
 
-@example
-file-name-handler-alist's value is
-(("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
- ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
- ("^/[^/]*$" . tramp-completion-file-name-handler)
- ("\\`/[^/:]+:" . tramp-file-name-handler)
- ("\\`/:" . file-name-non-special))
-@end example
+@itemize @minus
 
-Please try to find out which package is responsible for loading
-@value{ftppackagename}, and raise a bug report.
+@item
+Unknown characters in the prompt
 
-A workaround is to require @value{ftppackagename} before @value{tramp} in
-your @file{~/.emacs}, because @value{tramp} cleans up the entries in
-@code{file-name-handler-alist}:
+@value{tramp} needs to recognize the prompt on the remote machine
+after execution any command.  This is not possible, when the prompt
+contains unknown characters like escape sequences for coloring.  This
+should be avoided on the remote side.  @xref{Remote shell setup}. for
+setting the regular expression detecting the prompt.
 
-@lisp
-;; @value{ftppackagename} temporarily required
-(require 'ange-ftp)
-;; @value{tramp} cleans up @code{file-name-handler-alist}
-(require 'tramp)
-@end lisp
-@end ifset
+@item
+@value{tramp} doesn't transfer strings with more than 500 characters
+correctly
 
-@ifset xemacs
-Not all the older versions of @value{tramp} supported @value{emacsname}
-correctly.  The first thing to do is to make sure that you have the
-latest version of @value{tramp} installed.
-
-If you do, please try and find out exactly the conditions required for
-the @value{ftppackagename} handlers to fire.  If you can, putting a
-breakpoint on @code{efs-ftp-path} and sending in the stack trace along
-with your bug report would make it easier for the developers to work out
-what is going wrong.
-@end ifset
+On some few systems, the implementation of @code{process-send-string}
+seems to be broken for longer strings.  This case, you should
+customize the variable @code{tramp-chunksize} to 500.  For a
+description how to determine whether this is necessary see the
+documentation of @code{tramp-chunksize}.
+@end itemize
 
 
 @item
@@ -2132,14 +2118,24 @@ fi
 
 
 @item
-@value{tramp} doesn't transfer strings with more than 500 characters
-correctly
+How can I disable @value{tramp}?
 
-On some few systems, the implementation of @code{process-send-string}
-seems to be broken for longer strings.  This case, you should
-customize the variable @code{tramp-chunksize} to 500.  For a
-description how to determine whether this is necessary see the
-documentation of @code{tramp-chunksize}.
+Shame on you, why did you read until now?
+
+@ifset emacs
+If you just want to have @value{ftppackagename} as default remote
+files access package, you should apply the following code:
+
+@lisp
+(setq tramp-default-method "ftp")
+@end lisp
+@end ifset
+
+Unloading @value{tramp} can be achieved by applying @kbd{M-x
+tramp-unload-tramp}.
+@ifset emacs
+This resets also the @value{ftppackagename} plugins.
+@end ifset
 @end itemize
 
 
index 9f2bb8737f7e3794ba0126514a5bf34042ea362b..625e3869c1113217e9b6e66eb0a86e219c72b9cc 100644 (file)
@@ -4,7 +4,7 @@
 @c In the Tramp CVS, the version number is auto-frobbed from
 @c configure.ac, so you should edit that file and run
 @c "autoconf && ./configure" to change the version number.
-@set trampver 2.0.51
+@set trampver 2.0.52
 
 @c Other flags from configuration
 @set prefix /usr/local