Commit 7432277c authored by Kai Großjohann's avatar Kai Großjohann
Browse files

Version 2.0.30 released.

Replace term "path" with "localname" unless it is used for a
search path.
(tramp-handle-expand-file-name): Allow ".." to cross host
boundaries.
(tramp-open-connection-setup-interactive-shell): Unset $ENV in
addition to setting $PS1 when starting the Bourne-ish shell.  Some
sh implementations (eg, bash when called as sh) read the file
named there on startup, which could clobber $PS1.
(tramp-do-copy-or-rename-file-one-local): New function.  Not
implemented.  Not used.  Should invoke rcp or scp directly to keep
the time.
parent d2e7d633
2003-02-28 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de>
* lisp/net/tramp.el: Version 2.0.30 released.
Replace term "path" with "localname" unless it is used for a
search path.
(tramp-handle-expand-file-name): Allow ".." to cross host
boundaries.
(tramp-open-connection-setup-interactive-shell): Unset $ENV in
addition to setting $PS1 when starting the Bourne-ish shell. Some
sh implementations (eg, bash when called as sh) read the file
named there on startup, which could clobber $PS1.
(tramp-do-copy-or-rename-file-one-local): New function. Not
implemented. Not used. Should invoke rcp or scp directly to keep
the time.
2003-02-28 Michael Albinus <Michael.Albinus@alcatel.de>
* tramp-smb.el: Replace term `path' with `localname' unless it is
used for a search path. In GNU, the word `path' is reserved for
search paths. * tramp.el (tramp-send-string, tramp-send-region):
Removed.
(tramp-send-string): New function. Takes over the role of the
functions above, in order to have a unique place handling
`tramp-chunksize'. Same implementation as `tramp-send-region'.
(tramp-chunksize): It's now a defcustom. Set to 500 on systems
only known to have a buggy `process-send-string' implementation.
First black-listed constellation is GNU Emacs/ hpux.
(tramp-send-region): Correct debug message.
(tramp-bug): Add `tramp-chunksize'.
2003-02-26 Matt Swift <swift@alum.mit.edu>
* startup.el: Streamline code in several functions for efficiency
......
......@@ -225,12 +225,12 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
(error "copy-file: file %s already exists" newname))
; (with-parsed-tramp-file-name newname nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name newname l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path t)))
(let ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname t)))
(unless share
(error "Target `%s' must contain a share name" filename))
(tramp-smb-maybe-open-connection user host share)
......@@ -250,13 +250,13 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
(unless (file-exists-p directory)
(error "Cannot delete non-existing directory `%s'" directory))
; (with-parsed-tramp-file-name directory nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name directory l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let ((share (tramp-smb-get-share path))
(dir (tramp-smb-get-path (file-name-directory path) t))
(file (file-name-nondirectory path)))
(let ((share (tramp-smb-get-share localname))
(dir (tramp-smb-get-localname (file-name-directory localname) t))
(file (file-name-nondirectory localname)))
(tramp-smb-maybe-open-connection user host share)
(if (and
(tramp-smb-send-command user host (format "cd \"%s\"" dir))
......@@ -273,13 +273,13 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
(unless (file-exists-p filename)
(error "Cannot delete non-existing file `%s'" filename))
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let ((share (tramp-smb-get-share path))
(dir (tramp-smb-get-path (file-name-directory path) t))
(file (file-name-nondirectory path)))
(let ((share (tramp-smb-get-share localname))
(dir (tramp-smb-get-localname (file-name-directory localname) t))
(file (file-name-nondirectory localname)))
(unless (file-exists-p filename)
(error "Cannot delete non-existing file `%s'" filename))
(tramp-smb-maybe-open-connection user host share)
......@@ -297,12 +297,12 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
"Like `directory-files' for tramp files."
(setq directory (directory-file-name (expand-file-name directory)))
; (with-parsed-tramp-file-name directory nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name directory l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file)))
;; Just the file names are needed
(setq entries (mapcar 'car entries))
......@@ -312,7 +312,7 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
(delete nil
(mapcar (lambda (x) (when (string-match match x) x))
entries))))
;; Make absolute paths if necessary
;; Make absolute localnames if necessary
(when full
(setq entries
(mapcar (lambda (x)
......@@ -331,18 +331,18 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
(cons x (file-attributes
(if full x (concat (file-name-as-directory directory) x)))))
(directory-files directory full match nosort)))
(defun tramp-smb-handle-file-attributes (filename &optional nonnumeric)
"Like `file-attributes' for tramp files.
Optional argument NONNUMERIC means return user and group name
rather than as numbers."
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file))
(entry (and entries
(assoc (file-name-nondirectory file) entries)))
......@@ -368,12 +368,12 @@ rather than as numbers."
(defun tramp-smb-handle-file-directory-p (filename)
"Like `file-directory-p' for tramp files."
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file))
(entry (and entries
(assoc (file-name-nondirectory file) entries))))
......@@ -384,12 +384,12 @@ rather than as numbers."
(defun tramp-smb-handle-file-exists-p (filename)
"Like `file-exists-p' for tramp files."
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file)))
(and entries
(member (file-name-nondirectory file) (mapcar 'car entries))
......@@ -399,8 +399,8 @@ rather than as numbers."
"Like `file-local-copy' for tramp files."
(with-parsed-tramp-file-name filename nil
(save-excursion
(let ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path t))
(let ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname t))
(tmpfil (tramp-make-temp-file)))
(unless (file-exists-p filename)
(error "Cannot make local copy of non-existing file `%s'" filename))
......@@ -421,13 +421,13 @@ rather than as numbers."
(defun tramp-smb-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for tramp files."
; (with-parsed-tramp-file-name directory nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name directory l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-match-data
(save-excursion
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file)))
(all-completions
......@@ -451,12 +451,12 @@ rather than as numbers."
(defun tramp-smb-handle-file-writable-p (filename)
"Like `file-writable-p' for tramp files."
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file))
(entry (and entries
(assoc (file-name-nondirectory file) entries))))
......@@ -474,16 +474,16 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
;; this function is called with a non-directory ...
(setq filename (file-name-as-directory filename)))
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-match-data
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil))
(entries (tramp-smb-get-file-entries user host share file)))
;; Delete dummy "" entry, useless entries
(setq entries
(setq entries
(if (file-directory-p filename)
(delq (assoc "" entries) entries)
;; We just need the only and only entry FILENAME.
......@@ -527,11 +527,11 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
(unless (file-name-absolute-p dir)
(setq dir (concat default-directory dir)))
; (with-parsed-tramp-file-name dir nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name dir l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-match-data
(let* ((share (tramp-smb-get-share path))
(let* ((share (tramp-smb-get-share localname))
(ldir (file-name-directory dir)))
;; Make missing directory parts
(when (and parents share (not (file-directory-p ldir)))
......@@ -548,12 +548,12 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
(unless (file-name-absolute-p directory)
(setq ldir (concat default-directory directory)))
; (with-parsed-tramp-file-name directory nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name directory l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-match-data
(let* ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path nil)))
(let* ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname nil)))
(when (file-directory-p (file-name-directory directory))
(tramp-smb-maybe-open-connection user host share)
(tramp-smb-send-command user host (format "mkdir \"%s\"" file)))
......@@ -581,12 +581,12 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
(error "rename-file: file %s already exists" newname))
; (with-parsed-tramp-file-name newname nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name newname l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path t)))
(let ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname t)))
(tramp-smb-maybe-open-connection user host share)
(tramp-message-for-buffer
nil tramp-smb-method user host
......@@ -613,12 +613,12 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
filename))
(error "File not overwritten")))
; (with-parsed-tramp-file-name filename nil
(let (user host path)
(let (user host localname)
(with-parsed-tramp-file-name filename l
(setq user l-user host l-host path l-path))
(setq user l-user host l-host localname l-localname))
(save-excursion
(let ((share (tramp-smb-get-share path))
(file (tramp-smb-get-path path t))
(let ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname t))
(curbuf (current-buffer))
;; We use this to save the value of `last-coding-system-used'
;; after writing the tmp file. At the end of the function,
......@@ -666,17 +666,17 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
;; Internal file name functions
(defun tramp-smb-get-share (path)
"Returns the share name of PATH."
(defun tramp-smb-get-share (localname)
"Returns the share name of LOCALNAME."
(save-match-data
(when (string-match "^/?\\([^/]+\\)/" path)
(match-string 1 path))))
(when (string-match "^/?\\([^/]+\\)/" localname)
(match-string 1 localname))))
(defun tramp-smb-get-path (path convert)
"Returns the file name of PATH.
(defun tramp-smb-get-localname (localname convert)
"Returns the file name of LOCALNAME.
If CONVERT is non-nil exchange \"/\" by \"\\\\\"."
(save-match-data
(let ((res path))
(let ((res localname))
(setq
res (if (string-match "^/?[^/]+/\\(.*\\)" res)
......@@ -697,16 +697,16 @@ If CONVERT is non-nil exchange \"/\" by \"\\\\\"."
;; Share names of a host are cached. It is very unlikely that the
;; shares do change during connection.
(defun tramp-smb-get-file-entries (user host share path)
"Read entries which match PATH.
(defun tramp-smb-get-file-entries (user host share localname)
"Read entries which match LOCALNAME.
Either the shares are listed, or the `dir' command is executed.
Only entries matching the path are returned.
Result is a list of (PATH MODE SIZE MONTH DAY TIME YEAR)."
Only entries matching the localname are returned.
Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
(save-excursion
(save-match-data
(let ((base (or (and (> (length path) 0)
(string-match "\\([^/]+\\)$" path)
(regexp-quote (match-string 1 path)))
(let ((base (or (and (> (length localname) 0)
(string-match "\\([^/]+\\)$" localname)
(regexp-quote (match-string 1 localname)))
""))
res entry)
(set-buffer (tramp-get-buffer nil tramp-smb-method user host))
......@@ -719,7 +719,7 @@ Result is a list of (PATH MODE SIZE MONTH DAY TIME YEAR)."
(tramp-smb-send-command
user host
(format "dir %s"
(if (zerop (length path)) "" (concat "\"" path "*\"")))))
(if (zerop (length localname)) "" (concat "\"" localname "*\"")))))
(goto-char (point-min))
;; Loop the listing
(unless (re-search-forward tramp-smb-errors nil t)
......@@ -780,15 +780,15 @@ Result is a list of (PATH MODE SIZE MONTH DAY TIME YEAR)."
(defun tramp-smb-read-file-entry (share)
"Parse entry in SMB output buffer.
If SHARE is result, entries are of type dir. Otherwise, shares are listed.
Result is the list (PATH MODE SIZE MTIME)."
Result is the list (LOCALNAME MODE SIZE MTIME)."
(let ((line (buffer-substring (point) (tramp-point-at-eol)))
path mode size month day hour min sec year mtime)
localname mode size month day hour min sec year mtime)
(if (not share)
; Read share entries
(when (string-match "^\\s-+\\(\\S-+\\)\\s-+Disk" line)
(setq path (match-string 1 line)
(setq localname (match-string 1 line)
mode "dr-xr-xr-x"
size 0))
......@@ -847,12 +847,12 @@ Result is the list (PATH MODE SIZE MTIME)."
line (substring line 0 (- (1+ (length (match-string 2 line))))))
(return))
;; path
;; localname
(if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-+$" line)
(setq path (match-string 1 line))
(setq localname (match-string 1 line))
(return))))
(when (and path mode size)
(when (and localname mode size)
(setq mtime
(if (and sec min hour day month year)
(encode-time
......@@ -860,7 +860,7 @@ Result is the list (PATH MODE SIZE MTIME)."
(cdr (assoc (downcase month) tramp-smb-parse-time-months))
year)
'(0 0)))
(list path mode size mtime))))
(list localname mode size mtime))))
;; Inodes don't exist for SMB files. Therefore we must generate virtual ones.
;; Used in `find-buffer-visiting'.
......
......@@ -43,7 +43,7 @@
;; This used to blow away the file-name-handler-alist and reinstall
;; TRAMP into it. This was intended to let VC work remotely. It didn't,
;; at least not in my XEmacs 21.2 install.
;;
;;
;; In any case, tramp-run-real-handler now deals correctly with disabling
;; the things that should be, making this a no-op.
;;
......@@ -82,13 +82,13 @@ See `vc-do-command' for more information."
(method (tramp-file-name-method v))
(user (tramp-file-name-user v))
(host (tramp-file-name-host v))
(path (tramp-file-name-path v)))
(localname (tramp-file-name-localname v)))
(set-buffer (get-buffer-create buffer))
(set (make-local-variable 'vc-parent-buffer) camefrom)
(set (make-local-variable 'vc-parent-buffer-name)
(concat " from " (buffer-name camefrom)))
(setq default-directory olddir)
(erase-buffer)
(mapcar
......@@ -99,7 +99,7 @@ See `vc-do-command' for more information."
(setq vc-file (vc-name file)))
(setq squeezed
(append squeezed
(list (tramp-file-name-path
(list (tramp-file-name-localname
(tramp-dissect-file-name vc-file))))))
(if (and file (eq last 'WORKFILE))
(progn
......@@ -172,7 +172,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(method (when file (tramp-file-name-method v)))
(user (when file (tramp-file-name-user v)))
(host (when file (tramp-file-name-host v)))
(path (when file (tramp-file-name-path v))))
(localname (when file (tramp-file-name-localname v))))
(setq squeezed (delq nil (copy-sequence flags)))
(when file
(setq squeezed (append squeezed (list (file-relative-name
......@@ -194,7 +194,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(message "Running %s...OK" command))
(vc-exec-after
`(run-hook-with-args
'vc-post-command-functions ',command ',path ',flags))
'vc-post-command-functions ',command ',localname ',flags))
status))))
......@@ -216,7 +216,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(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
(apply 'tramp-vc-do-command-new buffer okstatus command
file ;(or file (buffer-file-name))
flags))
ad-do-it)))
......@@ -229,7 +229,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(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
(apply 'tramp-vc-do-command buffer okstatus command
(or file (buffer-file-name)) last flags))
ad-do-it))))
;;-)
......@@ -251,7 +251,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(method (tramp-file-name-method v))
(user (tramp-file-name-user v))
(host (tramp-file-name-host v))
(path (tramp-file-name-path v)))
(localname (tramp-file-name-localname v)))
(save-excursion (set-buffer (get-buffer-create "*vc-info*"))
(erase-buffer))
(let ((exec-path (append vc-path exec-path)) exec-status
......@@ -275,7 +275,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
;; Actually execute remote command
(tramp-handle-shell-command
(mapconcat 'tramp-shell-quote-argument
(append (list command) args (list path)) " ")
(append (list command) args (list localname)) " ")
(get-buffer-create"*vc-info*"))
;(tramp-wait-for-output)
;; Get status from command
......@@ -283,7 +283,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(tramp-wait-for-output)
(setq exec-status (read (current-buffer)))
(message "Command %s returned status %d." command exec-status)))
;; Maybe okstatus can be `async' here. But then, maybe the
;; async thing is new in Emacs 21, but this function is only
;; used in Emacs 20.
......@@ -304,7 +304,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(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-simple-command okstatus command
(apply 'tramp-vc-simple-command okstatus command
(or file (buffer-file-name)) args))
ad-do-it)))
......@@ -362,17 +362,17 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
;; Do we need to advise the vc-user-login-name function anyway?
;; This will return the correct login name for the owner of a
;; This will return the correct login name for the owner of a
;; file. It does not deal with the default remote user name...
;;
;; That is, when vc calls (vc-user-login-name), we return the
;; That is, when vc calls (vc-user-login-name), we return the
;; local login name, something that may be different to the remote
;; default.
;; default.
;;
;; The remote VC operations will occur as the user that we logged
;; in with however - not always the same as the local user.
;;
;; In the end, I did advise the function. This is because, well,
;; In the end, I did advise the function. This is because, well,
;; the thing didn't work right otherwise ;)
;;
;; Daniel Pittman <daniel@danann.net>
......@@ -417,11 +417,11 @@ filename we are thinking about..."
(tramp-handle-vc-user-login-name uid)))) ; get the owner name
ad-do-it))) ; else call the original
;; Determine the name of the user owning a file.
(defun tramp-file-owner (filename)
"Return who owns FILE (user name, as a string)."
(let ((v (tramp-dissect-file-name
(let ((v (tramp-dissect-file-name
(tramp-handle-expand-file-name filename))))
(if (not (tramp-handle-file-exists-p filename))
nil ; file cannot be opened
......@@ -435,7 +435,7 @@ filename we are thinking about..."
(tramp-file-name-method v)
(tramp-file-name-user v)
(tramp-file-name-host v))
(tramp-shell-quote-argument (tramp-file-name-path v))))
(tramp-shell-quote-argument (tramp-file-name-localname v))))
(tramp-wait-for-output)
;; parse `ls -l' output ...
;; ... file mode flags
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment