changeset 55844:4bc6cb45c326

Version 2.0.41 of Tramp released.
author Michael Albinus <michael.albinus@gmx.de>
date Sat, 29 May 2004 22:28:49 +0000
parents 26e0724718e2
children 6d0508ef2a09
files lisp/ChangeLog lisp/net/tramp-smb.el lisp/net/tramp-uu.el lisp/net/tramp.el man/ChangeLog man/trampver.texi
diffstat 6 files changed, 146 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat May 29 21:02:20 2004 +0000
+++ b/lisp/ChangeLog	Sat May 29 22:28:49 2004 +0000
@@ -1,3 +1,53 @@
+2004-05-29  Michael Albinus  <michael.albinus@gmx.de>
+
+	Version 2.0.41 of Tramp released.
+
+	* tramp.el (tramp-wait-for-regexp, tramp-wait-for-output): Throw
+	away if process has died.  Reported by Luc Teirlinck
+	<teirllm@dms.auburn.edu>.
+	(tramp-out-of-band-prompt-regexp): Renamed to
+	`tramp-process-alive-regexp', because its usage is widen.
+	(tramp-actions-copy-out-of-band): Apply it.
+	(tramp-actions-before-shell, tramp-multi-actions): Add
+	`tramp-action-process-alive' action.
+	(tramp-action-process-alive): New defun.
+	(tramp-file-name-handler-alist, tramp-file-name-for-operation):
+	Add entry for `file-remote-p'.
+	(tramp-handle-file-remote-p): New defun.
+	(top): Remove setting of `file-remote-p'.  Don't set
+	`inhibit-file-name-handlers' and `inhibit-file-name-operation'.
+
+	* tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry for
+	`file-remote-p'.
+
+	* tramp-uu.el (tramp-uuencode-region): Padding characters aren't
+	counted for (last) line.  Reported by Aaron Ucko
+	<ucko@ncbi.nlm.nih.gov>.
+
+2004-05-29  Kai Grossjohann  <kai.grossjohann@gmx.net>
+
+	* tramp.el (tramp-initial-commands): Add "unset HISTFILE"; this is
+	not really necessary but seems to keep the shell history smaller
+	in some cases.  It is no substitute for setting HISTFILE and
+	HISTSIZE from tramp-open-connection-setup-interactive-shell,
+	though.  Suggested by Luc Teirlinck.
+	(tramp-open-connection-setup-interactive-shell): Export variables
+	HISTFILE and HISTSIZE, do not just set them.  From Luc Teirlinck.
+	(tramp-set-process-query-on-exit-flag): New compat function.
+	(tramp-open-connection-multi, tramp-open-connection-su)
+	(tramp-open-connection-rsh, tramp-open-connection-telnet)
+	(tramp-do-copy-or-rename-file-out-of-band): Use it.
+	(tramp-let-maybe): New macro, let-binds a variable only if it
+	isn't obsolete.
+	(tramp-check-ls-commands, tramp-handle-expand-file-name)
+	(tramp-handle-file-truename): Use it.
+	(tramp-completion-file-name-regexp-unified): Avoid matching
+	filenames starting with "/:" -- those are reserved for
+	file-name-non-special.
+
+	* tramp-smb.el (tramp-smb-open-connection): Use
+	tramp-set-process-query-on-exit-flag compat function.
+
 2004-05-29  Richard M. Stallman  <rms@gnu.org>
 
 	* net/browse-url.el (browse-url-interactive-arg): Doc fix.
@@ -150,7 +200,6 @@
 	(starttls-negotiate, starttls-open-stream): Check `starttls-use-gnutls'
 	and pass on to corresponding *-gnutls function if it is set.
 
->>>>>>> 1.6105
 2004-05-27  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* autorevert.el (auto-revert-handler): Disable auto-reverting of
@@ -292,7 +341,6 @@
 	* progmodes/grep.el (grep-tree): Ensure that DIR argument is
 	interpreted as a directory.
 
->>>>>>> 1.6097
 2004-05-22  Richard M. Stallman  <rms@gnu.org>
 
 	* textmodes/paragraphs.el (sentence-end): Match unicode curly quotes
--- a/lisp/net/tramp-smb.el	Sat May 29 21:02:20 2004 +0000
+++ b/lisp/net/tramp-smb.el	Sat May 29 22:28:49 2004 +0000
@@ -144,6 +144,7 @@
     (file-executable-p . tramp-smb-handle-file-exists-p)
     (file-exists-p . tramp-smb-handle-file-exists-p)
     (file-local-copy . tramp-smb-handle-file-local-copy)
+    (file-remote-p . tramp-handle-file-remote-p)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
     ;; `file-name-as-directory' performed by default handler
@@ -1003,7 +1004,7 @@
 		       tramp-smb-program args)))
 
 	(tramp-message 9 "Started process %s" (process-command p))
-	(process-kill-without-query p)
+	(tramp-set-process-query-on-exit-flag p nil)
 	(set-buffer buffer)
 	(setq tramp-smb-share share)
 
--- a/lisp/net/tramp-uu.el	Sat May 29 21:02:20 2004 +0000
+++ b/lisp/net/tramp-uu.el	Sat May 29 22:28:49 2004 +0000
@@ -1,7 +1,7 @@
 ;;; -*- coding: iso-2022-7bit; -*-
 ;;; tramp-uu.el --- uuencode in Lisp
 
-;; Copyright (C) 2002  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004  Free Software Foundation, Inc.
 
 ;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 ;; Keywords: comm, terminals
@@ -63,10 +63,10 @@
 	(setq c (char-after (point)))
 	(delete-char 1)
 	(if (equal c ?=)
-	    ;; "=" means padding.  Insert "`" instead.
-	    (insert "`")
-	  (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c))))
-	(setq i (1+ i))
+	    ;; "=" means padding.  Insert "`" instead.  Not counted for length.
+	    (progn (insert "`") (setq len (1- len)))
+	  (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c)))
+	  (setq i (1+ i)))
 	;; Every 60 characters, add "M" at beginning of line (as
 	;; length byte) and insert a newline.
 	(when (zerop (% i 60))
--- a/lisp/net/tramp.el	Sat May 29 21:02:20 2004 +0000
+++ b/lisp/net/tramp.el	Sat May 29 22:28:49 2004 +0000
@@ -911,12 +911,13 @@
   :group 'tramp
   :type 'regexp)
 
-(defcustom tramp-out-of-band-prompt-regexp
+(defcustom tramp-process-alive-regexp
   ""
-  "Regular expression indicating an out-of-band copy has finished.
+  "Regular expression indicating a process has finished.
 In fact this expression is empty by intention, it will be used only to
 check regularly the status of the associated process.
-The answer will be provided by `tramp-action-out-of-band', which see."
+The answer will be provided by `tramp-action-process-alive' and
+`tramp-action-out-of-band', which see."
   :group 'tramp
   :type 'regexp)
 
@@ -1146,7 +1147,7 @@
 
 ;;;###autoload
 (defconst tramp-completion-file-name-regexp-unified
-  "^/[^/]*$"
+  "^/$\\|^/[^/:][^/]*$"
   "Value for `tramp-completion-file-name-regexp' for unified remoting.
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
 Tramp.  See `tramp-file-name-structure-unified' for more explanations.")
@@ -1288,7 +1289,8 @@
     (tramp-wrong-passwd-regexp tramp-action-permission-denied)
     (tramp-yesno-prompt-regexp tramp-action-yesno)
     (tramp-yn-prompt-regexp tramp-action-yn)
-    (tramp-terminal-prompt-regexp tramp-action-terminal))
+    (tramp-terminal-prompt-regexp tramp-action-terminal)
+    (tramp-process-alive-regexp tramp-action-process-alive))
   "List of pattern/action pairs.
 Whenever a pattern matches, the corresponding action is performed.
 Each item looks like (PATTERN ACTION).
@@ -1306,7 +1308,7 @@
 (defcustom tramp-actions-copy-out-of-band
   '((tramp-password-prompt-regexp tramp-action-password)
     (tramp-wrong-passwd-regexp tramp-action-permission-denied)
-    (tramp-out-of-band-prompt-regexp tramp-action-out-of-band))
+    (tramp-process-alive-regexp tramp-action-out-of-band))
   "List of pattern/action pairs.
 This list is used for copying/renaming with out-of-band methods.
 See `tramp-actions-before-shell' for more info."
@@ -1318,7 +1320,8 @@
     (tramp-login-prompt-regexp tramp-multi-action-login)
     (shell-prompt-pattern tramp-multi-action-succeed)
     (tramp-shell-prompt-pattern tramp-multi-action-succeed)
-    (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied))
+    (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)
+    (tramp-process-alive-regexp tramp-action-process-alive))
   "List of pattern/action pairs.
 This list is used for each hop in multi-hop connections.
 See `tramp-actions-before-shell' for more info."
@@ -1326,7 +1329,8 @@
   :type '(repeat (list variable function)))
 
 (defcustom tramp-initial-commands
-  '("unset correct"
+  '("unset HISTORY"
+    "unset correct"
     "unset autocorrect")
   "List of commands to send to the first remote shell that we see.
 These commands will be sent to any shell, and thus they should be
@@ -1768,6 +1772,7 @@
     (insert-directory . tramp-handle-insert-directory)
     (expand-file-name . tramp-handle-expand-file-name)
     (file-local-copy . tramp-handle-file-local-copy)
+    (file-remote-p . tramp-handle-file-remote-p)
     (insert-file-contents . tramp-handle-insert-file-contents)
     (write-region . tramp-handle-write-region)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
@@ -2042,8 +2047,8 @@
   "Like `file-truename' for tramp files."
   (with-parsed-tramp-file-name filename nil
     (let* ((steps        (tramp-split-string localname "/"))
-	   (localnamedir (let ((directory-sep-char ?/))
-		      (file-name-as-directory localname)))
+	   (localnamedir (tramp-let-maybe directory-sep-char ?/	;for XEmacs
+			   (file-name-as-directory localname)))
 	   (is-dir (string= localname localnamedir))
 	   (thisstep nil)
 	   (numchase 0)
@@ -2984,7 +2989,7 @@
       ;; Use rcp-like program for file transfer.
       (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
 		      copy-program copy-args)))
-	(process-kill-without-query p)
+	(tramp-set-process-query-on-exit-flag p nil)
 	(tramp-process-actions p multi-method method user host
 			       tramp-actions-copy-out-of-band))
       (kill-buffer trampbuf)
@@ -3297,7 +3302,7 @@
 	;; expand-file-name (this does "/./" and "/../").  We bind
 	;; directory-sep-char here for XEmacs on Windows, which
 	;; would otherwise use backslash.
-	(let ((directory-sep-char ?/))
+	(tramp-let-maybe directory-sep-char ?/
 	  (tramp-make-tramp-file-name
 	   multi-method (or method (tramp-find-default-method user host))
 	   user host
@@ -3525,6 +3530,9 @@
 	    (t (error "Wrong method specification for `%s'" method)))
       tmpfil)))
 
+(defun tramp-handle-file-remote-p (filename)
+  "Like `file-remote-p' for tramp files."
+  (when (tramp-tramp-file-p filename) t))
 
 (defun tramp-handle-insert-file-contents
   (filename &optional visit beg end replace)
@@ -3845,10 +3853,10 @@
 
 ;; We handle here all file primitives.  Most of them have the file
 ;; name as first parameter; nevertheless we check for them explicitly
-;; in order to be be signalled if a new primitive appears.  This
+;; in order to be signalled if a new primitive appears.  This
 ;; scenario is needed because there isn't a way to decide by
 ;; syntactical means whether a foreign method must be called.  It would
-;; ease the live if `file-name-handler-alist' would support a decision
+;; ease the life if `file-name-handler-alist' would support a decision
 ;; function as well but regexp only.
 (defun tramp-file-name-for-operation (operation &rest args)
   "Return file name related to OPERATION file primitive.
@@ -3862,16 +3870,16 @@
 		  'dired-compress-file 'dired-uncache
 		  'file-accessible-directory-p 'file-attributes
 		  'file-directory-p 'file-executable-p 'file-exists-p
-		  'file-local-copy 'file-modes 'file-name-as-directory
-		  'file-name-directory 'file-name-nondirectory
-		  'file-name-sans-versions 'file-ownership-preserved-p
-		  'file-readable-p 'file-regular-p 'file-symlink-p
-		  'file-truename 'file-writable-p 'find-backup-file-name
-		  'find-file-noselect 'get-file-buffer 'insert-directory
-		  'insert-file-contents 'load 'make-directory
-		  'make-directory-internal 'set-file-modes
-		  'substitute-in-file-name 'unhandled-file-name-directory
-		  'vc-registered
+		  'file-local-copy 'file-remote-p 'file-modes
+		  'file-name-as-directory 'file-name-directory
+		  'file-name-nondirectory 'file-name-sans-versions
+		  'file-ownership-preserved-p 'file-readable-p
+		  'file-regular-p 'file-symlink-p 'file-truename
+		  'file-writable-p 'find-backup-file-name 'find-file-noselect
+		  'get-file-buffer 'insert-directory 'insert-file-contents
+		  'load 'make-directory 'make-directory-internal
+		  'set-file-modes 'substitute-in-file-name
+		  'unhandled-file-name-directory 'vc-registered
 		  ; XEmacs only
 		  'abbreviate-file-name 'create-file-buffer
 		  'dired-file-modtime 'dired-make-compressed-filename
@@ -3940,9 +3948,6 @@
        (foreign (apply foreign operation args))
        (t (tramp-run-real-handler operation args))))))
 
-;;;###autoload
-(put 'tramp-file-name-handler 'file-remote-p t)	;for file-remote-p
-
 (defun tramp-sh-file-name-handler (operation &rest args)
   "Invoke remote-shell Tramp file name handler.
 Fall back to normal file name handler if no Tramp handler exists."
@@ -4887,16 +4892,16 @@
   "Checks whether the given `ls' executable in one of the dirs groks `-n'.
 Returns nil if none was found, else the command is returned."
   (let ((dl dirlist)
-        (result nil)
-	(directory-sep-char ?/))	;for XEmacs
-    ;; It would be better to use the CL function `find', but
-    ;; we don't want run-time dependencies on CL.
-    (while (and dl (not result))
-      (let ((x (concat (file-name-as-directory (car dl)) cmd)))
-        (when (tramp-check-ls-command multi-method method user host x)
-          (setq result x)))
-      (setq dl (cdr dl)))
-    result))
+        (result nil))
+    (tramp-let-maybe directory-sep-char ?/ ;for XEmacs
+      ;; It would be better to use the CL function `find', but
+      ;; we don't want run-time dependencies on CL.
+      (while (and dl (not result))
+	(let ((x (concat (file-name-as-directory (car dl)) cmd)))
+	  (when (tramp-check-ls-command multi-method method user host x)
+	    (setq result x)))
+	(setq dl (cdr dl)))
+      result)))
 
 (defun tramp-find-ls-command (multi-method method user host)
   "Finds an `ls' command which groks the `-n' option, returning nil if failed.
@@ -4976,6 +4981,11 @@
   (process-send-string nil (concat tramp-terminal-type
 				   tramp-rsh-end-of-line)))
 
+(defun tramp-action-process-alive (p multi-method method user host)
+  "Check whether a process has finished."
+  (unless (memq (process-status p) '(run open))
+    (throw 'tramp-action 'process-died)))
+
 (defun tramp-action-out-of-band (p multi-method method user host)
   "Check whether an out-of-band copy has finished."
   (cond ((and (memq (process-status p) '(stop exit))
@@ -5165,7 +5175,7 @@
 			user host 'tramp-login-args)))
              (found nil)
              (pw nil))
-        (process-kill-without-query p)
+        (tramp-set-process-query-on-exit-flag p nil)
 	(set-buffer (tramp-get-buffer multi-method method user host))
 	(erase-buffer)
 	(tramp-process-actions p multi-method method user host
@@ -5232,7 +5242,7 @@
                   (apply #'start-process bufnam buf login-program 
                          host login-args)))
              (found nil))
-        (process-kill-without-query p)
+        (tramp-set-process-query-on-exit-flag p nil)
 
 	(set-buffer buf)
 	(tramp-process-actions p multi-method method user host
@@ -5293,7 +5303,7 @@
 			 user host 'tramp-login-args))))
              (found nil)
              (pw nil))
-        (process-kill-without-query p)
+        (tramp-set-process-query-on-exit-flag p nil)
 	(set-buffer (tramp-get-buffer multi-method method user host))
 	(tramp-process-actions p multi-method method user host
 			       tramp-actions-before-shell)
@@ -5346,7 +5356,7 @@
                                tramp-multi-sh-program))
              (num-hops (length method))
              (i 0))
-        (process-kill-without-query p)
+        (tramp-set-process-query-on-exit-flag p nil)
         (tramp-message 9 "Waiting 60s for local shell to come up...")
         (unless (tramp-wait-for-regexp
 		 p 60 (format "\\(%s\\)\\'\\|\\(%s\\)\\'"
@@ -5466,12 +5476,16 @@
              (with-timeout (timeout)
                (while (not found)
                  (accept-process-output proc 1)
+		 (unless (memq (process-status proc) '(run open))
+		   (error "Process has died"))
                  (goto-char (point-min))
                  (setq found (when (re-search-forward regexp nil t)
                                (tramp-match-string-list)))))))
           (t
            (while (not found)
              (accept-process-output proc 1)
+	     (unless (memq (process-status proc) '(run open))
+	       (error "Process has died"))
              (goto-char (point-min))
              (setq found (when (re-search-forward regexp nil t)
                            (tramp-match-string-list))))))
@@ -5526,7 +5540,7 @@
 
 ;; HHH: Not Changed.  This might handle the case where USER is not
 ;;      given in the "File name" very poorly.  Then, the local
-;;      variable tramp-current user will be set to nil.
+;;      variable tramp-current-user will be set to nil.
 (defun tramp-pre-connection (multi-method method user host)
   "Do some setup before actually logging in.
 METHOD, USER and HOST specify the connection."
@@ -5621,9 +5635,10 @@
 				     "stty -onlcr"))))
   (erase-buffer)
   (tramp-message
-   9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'")
-  (tramp-send-command-internal multi-method method user host
-			       "HISTFILE=$HOME/.tramp_history; HISTSIZE=1")
+   9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE'")
+  (tramp-send-command-internal
+   multi-method method user host
+   "HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE")
   (erase-buffer)
   (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'")
   (tramp-send-command-internal multi-method method user host
@@ -6079,12 +6094,16 @@
                (with-timeout (timeout)
                  (while (not found)
                    (accept-process-output proc 1)
+		   (unless (memq (process-status proc) '(run open))
+		     (error "Process has died"))
                    (goto-char (point-max))
                    (forward-line -1)
                    (setq found (looking-at end-of-output))))))
             (t
              (while (not found)
                (accept-process-output proc 1)
+	       (unless (memq (process-status proc) '(run open))
+		 (error "Process has died"))
                (goto-char (point-max))
                (forward-line -1)
                (setq found (looking-at end-of-output))))))
@@ -6762,6 +6781,26 @@
 it does the right thing."
   (delete "" (split-string string pattern)))
 
+(defun tramp-set-process-query-on-exit-flag (process flag)
+  "Specify if query is needed for process when Emacs is exited.
+If the second argument flag is non-nil, Emacs will query the user before
+exiting if process is running."
+  (if (fboundp 'set-process-query-on-exit-flag)
+      (set-process-query-on-exit-flag process flag)
+    (funcall (symbol-function 'process-kill-without-query)
+	     process flag)))
+
+(defmacro tramp-let-maybe (variable value &rest body)
+  "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
+BODY is executed whether or not the variable is obsolete.
+The intent is to protect against `obsolete variable' warnings."
+  `(if (get 'byte-obsolete-variable ',variable)
+       (progn ,@body)
+     (let ((,variable ,value))
+       ,@body)))
+(put 'tramp-let-maybe 'lisp-indent-function 2)
+
+
 ;; ------------------------------------------------------------ 
 ;; -- Kludges section -- 
 ;; ------------------------------------------------------------ 
--- a/man/ChangeLog	Sat May 29 21:02:20 2004 +0000
+++ b/man/ChangeLog	Sat May 29 22:28:49 2004 +0000
@@ -1,3 +1,7 @@
+2004-05-29  Michael Albinus  <michael.albinus@gmx.de>
+
+	Version 2.0.41 of Tramp released.
+
 2004-05-29  Juanma Barranquero  <lektu@terra.es>
 
 	* makefile.w32-in (../info/flymake, flymake.dvi): New targets.
--- a/man/trampver.texi	Sat May 29 21:02:20 2004 +0000
+++ b/man/trampver.texi	Sat May 29 22:28:49 2004 +0000
@@ -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.40
+@set trampver 2.0.41
 
 @c Other flags from configuration
 @set prefix /usr/local