diff options
| author | Kai Großjohann | 2003-02-05 21:03:36 +0000 |
|---|---|---|
| committer | Kai Großjohann | 2003-02-05 21:03:36 +0000 |
| commit | 8daea7fc4639db177fdaf1a5d0a636edcb974280 (patch) | |
| tree | a7cdae6af3cd847bae31cae656a514dfb6c6a1bc | |
| parent | e37344094affb7e028bf2415e834b554209ba812 (diff) | |
| download | emacs-8daea7fc4639db177fdaf1a5d0a636edcb974280.tar.gz emacs-8daea7fc4639db177fdaf1a5d0a636edcb974280.zip | |
2003-02-05 Kai Gro�ohann <kai.grossjohann@uni-duisburg.de>
Version 2.0.29 released.
* net/tramp.el (tramp-send-region): Protect against
tramp-chunksize being nil.
2003-02-04 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-handle-directory-file-name): Handle the case
PATH is "".
(tramp-completion-handle-file-name-all-completions): Define
`tramp-current-user' locally. See `tramp-parse-passwd'.
(tramp-parse-passwd): For su-alike methods it would be desirable
to return "root@localhost" as default. Unfortunately, we have no
information whether any user name has been typed already. So we
(mis-)use tramp-current-user as indication, assuming it is set in
`tramp-completion-handle-file-name-all-completions'.
(tramp-send-region): Handle the case `tramp-chunksize' is equal
0. I did it accidently. Infinite loop ...
* net/tramp-ftp.el (top-level): eval-after-load "ange-ftp"
'(tramp-disable-ange-ftp). Suggested by Kai.
(tramp-ftp-file-name-handler): `tramp-disable-ange-ftp' not needed
any longer.
* net/tramp-smb.el (tramp-smb-file-name-handler-alist): Apply
`tramp-handle-directory-file-name' in order to profit from Kai's
yesterday changes.
2003-02-03 Kai Gro�ohann <kai.grossjohann@uni-duisburg.de>
* net/tramp.el (tramp-chunksize): Set default to 500 as workaround
for some ssh connections.
(tramp-handle-directory-file-name): New implementation. Not sure
if it works.
2003-01-28 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-get-device): `tramp-make-tramp-file-name'
must not be called with NIL path. It fails in case of
multi-method.
2003-01-27 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-file-name-for-operation): Apply
`expand-file-name' for relative file names only. Otherwise there
might be problems if the default directory is another Tramp
directory as the directory the file is based on.
(tramp-find-foreign-file-name-handler): Check whether FILENAME is
a Tramp file name. It isn't if it comes from an expanded file
name (like "/xx:yy//zz").
2003-01-25 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-devices): New variable. Keeps virtual
device numbers. Devices must distinguish physical file systems.
The device numbers provided by "lstat" aren't unique, because we
operate on different hosts. So we use virtual device numbers,
generated by `tramp-get-device'. Both Ange-FTP and EFS use device
number -1. In order to be different, we use device number (-1 x),
whereby "x" is unique for a given (multi-method method user host).
Suggested by Kai.
(tramp-perl-file-attributes): Always return device number -1.
There will be a virtual device number set in
`tramp-handle-file-attributes', which replaces this one.
(tramp-handle-file-attributes): Set virtual device number.
(tramp-get-device): New function. Returns the virtual device
number. If it doesn't exist, generate a new one.
(tramp-handle-file-regular-p): Use Emacs file name primitives
instead of calling tramp-handle-* equivalents directly. Needed
for tramp-smb.
* net/tramp-smb.el (tramp-smb-devices, tramp-smb-get-device): Removed.
Functionality moved to tramp.el.
(tramp-smb-handle-file-attributes): Apply
`tramp-get-device'. ATIME and CTIME are (0 0) now (= "don't
know"), which is more honest.
(tramp-smb-handle-make-directory): Use Emacs file name primitives
instead of calling tramp-smb-handle-* equivalents directly.
(tramp-smb-read-file-entry): Return size as a number but a string.
2003-01-24 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-completion-function-alist-ssh): Add parsing
of "/etc/ssh_config" and "~/.ssh/config". Suggested by Kai.
(tramp-completion-function-alist, tramp-set-completion-function):
Doc string update.
(tramp-parse-sconfig, tramp-parse-sconfig-group): New functions.
Provide parsing of "~/.ssh/config" style files.
2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-completion-handle-expand-file-name): Apply
`tramp-drop-volume-letter'. Otherwise, there are problems on W32
systems.
2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp-smb.el (tramp-smb-get-device, tramp-smb-get-inode): New
functions. Device number and inode number don't exist for SMB
files. Therefore we must generate virtual ones.
(tramp-smb-devices, tramp-smb-inodes): New variables. Keep
generated virtual device numbers and inodes numbers for SMB files.
(tramp-smb-handle-file-attributes): Apply them.
2003-01-14 Kai Gro�ohann <kai.grossjohann@uni-duisburg.de>
* net/tramp.el (tramp-md5-function): Require md5 before checking
function md5. If using md5-encode, put wrapper around it that
converts vector of bytes to ascii text.
2003-01-13 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-completion-mode): Perform check (integerp
last-input-event) before (event-modifiers last-input-event) -
there might be problems if `last-input-event' is a mouse event.
2003-01-12 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el (tramp-parse-rhosts, tramp-parse-shosts)
(tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc): Use
`file-readable-p' instead of `file-exists-p'. Otherwise these
functions might block. Reported by <kin@neoscale.com>.
2003-01-02 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp-ftp.el (top-level): Defaults for
`tramp-default-method-alist' must be a list.
* net/tramp-smb.el (top-level): Defaults for
`tramp-default-method-alist' must be a list.
2003-01-02 Kai Gro�ohann <kai.grossjohann@uni-duisburg.de>
* net/tramp.el (top-level): Avoid byte-compiler warnings of unused
variables if the byte-compiler supports this. This is for the
with-parsed-tramp-file-name macro which is wont to produce such
stuff.
| -rw-r--r-- | lisp/ChangeLog | 147 | ||||
| -rw-r--r-- | lisp/net/tramp-ftp.el | 12 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 44 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 203 |
4 files changed, 331 insertions, 75 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d2da1e07426..eda47daf3ff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,148 @@ | |||
| 1 | 2003-02-05 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> | ||
| 2 | |||
| 3 | * ido.el (ido-define-mode-map): Interact with Viper. From Kim F | ||
| 4 | Storm. | ||
| 5 | |||
| 6 | 2003-02-05 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> | ||
| 7 | |||
| 8 | Version 2.0.29 released. | ||
| 9 | |||
| 10 | * net/tramp.el (tramp-send-region): Protect against | ||
| 11 | tramp-chunksize being nil. | ||
| 12 | |||
| 13 | 2003-02-04 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 14 | |||
| 15 | * net/tramp.el (tramp-handle-directory-file-name): Handle the case | ||
| 16 | PATH is "". | ||
| 17 | (tramp-completion-handle-file-name-all-completions): Define | ||
| 18 | `tramp-current-user' locally. See `tramp-parse-passwd'. | ||
| 19 | (tramp-parse-passwd): For su-alike methods it would be desirable | ||
| 20 | to return "root@localhost" as default. Unfortunately, we have no | ||
| 21 | information whether any user name has been typed already. So we | ||
| 22 | (mis-)use tramp-current-user as indication, assuming it is set in | ||
| 23 | `tramp-completion-handle-file-name-all-completions'. | ||
| 24 | (tramp-send-region): Handle the case `tramp-chunksize' is equal | ||
| 25 | 0. I did it accidently. Infinite loop ... | ||
| 26 | |||
| 27 | * net/tramp-ftp.el (top-level): eval-after-load "ange-ftp" | ||
| 28 | '(tramp-disable-ange-ftp). Suggested by Kai. | ||
| 29 | (tramp-ftp-file-name-handler): `tramp-disable-ange-ftp' not needed | ||
| 30 | any longer. | ||
| 31 | |||
| 32 | * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Apply | ||
| 33 | `tramp-handle-directory-file-name' in order to profit from Kai's | ||
| 34 | yesterday changes. | ||
| 35 | |||
| 36 | 2003-02-03 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> | ||
| 37 | |||
| 38 | * net/tramp.el (tramp-chunksize): Set default to 500 as workaround | ||
| 39 | for some ssh connections. | ||
| 40 | (tramp-handle-directory-file-name): New implementation. Not sure | ||
| 41 | if it works. | ||
| 42 | |||
| 43 | 2003-01-28 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 44 | |||
| 45 | * net/tramp.el (tramp-get-device): `tramp-make-tramp-file-name' | ||
| 46 | must not be called with NIL path. It fails in case of | ||
| 47 | multi-method. | ||
| 48 | |||
| 49 | 2003-01-27 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 50 | |||
| 51 | * net/tramp.el (tramp-file-name-for-operation): Apply | ||
| 52 | `expand-file-name' for relative file names only. Otherwise there | ||
| 53 | might be problems if the default directory is another Tramp | ||
| 54 | directory as the directory the file is based on. | ||
| 55 | (tramp-find-foreign-file-name-handler): Check whether FILENAME is | ||
| 56 | a Tramp file name. It isn't if it comes from an expanded file | ||
| 57 | name (like "/xx:yy//zz"). | ||
| 58 | |||
| 59 | 2003-01-25 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 60 | |||
| 61 | * net/tramp.el (tramp-devices): New variable. Keeps virtual | ||
| 62 | device numbers. Devices must distinguish physical file systems. | ||
| 63 | The device numbers provided by "lstat" aren't unique, because we | ||
| 64 | operate on different hosts. So we use virtual device numbers, | ||
| 65 | generated by `tramp-get-device'. Both Ange-FTP and EFS use device | ||
| 66 | number -1. In order to be different, we use device number (-1 x), | ||
| 67 | whereby "x" is unique for a given (multi-method method user host). | ||
| 68 | Suggested by Kai. | ||
| 69 | (tramp-perl-file-attributes): Always return device number -1. | ||
| 70 | There will be a virtual device number set in | ||
| 71 | `tramp-handle-file-attributes', which replaces this one. | ||
| 72 | (tramp-handle-file-attributes): Set virtual device number. | ||
| 73 | (tramp-get-device): New function. Returns the virtual device | ||
| 74 | number. If it doesn't exist, generate a new one. | ||
| 75 | (tramp-handle-file-regular-p): Use Emacs file name primitives | ||
| 76 | instead of calling tramp-handle-* equivalents directly. Needed | ||
| 77 | for tramp-smb. | ||
| 78 | |||
| 79 | * net/tramp-smb.el (tramp-smb-devices, tramp-smb-get-device): Removed. | ||
| 80 | Functionality moved to tramp.el. | ||
| 81 | (tramp-smb-handle-file-attributes): Apply | ||
| 82 | `tramp-get-device'. ATIME and CTIME are (0 0) now (= "don't | ||
| 83 | know"), which is more honest. | ||
| 84 | (tramp-smb-handle-make-directory): Use Emacs file name primitives | ||
| 85 | instead of calling tramp-smb-handle-* equivalents directly. | ||
| 86 | (tramp-smb-read-file-entry): Return size as a number but a string. | ||
| 87 | |||
| 88 | 2003-01-24 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 89 | |||
| 90 | * net/tramp.el (tramp-completion-function-alist-ssh): Add parsing | ||
| 91 | of "/etc/ssh_config" and "~/.ssh/config". Suggested by Kai. | ||
| 92 | (tramp-completion-function-alist, tramp-set-completion-function): | ||
| 93 | Doc string update. | ||
| 94 | (tramp-parse-sconfig, tramp-parse-sconfig-group): New functions. | ||
| 95 | Provide parsing of "~/.ssh/config" style files. | ||
| 96 | |||
| 97 | 2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 98 | |||
| 99 | * net/tramp.el (tramp-completion-handle-expand-file-name): Apply | ||
| 100 | `tramp-drop-volume-letter'. Otherwise, there are problems on W32 | ||
| 101 | systems. | ||
| 102 | |||
| 103 | 2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 104 | |||
| 105 | * net/tramp-smb.el (tramp-smb-get-device, tramp-smb-get-inode): New | ||
| 106 | functions. Device number and inode number don't exist for SMB | ||
| 107 | files. Therefore we must generate virtual ones. | ||
| 108 | (tramp-smb-devices, tramp-smb-inodes): New variables. Keep | ||
| 109 | generated virtual device numbers and inodes numbers for SMB files. | ||
| 110 | (tramp-smb-handle-file-attributes): Apply them. | ||
| 111 | |||
| 112 | 2003-01-14 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> | ||
| 113 | |||
| 114 | * net/tramp.el (tramp-md5-function): Require md5 before checking | ||
| 115 | function md5. If using md5-encode, put wrapper around it that | ||
| 116 | converts vector of bytes to ascii text. | ||
| 117 | |||
| 118 | 2003-01-13 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 119 | |||
| 120 | * net/tramp.el (tramp-completion-mode): Perform check (integerp | ||
| 121 | last-input-event) before (event-modifiers last-input-event) - | ||
| 122 | there might be problems if `last-input-event' is a mouse event. | ||
| 123 | |||
| 124 | 2003-01-12 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 125 | |||
| 126 | * net/tramp.el (tramp-parse-rhosts, tramp-parse-shosts) | ||
| 127 | (tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc): Use | ||
| 128 | `file-readable-p' instead of `file-exists-p'. Otherwise these | ||
| 129 | functions might block. Reported by <kin@neoscale.com>. | ||
| 130 | |||
| 131 | 2003-01-02 Michael Albinus <Michael.Albinus@alcatel.de> | ||
| 132 | |||
| 133 | * net/tramp-ftp.el (top-level): Defaults for | ||
| 134 | `tramp-default-method-alist' must be a list. | ||
| 135 | |||
| 136 | * net/tramp-smb.el (top-level): Defaults for | ||
| 137 | `tramp-default-method-alist' must be a list. | ||
| 138 | |||
| 139 | 2003-01-02 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> | ||
| 140 | |||
| 141 | * net/tramp.el (top-level): Avoid byte-compiler warnings of unused | ||
| 142 | variables if the byte-compiler supports this. This is for the | ||
| 143 | with-parsed-tramp-file-name macro which is wont to produce such | ||
| 144 | stuff. | ||
| 145 | |||
| 1 | 2003-02-04 Richard M. Stallman <rms@gnu.org> | 146 | 2003-02-04 Richard M. Stallman <rms@gnu.org> |
| 2 | 147 | ||
| 3 | * term.el (term-raw-map): Set it up at load time. | 148 | * term.el (term-raw-map): Set it up at load time. |
| @@ -5864,7 +6009,7 @@ | |||
| 5864 | 6009 | ||
| 5865 | 2002-08-21 Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> | 6010 | 2002-08-21 Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> |
| 5866 | 6011 | ||
| 5867 | * tramp.el: Version 2.0.13 released. | 6012 | * net/tramp.el: Version 2.0.13 released. |
| 5868 | (tramp-handle-write-region): Don't check to see if remote end is | 6013 | (tramp-handle-write-region): Don't check to see if remote end is |
| 5869 | awake after sending data to remote host: we want to send "EOF" not | 6014 | awake after sending data to remote host: we want to send "EOF" not |
| 5870 | "echo are you awake"... | 6015 | "echo are you awake"... |
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 88c395ab381..04f8bbeb323 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP and EFS -*- coding: iso-8859-1; -*- | 1 | ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP and EFS -*- coding: iso-8859-1; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Albinus <Michael.Albinus@alcatel.de> | 5 | ;; Author: Michael Albinus <Michael.Albinus@alcatel.de> |
| 6 | ;; Keywords: comm, processes | 6 | ;; Keywords: comm, processes |
| @@ -25,7 +25,7 @@ | |||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; Convenience functions for calling Ange-FTP (and maybe EFS, later on) | 27 | ;; Convenience functions for calling Ange-FTP (and maybe EFS, later on) |
| 28 | ;; from Tramp. Most of them are displaced from tramp.el | 28 | ;; from Tramp. Most of them are displaced from tramp.el. |
| 29 | 29 | ||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| @@ -64,6 +64,7 @@ present for backward compatibility." | |||
| 64 | (setq file-name-handler-alist | 64 | (setq file-name-handler-alist |
| 65 | (delete a1 (delete a2 file-name-handler-alist))))) | 65 | (delete a1 (delete a2 file-name-handler-alist))))) |
| 66 | (tramp-disable-ange-ftp) | 66 | (tramp-disable-ange-ftp) |
| 67 | (eval-after-load "ange-ftp" '(tramp-disable-ange-ftp)) | ||
| 67 | 68 | ||
| 68 | ;; Define FTP method ... | 69 | ;; Define FTP method ... |
| 69 | (defcustom tramp-ftp-method "ftp" | 70 | (defcustom tramp-ftp-method "ftp" |
| @@ -76,9 +77,9 @@ present for backward compatibility." | |||
| 76 | 77 | ||
| 77 | ;; Add some defaults for `tramp-default-method-alist' | 78 | ;; Add some defaults for `tramp-default-method-alist' |
| 78 | (add-to-list 'tramp-default-method-alist | 79 | (add-to-list 'tramp-default-method-alist |
| 79 | '("\\`ftp\\." "" tramp-ftp-method)) | 80 | (list "\\`ftp\\." "" tramp-ftp-method)) |
| 80 | (add-to-list 'tramp-default-method-alist | 81 | (add-to-list 'tramp-default-method-alist |
| 81 | '("" "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)) | 82 | (list "" "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)) |
| 82 | 83 | ||
| 83 | ;; Add completion function for FTP method. | 84 | ;; Add completion function for FTP method. |
| 84 | (unless (memq system-type '(windows-nt)) | 85 | (unless (memq system-type '(windows-nt)) |
| @@ -92,8 +93,7 @@ First arg specifies the OPERATION, second arg is a list of arguments to | |||
| 92 | pass to the OPERATION." | 93 | pass to the OPERATION." |
| 93 | (save-match-data | 94 | (save-match-data |
| 94 | (or (boundp 'ange-ftp-name-format) | 95 | (or (boundp 'ange-ftp-name-format) |
| 95 | (and (require 'ange-ftp) | 96 | (require 'ange-ftp)) |
| 96 | (tramp-disable-ange-ftp))) | ||
| 97 | (let* ((ange-ftp-name-format | 97 | (let* ((ange-ftp-name-format |
| 98 | (list (nth 0 tramp-file-name-structure) | 98 | (list (nth 0 tramp-file-name-structure) |
| 99 | (nth 3 tramp-file-name-structure) | 99 | (nth 3 tramp-file-name-structure) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index eebd84a2673..0df9ddf668a 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; tramp-smb.el --- Tramp access functions for SMB servers -*- coding: iso-8859-1; -*- | 1 | ;;; tramp-smb.el --- Tramp access functions for SMB servers -*- coding: iso-8859-1; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Albinus <Michael.Albinus@alcatel.de> | 5 | ;; Author: Michael Albinus <Michael.Albinus@alcatel.de> |
| 6 | ;; Keywords: comm, processes | 6 | ;; Keywords: comm, processes |
| @@ -50,7 +50,7 @@ | |||
| 50 | ;; Add a default for `tramp-default-method-alist'. Rule: If there is | 50 | ;; Add a default for `tramp-default-method-alist'. Rule: If there is |
| 51 | ;; a domain in USER, it must be the SMB method. | 51 | ;; a domain in USER, it must be the SMB method. |
| 52 | (add-to-list 'tramp-default-method-alist | 52 | (add-to-list 'tramp-default-method-alist |
| 53 | '("%" "" tramp-smb-method)) | 53 | (list "%" "" tramp-smb-method)) |
| 54 | 54 | ||
| 55 | ;; Add completion function for SMB method. | 55 | ;; Add completion function for SMB method. |
| 56 | (tramp-set-completion-function | 56 | (tramp-set-completion-function |
| @@ -108,6 +108,9 @@ Will be changed by corresponding `process-sentinel'. | |||
| 108 | This variable is local to each buffer.") | 108 | This variable is local to each buffer.") |
| 109 | (make-variable-buffer-local 'tramp-smb-process-running) | 109 | (make-variable-buffer-local 'tramp-smb-process-running) |
| 110 | 110 | ||
| 111 | (defvar tramp-smb-inodes nil | ||
| 112 | "Keeps virtual inodes numbers for SMB files.") | ||
| 113 | |||
| 111 | ;; New handlers should be added here. | 114 | ;; New handlers should be added here. |
| 112 | (defconst tramp-smb-file-name-handler-alist | 115 | (defconst tramp-smb-file-name-handler-alist |
| 113 | '( | 116 | '( |
| @@ -118,7 +121,7 @@ This variable is local to each buffer.") | |||
| 118 | (delete-directory . tramp-smb-handle-delete-directory) | 121 | (delete-directory . tramp-smb-handle-delete-directory) |
| 119 | (delete-file . tramp-smb-handle-delete-file) | 122 | (delete-file . tramp-smb-handle-delete-file) |
| 120 | ;; `diff-latest-backup-file' performed by default handler | 123 | ;; `diff-latest-backup-file' performed by default handler |
| 121 | ;; `directory-file-name' performed by default handler | 124 | (directory-file-name . tramp-handle-directory-file-name) |
| 122 | (directory-files . tramp-smb-handle-directory-files) | 125 | (directory-files . tramp-smb-handle-directory-files) |
| 123 | (directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes) | 126 | (directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes) |
| 124 | (dired-call-process . tramp-smb-not-handled) | 127 | (dired-call-process . tramp-smb-not-handled) |
| @@ -342,7 +345,10 @@ rather than as numbers." | |||
| 342 | (file (tramp-smb-get-path path nil)) | 345 | (file (tramp-smb-get-path path nil)) |
| 343 | (entries (tramp-smb-get-file-entries user host share file)) | 346 | (entries (tramp-smb-get-file-entries user host share file)) |
| 344 | (entry (and entries | 347 | (entry (and entries |
| 345 | (assoc (file-name-nondirectory file) entries)))) | 348 | (assoc (file-name-nondirectory file) entries))) |
| 349 | (inode (tramp-smb-get-inode share file)) | ||
| 350 | (device (tramp-get-device nil tramp-smb-method user host))) | ||
| 351 | |||
| 346 | ; check result | 352 | ; check result |
| 347 | (when entry | 353 | (when entry |
| 348 | (list (and (string-match "d" (nth 1 entry)) | 354 | (list (and (string-match "d" (nth 1 entry)) |
| @@ -350,14 +356,14 @@ rather than as numbers." | |||
| 350 | -1 ;1 link count | 356 | -1 ;1 link count |
| 351 | -1 ;2 uid | 357 | -1 ;2 uid |
| 352 | -1 ;3 gid | 358 | -1 ;3 gid |
| 353 | (nth 3 entry) ;4 atime | 359 | '(0 0) ;4 atime |
| 354 | (nth 3 entry) ;5 mtime | 360 | (nth 3 entry) ;5 mtime |
| 355 | (nth 3 entry) ;6 ctime | 361 | '(0 0) ;6 ctime |
| 356 | (nth 2 entry) ;7 size | 362 | (nth 2 entry) ;7 size |
| 357 | (nth 1 entry) ;8 mode | 363 | (nth 1 entry) ;8 mode |
| 358 | nil ;9 gid weird | 364 | nil ;9 gid weird |
| 359 | -1 ;10 inode number | 365 | inode ;10 inode number |
| 360 | -1)))))) ;11 file system number | 366 | device)))))) ;11 file system number |
| 361 | 367 | ||
| 362 | (defun tramp-smb-handle-file-directory-p (filename) | 368 | (defun tramp-smb-handle-file-directory-p (filename) |
| 363 | "Like `file-directory-p' for tramp files." | 369 | "Like `file-directory-p' for tramp files." |
| @@ -532,7 +538,7 @@ WILDCARD and FULL-DIRECTORY-P are not handled." | |||
| 532 | (make-directory ldir parents)) | 538 | (make-directory ldir parents)) |
| 533 | ;; Just do it | 539 | ;; Just do it |
| 534 | (when (file-directory-p ldir) | 540 | (when (file-directory-p ldir) |
| 535 | (tramp-smb-handle-make-directory-internal dir)) | 541 | (make-directory-internal dir)) |
| 536 | (unless (file-directory-p dir) | 542 | (unless (file-directory-p dir) |
| 537 | (error "Couldn't make directory %s" dir)))))) | 543 | (error "Couldn't make directory %s" dir)))))) |
| 538 | 544 | ||
| @@ -822,8 +828,10 @@ Result is the list (PATH MODE SIZE MTIME)." | |||
| 822 | 828 | ||
| 823 | ;; size | 829 | ;; size |
| 824 | (if (string-match "\\([0-9]+\\)$" line) | 830 | (if (string-match "\\([0-9]+\\)$" line) |
| 825 | (setq size (match-string 1 line) | 831 | (setq |
| 826 | line (substring line 0 (- (max 8 (1+ (length size)))))) | 832 | size (string-to-number (match-string 1 line)) |
| 833 | line (substring | ||
| 834 | line 0 (- (max 8 (1+ (length (match-string 1 line))))))) | ||
| 827 | (return)) | 835 | (return)) |
| 828 | 836 | ||
| 829 | ;; mode | 837 | ;; mode |
| @@ -854,6 +862,20 @@ Result is the list (PATH MODE SIZE MTIME)." | |||
| 854 | '(0 0))) | 862 | '(0 0))) |
| 855 | (list path mode size mtime)))) | 863 | (list path mode size mtime)))) |
| 856 | 864 | ||
| 865 | ;; Inodes don't exist for SMB files. Therefore we must generate virtual ones. | ||
| 866 | ;; Used in `find-buffer-visiting'. | ||
| 867 | ;; The method applied might be not so efficient (Ange-FTP uses hashes). But | ||
| 868 | ;; performance isn't the major issue given that file transfer will take time. | ||
| 869 | |||
| 870 | (defun tramp-smb-get-inode (share file) | ||
| 871 | "Returns the virtual inode number. | ||
| 872 | If it doesn't exist, generate a new one." | ||
| 873 | (let ((string (concat share "/" (directory-file-name file)))) | ||
| 874 | (unless (assoc string tramp-smb-inodes) | ||
| 875 | (add-to-list 'tramp-smb-inodes | ||
| 876 | (list string (length tramp-smb-inodes)))) | ||
| 877 | (nth 1 (assoc string tramp-smb-inodes)))) | ||
| 878 | |||
| 857 | 879 | ||
| 858 | ;; Connection functions | 880 | ;; Connection functions |
| 859 | 881 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 1efc50f0d6b..b402dd673bd 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- | 1 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE | 5 | ;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE |
| 6 | ;; Keywords: comm, processes | 6 | ;; Keywords: comm, processes |
| @@ -72,7 +72,7 @@ | |||
| 72 | ;; In the Tramp CVS repository, the version numer is auto-frobbed from | 72 | ;; In the Tramp CVS repository, the version numer is auto-frobbed from |
| 73 | ;; the Makefile, so you should edit the top-level Makefile to change | 73 | ;; the Makefile, so you should edit the top-level Makefile to change |
| 74 | ;; the version number. | 74 | ;; the version number. |
| 75 | (defconst tramp-version "2.0.28" | 75 | (defconst tramp-version "2.0.29" |
| 76 | "This version of tramp.") | 76 | "This version of tramp.") |
| 77 | 77 | ||
| 78 | (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" | 78 | (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" |
| @@ -125,6 +125,12 @@ | |||
| 125 | (unless (boundp 'custom-print-functions) | 125 | (unless (boundp 'custom-print-functions) |
| 126 | (defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4 | 126 | (defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4 |
| 127 | 127 | ||
| 128 | ;; Avoid bytecompiler warnings if the byte-compiler supports this. | ||
| 129 | ;; Currently, XEmacs supports this. | ||
| 130 | (eval-when-compile | ||
| 131 | (when (fboundp 'byte-compiler-options) | ||
| 132 | (byte-compiler-options (warnings (- unused-vars))))) | ||
| 133 | |||
| 128 | ;; XEmacs is distributed with few Lisp packages. Further packages are | 134 | ;; XEmacs is distributed with few Lisp packages. Further packages are |
| 129 | ;; installed using EFS. If we use a unified filename format, then | 135 | ;; installed using EFS. If we use a unified filename format, then |
| 130 | ;; Tramp is required in addition to EFS. (But why can't Tramp just | 136 | ;; Tramp is required in addition to EFS. (But why can't Tramp just |
| @@ -667,12 +673,14 @@ See `tramp-methods' for a list of possibilities for METHOD." | |||
| 667 | ;; Default values for non-Unices seeked | 673 | ;; Default values for non-Unices seeked |
| 668 | (defconst tramp-completion-function-alist-ssh | 674 | (defconst tramp-completion-function-alist-ssh |
| 669 | (unless (memq system-type '(windows-nt)) | 675 | (unless (memq system-type '(windows-nt)) |
| 670 | '((tramp-parse-rhosts "/etc/hosts.equiv") | 676 | '((tramp-parse-rhosts "/etc/hosts.equiv") |
| 671 | (tramp-parse-rhosts "/etc/shosts.equiv") | 677 | (tramp-parse-rhosts "/etc/shosts.equiv") |
| 672 | (tramp-parse-shosts "/etc/ssh_known_hosts") | 678 | (tramp-parse-shosts "/etc/ssh_known_hosts") |
| 673 | (tramp-parse-rhosts "~/.rhosts") | 679 | (tramp-parse-sconfig "/etc/ssh_config") |
| 674 | (tramp-parse-rhosts "~/.shosts") | 680 | (tramp-parse-rhosts "~/.rhosts") |
| 675 | (tramp-parse-shosts "~/.ssh/known_hosts"))) | 681 | (tramp-parse-rhosts "~/.shosts") |
| 682 | (tramp-parse-shosts "~/.ssh/known_hosts") | ||
| 683 | (tramp-parse-sconfig "~/.ssh/config"))) | ||
| 676 | "Default list of (FUNCTION FILE) pairs to be examined for ssh methods." | 684 | "Default list of (FUNCTION FILE) pairs to be examined for ssh methods." |
| 677 | ) | 685 | ) |
| 678 | 686 | ||
| @@ -721,11 +729,12 @@ Each NAME stands for a remote access method. Each PAIR is of the form | |||
| 721 | \(FUNCTION FILE). FUNCTION is responsible to extract user names and host | 729 | \(FUNCTION FILE). FUNCTION is responsible to extract user names and host |
| 722 | names from FILE for completion. The following predefined FUNCTIONs exists: | 730 | names from FILE for completion. The following predefined FUNCTIONs exists: |
| 723 | 731 | ||
| 724 | * `tramp-parse-rhosts' for \".rhosts\" like files, | 732 | * `tramp-parse-rhosts' for \"~/.rhosts\" like files, |
| 725 | * `tramp-parse-shosts' for \"ssh_known_hosts\" like files, | 733 | * `tramp-parse-shosts' for \"~/.ssh/known_hosts\" like files, |
| 726 | * `tramp-parse-hosts' for \"/etc/hosts\" like files, and | 734 | * `tramp-parse-sconfig' for \"~/.ssh/config\" like files, |
| 727 | * `tramp-parse-passwd' for \"/etc/passwd\" like files. | 735 | * `tramp-parse-hosts' for \"/etc/hosts\" like files, and |
| 728 | * `tramp-parse-netrc' for \".netrc\" like files. | 736 | * `tramp-parse-passwd' for \"/etc/passwd\" like files. |
| 737 | * `tramp-parse-netrc' for \"~/.netrc\" like files. | ||
| 729 | 738 | ||
| 730 | FUNCTION can also see a customer defined function. For more details see | 739 | FUNCTION can also see a customer defined function. For more details see |
| 731 | the info pages." | 740 | the info pages." |
| @@ -1250,8 +1259,9 @@ the visited file modtime.") | |||
| 1250 | (make-variable-buffer-local 'tramp-buffer-file-attributes) | 1259 | (make-variable-buffer-local 'tramp-buffer-file-attributes) |
| 1251 | 1260 | ||
| 1252 | (defvar tramp-md5-function | 1261 | (defvar tramp-md5-function |
| 1253 | (cond ((fboundp 'md5) 'md5) | 1262 | (cond ((and (require 'md5) (fboundp 'md5)) 'md5) |
| 1254 | ((and (require 'md5) (fboundp 'md5-encode)) 'md5-encode) | 1263 | ((fboundp 'md5-encode) |
| 1264 | (lambda (x) (base64-encode-string (md5-encode x)))) | ||
| 1255 | (t (error "Coulnd't find an `md5' function"))) | 1265 | (t (error "Coulnd't find an `md5' function"))) |
| 1256 | "Function to call for running the MD5 algorithm.") | 1266 | "Function to call for running the MD5 algorithm.") |
| 1257 | 1267 | ||
| @@ -1396,16 +1406,18 @@ some systems don't, and for them we have this shell function.") | |||
| 1396 | ;; output. If you are hacking on this, note that you get *no* output | 1406 | ;; output. If you are hacking on this, note that you get *no* output |
| 1397 | ;; unless this spits out a complete line, including the '\n' at the | 1407 | ;; unless this spits out a complete line, including the '\n' at the |
| 1398 | ;; end. | 1408 | ;; end. |
| 1409 | ;; The device number is returned as "-1", because there will be a virtual | ||
| 1410 | ;; device number set in `tramp-handle-file-attributes' | ||
| 1399 | (defconst tramp-perl-file-attributes "\ | 1411 | (defconst tramp-perl-file-attributes "\ |
| 1400 | $f = $ARGV[0]; | 1412 | $f = $ARGV[0]; |
| 1401 | @s = lstat($f); | 1413 | @s = lstat($f); |
| 1402 | if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; } | 1414 | if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; } |
| 1403 | elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; } | 1415 | elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; } |
| 1404 | else { $l = \"nil\" }; | 1416 | else { $l = \"nil\" }; |
| 1405 | printf(\"(%s %u %d %d (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) (%u %u))\\n\", | 1417 | printf(\"(%s %u %d %d (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) -1)\\n\", |
| 1406 | $l, $s[3], $s[4], $s[5], $s[8] >> 16 & 0xffff, $s[8] & 0xffff, | 1418 | $l, $s[3], $s[4], $s[5], $s[8] >> 16 & 0xffff, $s[8] & 0xffff, |
| 1407 | $s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff, | 1419 | $s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff, |
| 1408 | $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0] & 0xffff);" | 1420 | $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff);" |
| 1409 | "Perl script to produce output suitable for use with `file-attributes' | 1421 | "Perl script to produce output suitable for use with `file-attributes' |
| 1410 | on the remote file system.") | 1422 | on the remote file system.") |
| 1411 | 1423 | ||
| @@ -1726,13 +1738,15 @@ FUNCTION-LIST is a list of entries of the form (FUNCTION FILE). | |||
| 1726 | The FUNCTION is intended to parse FILE according its syntax. | 1738 | The FUNCTION is intended to parse FILE according its syntax. |
| 1727 | It might be a predefined FUNCTION, or a user defined FUNCTION. | 1739 | It might be a predefined FUNCTION, or a user defined FUNCTION. |
| 1728 | Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts', | 1740 | Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts', |
| 1729 | `tramp-parse-hosts', and `tramp-parse-passwd'. | 1741 | `tramp-parse-sconfig',`tramp-parse-hosts', `tramp-parse-passwd', |
| 1742 | and `tramp-parse-netrc'. | ||
| 1743 | |||
| 1730 | Example: | 1744 | Example: |
| 1731 | 1745 | ||
| 1732 | (tramp-set-completion-function | 1746 | (tramp-set-completion-function |
| 1733 | \"ssh\" | 1747 | \"ssh\" |
| 1734 | '((tramp-parse-shosts \"/etc/ssh_known_hosts\") | 1748 | '((tramp-parse-sconfig \"/etc/ssh_config\") |
| 1735 | (tramp-parse-shosts \"~/.ssh/known_hosts\")))" | 1749 | (tramp-parse-sconfig \"~/.ssh/config\")))" |
| 1736 | 1750 | ||
| 1737 | (let ((v (cdr (assoc method tramp-completion-function-alist)))) | 1751 | (let ((v (cdr (assoc method tramp-completion-function-alist)))) |
| 1738 | (if v (setcdr v function-list) | 1752 | (if v (setcdr v function-list) |
| @@ -1944,6 +1958,14 @@ target of the symlink differ." | |||
| 1944 | (tramp-get-file-exists-command multi-method method user host) | 1958 | (tramp-get-file-exists-command multi-method method user host) |
| 1945 | (tramp-shell-quote-argument path))))))) | 1959 | (tramp-shell-quote-argument path))))))) |
| 1946 | 1960 | ||
| 1961 | ;; Devices must distinguish physical file systems. The device numbers | ||
| 1962 | ;; provided by "lstat" aren't unique, because we operate on different hosts. | ||
| 1963 | ;; So we use virtual device numbers, generated by Tramp. Both Ange-FTP and | ||
| 1964 | ;; EFS use device number "-1". In order to be different, we use device number | ||
| 1965 | ;; (-1 x), whereby "x" is unique for a given (multi-method method user host). | ||
| 1966 | (defvar tramp-devices nil | ||
| 1967 | "Keeps virtual device numbers.") | ||
| 1968 | |||
| 1947 | ;; CCC: This should check for an error condition and signal failure | 1969 | ;; CCC: This should check for an error condition and signal failure |
| 1948 | ;; when something goes wrong. | 1970 | ;; when something goes wrong. |
| 1949 | ;; Daniel Pittman <daniel@danann.net> | 1971 | ;; Daniel Pittman <daniel@danann.net> |
| @@ -1962,10 +1984,12 @@ rather than as numbers." | |||
| 1962 | multi-method method user host path nonnumeric)) | 1984 | multi-method method user host path nonnumeric)) |
| 1963 | (setq result | 1985 | (setq result |
| 1964 | (tramp-handle-file-attributes-with-ls | 1986 | (tramp-handle-file-attributes-with-ls |
| 1965 | multi-method method user host path nonnumeric)))))) | 1987 | multi-method method user host path nonnumeric))) |
| 1988 | ;; set virtual device number | ||
| 1989 | (setcar (nthcdr 11 result) | ||
| 1990 | (tramp-get-device multi-method method user host))))) | ||
| 1966 | result)) | 1991 | result)) |
| 1967 | 1992 | ||
| 1968 | |||
| 1969 | (defun tramp-handle-file-attributes-with-ls | 1993 | (defun tramp-handle-file-attributes-with-ls |
| 1970 | (multi-method method user host path &optional nonnumeric) | 1994 | (multi-method method user host path &optional nonnumeric) |
| 1971 | "Implement `file-attributes' for tramp files using the ls(1) command." | 1995 | "Implement `file-attributes' for tramp files using the ls(1) command." |
| @@ -2047,8 +2071,8 @@ rather than as numbers." | |||
| 2047 | nil ;hm? | 2071 | nil ;hm? |
| 2048 | ;; 10. inode number. | 2072 | ;; 10. inode number. |
| 2049 | res-inode | 2073 | res-inode |
| 2050 | ;; 11. Device number. | 2074 | ;; 11. Device number. Will be replaced by a virtual device number. |
| 2051 | -1 ;hm? | 2075 | -1 |
| 2052 | ))) | 2076 | ))) |
| 2053 | 2077 | ||
| 2054 | (defun tramp-handle-file-attributes-with-perl | 2078 | (defun tramp-handle-file-attributes-with-perl |
| @@ -2071,6 +2095,15 @@ is initially created and is kept cached by the remote shell." | |||
| 2071 | (tramp-file-mode-from-int (nth 8 result))) | 2095 | (tramp-file-mode-from-int (nth 8 result))) |
| 2072 | result)) | 2096 | result)) |
| 2073 | 2097 | ||
| 2098 | (defun tramp-get-device (multi-method method user host) | ||
| 2099 | "Returns the virtual device number. | ||
| 2100 | If it doesn't exist, generate a new one." | ||
| 2101 | (let ((string (tramp-make-tramp-file-name multi-method method user host ""))) | ||
| 2102 | (unless (assoc string tramp-devices) | ||
| 2103 | (add-to-list 'tramp-devices | ||
| 2104 | (list string (length tramp-devices)))) | ||
| 2105 | (list -1 (nth 1 (assoc string tramp-devices))))) | ||
| 2106 | |||
| 2074 | (defun tramp-handle-set-visited-file-modtime (&optional time-list) | 2107 | (defun tramp-handle-set-visited-file-modtime (&optional time-list) |
| 2075 | "Like `set-visited-file-modtime' for tramp files." | 2108 | "Like `set-visited-file-modtime' for tramp files." |
| 2076 | (unless (buffer-file-name) | 2109 | (unless (buffer-file-name) |
| @@ -2261,8 +2294,8 @@ if the remote host can't provide the modtime." | |||
| 2261 | (defun tramp-handle-file-regular-p (filename) | 2294 | (defun tramp-handle-file-regular-p (filename) |
| 2262 | "Like `file-regular-p' for tramp files." | 2295 | "Like `file-regular-p' for tramp files." |
| 2263 | (with-parsed-tramp-file-name filename nil | 2296 | (with-parsed-tramp-file-name filename nil |
| 2264 | (and (tramp-handle-file-exists-p filename) | 2297 | (and (file-exists-p filename) |
| 2265 | (eq ?- (aref (nth 8 (tramp-handle-file-attributes filename)) 0))))) | 2298 | (eq ?- (aref (nth 8 (file-attributes filename)) 0))))) |
| 2266 | 2299 | ||
| 2267 | (defun tramp-handle-file-symlink-p (filename) | 2300 | (defun tramp-handle-file-symlink-p (filename) |
| 2268 | "Like `file-symlink-p' for tramp files." | 2301 | "Like `file-symlink-p' for tramp files." |
| @@ -2299,17 +2332,30 @@ if the remote host can't provide the modtime." | |||
| 2299 | ;; (substring directory 0 (- (length directory) 1)) | 2332 | ;; (substring directory 0 (- (length directory) 1)) |
| 2300 | ;; directory)) | 2333 | ;; directory)) |
| 2301 | 2334 | ||
| 2302 | ;; Philippe Troin <phil@fifi.org> | 2335 | ;; ;; Philippe Troin <phil@fifi.org> |
| 2336 | ;; (defun tramp-handle-directory-file-name (directory) | ||
| 2337 | ;; "Like `directory-file-name' for tramp files." | ||
| 2338 | ;; (with-parsed-tramp-file-name directory nil | ||
| 2339 | ;; (let ((directory-length-1 (1- (length directory)))) | ||
| 2340 | ;; (save-match-data | ||
| 2341 | ;; (if (and (eq (aref directory directory-length-1) ?/) | ||
| 2342 | ;; (eq (string-match tramp-file-name-regexp directory) 0) | ||
| 2343 | ;; (/= (match-end 0) directory-length-1)) | ||
| 2344 | ;; (substring directory 0 directory-length-1) | ||
| 2345 | ;; directory))))) | ||
| 2346 | |||
| 2303 | (defun tramp-handle-directory-file-name (directory) | 2347 | (defun tramp-handle-directory-file-name (directory) |
| 2304 | "Like `directory-file-name' for tramp files." | 2348 | "Like `directory-file-name' for tramp files." |
| 2349 | ;; If path component of filename is "/", leave it unchanged. | ||
| 2350 | ;; Otherwise, remove any trailing slash from path component. | ||
| 2351 | ;; Method, host, etc, are unchanged. Does it make sense to try | ||
| 2352 | ;; to avoid parsing the filename? | ||
| 2305 | (with-parsed-tramp-file-name directory nil | 2353 | (with-parsed-tramp-file-name directory nil |
| 2306 | (let ((directory-length-1 (1- (length directory)))) | 2354 | (if (and (not (zerop (length path))) |
| 2307 | (save-match-data | 2355 | (eq (aref path (1- (length path))) ?/) |
| 2308 | (if (and (eq (aref directory directory-length-1) ?/) | 2356 | (not (string= path "/"))) |
| 2309 | (eq (string-match tramp-file-name-regexp directory) 0) | 2357 | (substring directory 0 -1) |
| 2310 | (/= (match-end 0) directory-length-1)) | 2358 | directory))) |
| 2311 | (substring directory 0 directory-length-1) | ||
| 2312 | directory))))) | ||
| 2313 | 2359 | ||
| 2314 | ;; Directory listings. | 2360 | ;; Directory listings. |
| 2315 | 2361 | ||
| @@ -3345,7 +3391,9 @@ ARGS are the arguments OPERATION has been called with." | |||
| 3345 | 'dired-shell-unhandle-file-name 'dired-uucode-file | 3391 | 'dired-shell-unhandle-file-name 'dired-uucode-file |
| 3346 | 'insert-file-contents-literally 'recover-file | 3392 | 'insert-file-contents-literally 'recover-file |
| 3347 | 'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail)) | 3393 | 'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail)) |
| 3348 | (expand-file-name (nth 0 args))) | 3394 | (if (file-name-absolute-p (nth 0 args)) |
| 3395 | (nth 0 args) | ||
| 3396 | (expand-file-name (nth 0 args)))) | ||
| 3349 | ; FILE DIRECTORY resp FILE1 FILE2 | 3397 | ; FILE DIRECTORY resp FILE1 FILE2 |
| 3350 | ((member operation | 3398 | ((member operation |
| 3351 | (list 'add-name-to-file 'copy-file 'expand-file-name | 3399 | (list 'add-name-to-file 'copy-file 'expand-file-name |
| @@ -3380,11 +3428,12 @@ ARGS are the arguments OPERATION has been called with." | |||
| 3380 | 3428 | ||
| 3381 | (defun tramp-find-foreign-file-name-handler (filename) | 3429 | (defun tramp-find-foreign-file-name-handler (filename) |
| 3382 | "Return foreign file name handler if exists." | 3430 | "Return foreign file name handler if exists." |
| 3383 | (let (elt res) | 3431 | (when (tramp-tramp-file-p filename) |
| 3384 | (dolist (elt tramp-foreign-file-name-handler-alist res) | 3432 | (let (elt res) |
| 3385 | (when (funcall (car elt) filename) | 3433 | (dolist (elt tramp-foreign-file-name-handler-alist res) |
| 3386 | (setq res (cdr elt)))) | 3434 | (when (funcall (car elt) filename) |
| 3387 | res)) | 3435 | (setq res (cdr elt)))) |
| 3436 | res))) | ||
| 3388 | 3437 | ||
| 3389 | ;; Main function. | 3438 | ;; Main function. |
| 3390 | ;;;###autoload | 3439 | ;;;###autoload |
| @@ -3523,8 +3572,8 @@ necessary anymore." | |||
| 3523 | file) | 3572 | file) |
| 3524 | (member (match-string 1 file) (mapcar 'car tramp-methods))) | 3573 | (member (match-string 1 file) (mapcar 'car tramp-methods))) |
| 3525 | ((or (equal last-input-event 'tab) | 3574 | ((or (equal last-input-event 'tab) |
| 3526 | (and (not (event-modifiers last-input-event)) | 3575 | (and (integerp last-input-event) |
| 3527 | (integerp last-input-event) | 3576 | (not (event-modifiers last-input-event)) |
| 3528 | (or (char-equal last-input-event ?\?) | 3577 | (or (char-equal last-input-event ?\?) |
| 3529 | (char-equal last-input-event ?\t) ; handled by 'tab already? | 3578 | (char-equal last-input-event ?\t) ; handled by 'tab already? |
| 3530 | (char-equal last-input-event ?\ )))) | 3579 | (char-equal last-input-event ?\ )))) |
| @@ -3578,6 +3627,7 @@ necessary anymore." | |||
| 3578 | (host (tramp-file-name-host car)) | 3627 | (host (tramp-file-name-host car)) |
| 3579 | (path (tramp-file-name-path car)) | 3628 | (path (tramp-file-name-path car)) |
| 3580 | (m (tramp-find-method multi-method method user host)) | 3629 | (m (tramp-find-method multi-method method user host)) |
| 3630 | (tramp-current-user user) ; see `tramp-parse-passwd' | ||
| 3581 | all-user-hosts) | 3631 | all-user-hosts) |
| 3582 | 3632 | ||
| 3583 | (unless (or multi-method ;; Not handled (yet). | 3633 | (unless (or multi-method ;; Not handled (yet). |
| @@ -3785,7 +3835,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." | |||
| 3785 | Either user or host may be nil." | 3835 | Either user or host may be nil." |
| 3786 | 3836 | ||
| 3787 | (let (res) | 3837 | (let (res) |
| 3788 | (when (file-exists-p filename) | 3838 | (when (file-readable-p filename) |
| 3789 | (with-temp-buffer | 3839 | (with-temp-buffer |
| 3790 | (insert-file-contents filename) | 3840 | (insert-file-contents filename) |
| 3791 | (goto-char (point-min)) | 3841 | (goto-char (point-min)) |
| @@ -3822,7 +3872,7 @@ Either user or host may be nil." | |||
| 3822 | User is always nil." | 3872 | User is always nil." |
| 3823 | 3873 | ||
| 3824 | (let (res) | 3874 | (let (res) |
| 3825 | (when (file-exists-p filename) | 3875 | (when (file-readable-p filename) |
| 3826 | (with-temp-buffer | 3876 | (with-temp-buffer |
| 3827 | (insert-file-contents filename) | 3877 | (insert-file-contents filename) |
| 3828 | (goto-char (point-min)) | 3878 | (goto-char (point-min)) |
| @@ -3846,12 +3896,41 @@ User is always nil." | |||
| 3846 | (forward-line 1)) | 3896 | (forward-line 1)) |
| 3847 | result)) | 3897 | result)) |
| 3848 | 3898 | ||
| 3899 | (defun tramp-parse-sconfig (filename) | ||
| 3900 | "Return a list of (user host) tuples allowed to access. | ||
| 3901 | User is always nil." | ||
| 3902 | |||
| 3903 | (let (res) | ||
| 3904 | (when (file-readable-p filename) | ||
| 3905 | (with-temp-buffer | ||
| 3906 | (insert-file-contents filename) | ||
| 3907 | (goto-char (point-min)) | ||
| 3908 | (while (not (eobp)) | ||
| 3909 | (push (tramp-parse-sconfig-group) res)))) | ||
| 3910 | res)) | ||
| 3911 | |||
| 3912 | (defun tramp-parse-sconfig-group () | ||
| 3913 | "Return a (user host) tuple allowed to access. | ||
| 3914 | User is always nil." | ||
| 3915 | |||
| 3916 | (let ((result) | ||
| 3917 | (regexp (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)"))) | ||
| 3918 | |||
| 3919 | (narrow-to-region (point) (tramp-point-at-eol)) | ||
| 3920 | (when (re-search-forward regexp nil t) | ||
| 3921 | (setq result (list nil (match-string 1)))) | ||
| 3922 | (widen) | ||
| 3923 | (or | ||
| 3924 | (> (skip-chars-forward ",") 0) | ||
| 3925 | (forward-line 1)) | ||
| 3926 | result)) | ||
| 3927 | |||
| 3849 | (defun tramp-parse-hosts (filename) | 3928 | (defun tramp-parse-hosts (filename) |
| 3850 | "Return a list of (user host) tuples allowed to access. | 3929 | "Return a list of (user host) tuples allowed to access. |
| 3851 | User is always nil." | 3930 | User is always nil." |
| 3852 | 3931 | ||
| 3853 | (let (res) | 3932 | (let (res) |
| 3854 | (when (file-exists-p filename) | 3933 | (when (file-readable-p filename) |
| 3855 | (with-temp-buffer | 3934 | (with-temp-buffer |
| 3856 | (insert-file-contents filename) | 3935 | (insert-file-contents filename) |
| 3857 | (goto-char (point-min)) | 3936 | (goto-char (point-min)) |
| @@ -3876,14 +3955,18 @@ User is always nil." | |||
| 3876 | (forward-line 1)) | 3955 | (forward-line 1)) |
| 3877 | result)) | 3956 | result)) |
| 3878 | 3957 | ||
| 3958 | ;; For su-alike methods it would be desirable to return "root@localhost" | ||
| 3959 | ;; as default. Unfortunately, we have no information whether any user name | ||
| 3960 | ;; has been typed already. So we (mis-)use tramp-current-user as indication, | ||
| 3961 | ;; assuming it is set in `tramp-completion-handle-file-name-all-completions'. | ||
| 3879 | (defun tramp-parse-passwd (filename) | 3962 | (defun tramp-parse-passwd (filename) |
| 3880 | "Return a list of (user host) tuples allowed to access. | 3963 | "Return a list of (user host) tuples allowed to access. |
| 3881 | Host is always \"localhost\"." | 3964 | Host is always \"localhost\"." |
| 3882 | 3965 | ||
| 3883 | (let (res) | 3966 | (let (res) |
| 3884 | (if (and (symbolp 'user) (zerop (length user))) | 3967 | (if (zerop (length tramp-current-user)) |
| 3885 | '(("root" nil)) | 3968 | '(("root" nil)) |
| 3886 | (when (file-exists-p filename) | 3969 | (when (file-readable-p filename) |
| 3887 | (with-temp-buffer | 3970 | (with-temp-buffer |
| 3888 | (insert-file-contents filename) | 3971 | (insert-file-contents filename) |
| 3889 | (goto-char (point-min)) | 3972 | (goto-char (point-min)) |
| @@ -3910,7 +3993,7 @@ Host is always \"localhost\"." | |||
| 3910 | User may be nil." | 3993 | User may be nil." |
| 3911 | 3994 | ||
| 3912 | (let (res) | 3995 | (let (res) |
| 3913 | (when (file-exists-p filename) | 3996 | (when (file-readable-p filename) |
| 3914 | (with-temp-buffer | 3997 | (with-temp-buffer |
| 3915 | (insert-file-contents filename) | 3998 | (insert-file-contents filename) |
| 3916 | (goto-char (point-min)) | 3999 | (goto-char (point-min)) |
| @@ -3938,11 +4021,12 @@ User may be nil." | |||
| 3938 | (defun tramp-completion-handle-expand-file-name (name &optional dir) | 4021 | (defun tramp-completion-handle-expand-file-name (name &optional dir) |
| 3939 | "Like `expand-file-name' for tramp files." | 4022 | "Like `expand-file-name' for tramp files." |
| 3940 | (let ((fullname (concat (or dir default-directory) name))) | 4023 | (let ((fullname (concat (or dir default-directory) name))) |
| 3941 | (if (tramp-completion-mode fullname) | 4024 | (tramp-drop-volume-letter |
| 3942 | (tramp-run-real-handler | 4025 | (if (tramp-completion-mode fullname) |
| 3943 | 'expand-file-name (list name dir)) | 4026 | (tramp-run-real-handler |
| 3944 | (tramp-completion-run-real-handler | 4027 | 'expand-file-name (list name dir)) |
| 3945 | 'expand-file-name (list name dir))))) | 4028 | (tramp-completion-run-real-handler |
| 4029 | 'expand-file-name (list name dir)))))) | ||
| 3946 | 4030 | ||
| 3947 | ;;; Internal Functions: | 4031 | ;;; Internal Functions: |
| 3948 | 4032 | ||
| @@ -5518,8 +5602,13 @@ FMT and ARGS which are passed to `error'." | |||
| 5518 | (pop-to-buffer (current-buffer)) | 5602 | (pop-to-buffer (current-buffer)) |
| 5519 | (funcall 'signal signal (apply 'format fmt args)))) | 5603 | (funcall 'signal signal (apply 'format fmt args)))) |
| 5520 | 5604 | ||
| 5521 | ;; Chunked sending kluge. | 5605 | ;; Chunked sending kluge. We set this to 500 just to be on the |
| 5522 | (defvar tramp-chunksize nil | 5606 | ;; safe side; some ssh connections appear to drop bytes when data |
| 5607 | ;; is sent too quickly. | ||
| 5608 | ;; This happens when using `ssh' method using GNU Emacs 20.7.1 | ||
| 5609 | ;; (hppa1.1-hp-hpux10.20, Motif). (The connection is made to | ||
| 5610 | ;; localhost.) | ||
| 5611 | (defvar tramp-chunksize 500 | ||
| 5523 | "If non-nil, chunksize for sending things to remote host.") | 5612 | "If non-nil, chunksize for sending things to remote host.") |
| 5524 | 5613 | ||
| 5525 | (defun tramp-send-region (multi-method method user host start end) | 5614 | (defun tramp-send-region (multi-method method user host start end) |
| @@ -5529,7 +5618,7 @@ running as USER on HOST using METHOD." | |||
| 5529 | (tramp-get-buffer multi-method method user host)))) | 5618 | (tramp-get-buffer multi-method method user host)))) |
| 5530 | (unless proc | 5619 | (unless proc |
| 5531 | (error "Can't send region to remote host -- not logged in")) | 5620 | (error "Can't send region to remote host -- not logged in")) |
| 5532 | (if tramp-chunksize | 5621 | (if (and tramp-chunksize (not (zerop tramp-chunksize))) |
| 5533 | (let ((pos start)) | 5622 | (let ((pos start)) |
| 5534 | (while (< pos end) | 5623 | (while (< pos end) |
| 5535 | (tramp-message-for-buffer | 5624 | (tramp-message-for-buffer |
| @@ -6439,7 +6528,7 @@ report. | |||
| 6439 | ;; how to suppress. Maybe not an essential problem. | 6528 | ;; how to suppress. Maybe not an essential problem. |
| 6440 | ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'. | 6529 | ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'. |
| 6441 | ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. | 6530 | ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
| 6442 | ;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'. | 6531 | ;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'. |
| 6443 | ;; Code is nearly identical. | 6532 | ;; Code is nearly identical. |
| 6444 | ;; ** Decide whiche files to take for searching user/host names depending on | 6533 | ;; ** Decide whiche files to take for searching user/host names depending on |
| 6445 | ;; operating system (windows-nt) in `tramp-completion-function-alist'. | 6534 | ;; operating system (windows-nt) in `tramp-completion-function-alist'. |