annotate lisp/net/tramp-smb.el @ 107831:92451fdcc718

Remove C_SWITCH_SYSTEM_TEMACS. * s/darwin.h (C_SWITCH_SYSTEM_TEMACS): Remove. (malloc, realloc, free): Use emacs, not temacs for conditional definition. * Makefile.in (C_SWITCH_SYSTEM_TEMACS): Remove. (ALL_CFLAGS): Do not use C_SWITCH_SYSTEM_TEMACS.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 11 Apr 2010 14:43:28 -0700
parents 2e763e444bc2
children 93125d6fab29 5a6b4fafaa52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
1 ;;; tramp-smb.el --- Tramp access functions for SMB servers
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2
100857
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105897
diff changeset
4 ;; 2009, 2010 Free Software Foundation, Inc.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
6 ;; Author: Michael Albinus <michael.albinus@gmx.de>
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7 ;; Keywords: comm, processes
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
10
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
15
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
19 ;; GNU General Public License for more details.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
20
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
23
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
24 ;;; Commentary:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
25
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
26 ;; Access functions for SMB servers like SAMBA or M$ Windows from Tramp.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
27
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
28 ;;; Code:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
29
96186
c66f10196d81 Require 'cl when compiling.
Glenn Morris <rgm@gnu.org>
parents: 94677
diff changeset
30 (eval-when-compile (require 'cl)) ; block, return
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
31 (require 'tramp)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
32 (require 'tramp-cache)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
33 (require 'tramp-compat)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
34
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
35 ;; Define SMB method ...
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
36 (defcustom tramp-smb-method "smb"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
37 "*Method to connect SAMBA and M$ SMB servers."
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
38 :group 'tramp
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
39 :type 'string)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
40
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
41 ;; ... and add it to the method list.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
42 (add-to-list 'tramp-methods (cons tramp-smb-method nil))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
43
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
44 ;; Add a default for `tramp-default-method-alist'. Rule: If there is
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
45 ;; a domain in USER, it must be the SMB method.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
46 (add-to-list 'tramp-default-method-alist
100857
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
47 `(nil ,tramp-prefix-domain-regexp ,tramp-smb-method))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
48
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
49 ;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
50 ;; the anonymous user is chosen.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
51 (add-to-list 'tramp-default-user-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
52 `(,tramp-smb-method nil ""))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
53
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
54 ;; Add completion function for SMB method.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
55 (tramp-set-completion-function
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
56 tramp-smb-method
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
57 '((tramp-parse-netrc "~/.netrc")))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
58
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
59 (defcustom tramp-smb-program "smbclient"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
60 "*Name of SMB client to run."
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
61 :group 'tramp
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
62 :type 'string)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
63
106959
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
64 (defcustom tramp-smb-conf "/dev/null"
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
65 "*Path of the smb.conf file.
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
66 If it is nil, no smb.conf will be added to the `tramp-smb-program'
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
67 call, letting the SMB client use the default one."
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
68 :group 'tramp
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
69 :type '(choice (const nil) (file :must-match t)))
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
70
105634
75fb0870b7e0 * net/tramp-smb.el (tramp-smb-version): New defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 105616
diff changeset
71 (defvar tramp-smb-version nil
75fb0870b7e0 * net/tramp-smb.el (tramp-smb-version): New defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 105616
diff changeset
72 "*Version string of the SMB client.")
75fb0870b7e0 * net/tramp-smb.el (tramp-smb-version): New defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 105616
diff changeset
73
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
74 (defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
75 "Regexp used as prompt in smbclient.")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
76
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
77 (defconst tramp-smb-errors
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
78 ;; `regexp-opt' not possible because of first string.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
79 (mapconcat
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
80 'identity
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
81 '(;; Connection error / timeout / unknown command.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
82 "Connection to \\S-+ failed"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
83 "Read from server failed, maybe it closed the connection"
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
84 "Call timed out: server did not respond"
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
85 "\\S-+: command not found"
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
86 "Server doesn't support UNIX CIFS calls"
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
87 ;; Samba.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
88 "ERRDOS"
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
89 "ERRHRD"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
90 "ERRSRV"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
91 "ERRbadfile"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
92 "ERRbadpw"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
93 "ERRfilexists"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
94 "ERRnoaccess"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
95 "ERRnomem"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
96 "ERRnosuchshare"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
97 ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
98 ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003).
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
99 "NT_STATUS_ACCESS_DENIED"
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
100 "NT_STATUS_ACCOUNT_LOCKED_OUT"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
101 "NT_STATUS_BAD_NETWORK_NAME"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
102 "NT_STATUS_CANNOT_DELETE"
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
103 "NT_STATUS_CONNECTION_REFUSED"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
104 "NT_STATUS_DIRECTORY_NOT_EMPTY"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
105 "NT_STATUS_DUPLICATE_NAME"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
106 "NT_STATUS_FILE_IS_A_DIRECTORY"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
107 "NT_STATUS_LOGON_FAILURE"
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
108 "NT_STATUS_NETWORK_ACCESS_DENIED"
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
109 "NT_STATUS_NOT_IMPLEMENTED"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
110 "NT_STATUS_NO_SUCH_FILE"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
111 "NT_STATUS_OBJECT_NAME_COLLISION"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
112 "NT_STATUS_OBJECT_NAME_INVALID"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
113 "NT_STATUS_OBJECT_NAME_NOT_FOUND"
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
114 "NT_STATUS_SHARING_VIOLATION"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
115 "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE"
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
116 "NT_STATUS_WRONG_PASSWORD")
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
117 "\\|")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
118 "Regexp for possible error strings of SMB servers.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
119 Used instead of analyzing error codes of commands.")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
120
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
121 (defconst tramp-smb-actions-with-share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
122 '((tramp-smb-prompt tramp-action-succeed)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
123 (tramp-password-prompt-regexp tramp-action-password)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
124 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
125 (tramp-smb-errors tramp-action-permission-denied)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
126 (tramp-process-alive-regexp tramp-action-process-alive))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
127 "List of pattern/action pairs.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
128 This list is used for login to SMB servers.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
129
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
130 See `tramp-actions-before-shell' for more info.")
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
131
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
132 (defconst tramp-smb-actions-without-share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
133 '((tramp-password-prompt-regexp tramp-action-password)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
134 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
135 (tramp-smb-errors tramp-action-permission-denied)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
136 (tramp-process-alive-regexp tramp-action-out-of-band))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
137 "List of pattern/action pairs.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
138 This list is used for login to SMB servers.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
139
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
140 See `tramp-actions-before-shell' for more info.")
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
141
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
142 ;; New handlers should be added here.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
143 (defconst tramp-smb-file-name-handler-alist
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
144 '(
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
145 ;; `access-file' performed by default handler.
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
146 (add-name-to-file . tramp-smb-handle-add-name-to-file)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
147 ;; `byte-compiler-base-file-name' performed by default handler.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
148 (copy-directory . tramp-smb-handle-copy-directory)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
149 (copy-file . tramp-smb-handle-copy-file)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
150 (delete-directory . tramp-smb-handle-delete-directory)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
151 (delete-file . tramp-smb-handle-delete-file)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
152 ;; `diff-latest-backup-file' performed by default handler.
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
153 (directory-file-name . tramp-handle-directory-file-name)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
154 (directory-files . tramp-smb-handle-directory-files)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
155 (directory-files-and-attributes
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
156 . tramp-smb-handle-directory-files-and-attributes)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
157 (dired-call-process . ignore)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
158 (dired-compress-file . ignore)
103531
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
159 (dired-uncache . tramp-handle-dired-uncache)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
160 (expand-file-name . tramp-smb-handle-expand-file-name)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
161 (file-accessible-directory-p . tramp-smb-handle-file-directory-p)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
162 (file-attributes . tramp-smb-handle-file-attributes)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
163 (file-directory-p . tramp-smb-handle-file-directory-p)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
164 (file-executable-p . tramp-smb-handle-file-exists-p)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
165 (file-exists-p . tramp-smb-handle-file-exists-p)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
166 (file-local-copy . tramp-smb-handle-file-local-copy)
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
167 (file-remote-p . tramp-handle-file-remote-p)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
168 (file-modes . tramp-handle-file-modes)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
169 (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
99617
0ba4a2790571 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 97037
diff changeset
170 (file-name-as-directory . tramp-handle-file-name-as-directory)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
171 (file-name-completion . tramp-handle-file-name-completion)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
172 (file-name-directory . tramp-handle-file-name-directory)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
173 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
174 ;; `file-name-sans-versions' performed by default handler.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
175 (file-newer-than-file-p . tramp-smb-handle-file-newer-than-file-p)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
176 (file-ownership-preserved-p . ignore)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
177 (file-readable-p . tramp-smb-handle-file-exists-p)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
178 (file-regular-p . tramp-handle-file-regular-p)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
179 (file-symlink-p . tramp-handle-file-symlink-p)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
180 ;; `file-truename' performed by default handler.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
181 (file-writable-p . tramp-smb-handle-file-writable-p)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
182 (find-backup-file-name . tramp-handle-find-backup-file-name)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
183 ;; `find-file-noselect' performed by default handler.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
184 ;; `get-file-buffer' performed by default handler.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
185 (insert-directory . tramp-smb-handle-insert-directory)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
186 (insert-file-contents . tramp-handle-insert-file-contents)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
187 (load . tramp-handle-load)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
188 (make-directory . tramp-smb-handle-make-directory)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
189 (make-directory-internal . tramp-smb-handle-make-directory-internal)
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
190 (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
191 (rename-file . tramp-smb-handle-rename-file)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
192 (set-file-modes . tramp-smb-handle-set-file-modes)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
193 (set-file-times . ignore)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
194 (set-visited-file-modtime . ignore)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
195 (shell-command . ignore)
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
196 (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
197 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
198 (vc-registered . ignore)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
199 (verify-visited-file-modtime . ignore)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
200 (write-region . tramp-smb-handle-write-region)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
201 )
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
202 "Alist of handler functions for Tramp SMB method.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
203 Operations not mentioned here will be handled by the default Emacs primitives.")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
204
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
205 (defun tramp-smb-file-name-p (filename)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
206 "Check if it's a filename for SMB servers."
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
207 (let ((v (tramp-dissect-file-name filename)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
208 (string= (tramp-file-name-method v) tramp-smb-method)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
209
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
210 (defun tramp-smb-file-name-handler (operation &rest args)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
211 "Invoke the SMB related OPERATION.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
212 First arg specifies the OPERATION, second arg is a list of arguments to
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
213 pass to the OPERATION."
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
214 (let ((fn (assoc operation tramp-smb-file-name-handler-alist)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
215 (if fn
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
216 (save-match-data (apply (cdr fn) args))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
217 (tramp-run-real-handler operation args))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
218
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
219 (add-to-list 'tramp-foreign-file-name-handler-alist
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
220 (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
221
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
222
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
223 ;; File name primitives.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
224
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
225 (defun tramp-smb-handle-add-name-to-file
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
226 (filename newname &optional ok-if-already-exists)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
227 "Like `add-name-to-file' for Tramp files."
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
228 (unless (tramp-equal-remote filename newname)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
229 (with-parsed-tramp-file-name
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
230 (if (tramp-tramp-file-p filename) filename newname) nil
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
231 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
232 v 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
233 "add-name-to-file: %s"
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
234 "only implemented for same method, same user, same host")))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
235 (with-parsed-tramp-file-name filename v1
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
236 (with-parsed-tramp-file-name newname v2
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
237 (when (file-directory-p filename)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
238 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
239 v2 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
240 "add-name-to-file: %s must not be a directory" filename))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
241 (when (and (not ok-if-already-exists)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
242 (file-exists-p newname)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
243 (not (numberp ok-if-already-exists))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
244 (y-or-n-p
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
245 (format
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
246 "File %s already exists; make it a new name anyway? "
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
247 newname)))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
248 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
249 v2 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
250 "add-name-to-file: file %s already exists" newname))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
251 ;; We must also flush the cache of the directory, because
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
252 ;; `file-attributes' reads the values from there.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
253 (tramp-flush-file-property v2 (file-name-directory v2-localname))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
254 (tramp-flush-file-property v2 v2-localname)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
255 (unless
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
256 (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
257 v1
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
258 (format
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
259 "%s \"%s\" \"%s\""
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
260 (if (tramp-smb-get-cifs-capabilities v1) "link" "hardlink")
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
261 (tramp-smb-get-localname v1)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
262 (tramp-smb-get-localname v2)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
263 (tramp-error
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
264 v2 'file-error
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
265 "error with add-name-to-file, see buffer `%s' for details"
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
266 (buffer-name))))))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
267
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
268 (defun tramp-smb-handle-copy-directory
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
269 (dirname newname &optional keep-date parents)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
270 "Like `copy-directory' for Tramp files. KEEP-DATE is not handled."
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
271 (setq dirname (expand-file-name dirname)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
272 newname (expand-file-name newname))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
273 (let ((t1 (tramp-tramp-file-p dirname))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
274 (t2 (tramp-tramp-file-p newname)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
275 (with-parsed-tramp-file-name (if t1 dirname newname) nil
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
276 (cond
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
277 ;; We must use a local temporary directory.
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
278 ((and t1 t2)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
279 (let ((tmpdir
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
280 (make-temp-name
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
281 (expand-file-name
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
282 tramp-temp-name-prefix
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
283 (tramp-compat-temporary-file-directory)))))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
284 (unwind-protect
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
285 (progn
105897
d8ba90718d44 * net/tramp-smb.el (tramp-smb-handle-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents: 105690
diff changeset
286 (tramp-compat-copy-directory dirname tmpdir keep-date parents)
d8ba90718d44 * net/tramp-smb.el (tramp-smb-handle-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents: 105690
diff changeset
287 (tramp-compat-copy-directory tmpdir newname keep-date parents))
d8ba90718d44 * net/tramp-smb.el (tramp-smb-handle-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents: 105690
diff changeset
288 (tramp-compat-delete-directory tmpdir 'recursive))))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
289
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
290 ;; We can copy recursively.
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
291 ((or t1 t2)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
292 (let ((prompt (tramp-smb-send-command v "prompt"))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
293 (recurse (tramp-smb-send-command v "recurse")))
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
294 (unless (file-directory-p newname)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
295 (make-directory newname parents))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
296 (unwind-protect
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
297 (unless
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
298 (and
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
299 prompt recurse
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
300 (tramp-smb-send-command
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
301 v (format "cd \"%s\"" (tramp-smb-get-localname v)))
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
302 (tramp-smb-send-command
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
303 v (format "lcd \"%s\"" (if t1 newname dirname)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
304 (if t1
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
305 (tramp-smb-send-command v "mget *")
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
306 (tramp-smb-send-command v "mput *")))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
307 ;; Error.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
308 (with-current-buffer (tramp-get-connection-buffer v)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
309 (goto-char (point-min))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
310 (search-forward-regexp tramp-smb-errors nil t)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
311 (tramp-error
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
312 v 'file-error
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
313 "%s `%s'" (match-string 0) (if t1 dirname newname))))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
314 ;; Go home.
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
315 (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
316 v (format
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
317 "cd %s" (if (tramp-smb-get-cifs-capabilities v) "/" "\\")))
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
318 ;; Toggle prompt and recurse OFF.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
319 (if prompt (tramp-smb-send-command v "prompt"))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
320 (if recurse (tramp-smb-send-command v "recurse")))))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
321
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
322 ;; We must do it file-wise.
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
323 (t
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
324 (tramp-run-real-handler
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
325 'copy-directory (list dirname newname keep-date parents)))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
326
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
327 (defun tramp-smb-handle-copy-file
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
328 (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
329 "Like `copy-file' for Tramp files.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
330 KEEP-DATE is not handled in case NEWNAME resides on an SMB server.
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
331 PRESERVE-UID-GID is completely ignored."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
332 (setq filename (expand-file-name filename)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
333 newname (expand-file-name newname))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
334
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
335 (let ((tmpfile (file-local-copy filename)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
336
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
337 (if tmpfile
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
338 ;; Remote filename.
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
339 (condition-case err
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
340 (rename-file tmpfile newname ok-if-already-exists)
100931
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
341 ((error quit)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
342 (delete-file tmpfile)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
343 (signal (car err) (cdr err))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
344
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
345 ;; Remote newname.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
346 (when (file-directory-p newname)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
347 (setq newname (expand-file-name
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
348 (file-name-nondirectory filename) newname)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
349
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
350 (with-parsed-tramp-file-name newname nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
351 (when (and (not ok-if-already-exists)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
352 (file-exists-p newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
353 (tramp-error v 'file-already-exists newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
354
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
355 ;; We must also flush the cache of the directory, because
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
356 ;; `file-attributes' reads the values from there.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
357 (tramp-flush-file-property v (file-name-directory localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
358 (tramp-flush-file-property v localname)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
359 (unless (tramp-smb-get-share v)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
360 (tramp-error
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
361 v 'file-error "Target `%s' must contain a share name" newname))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
362 (tramp-message v 0 "Copying file %s to file %s..." filename newname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
363 (if (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
364 v (format "put \"%s\" \"%s\""
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
365 filename (tramp-smb-get-localname v)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
366 (tramp-message
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
367 v 0 "Copying file %s to file %s...done" filename newname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
368 (tramp-error v 'file-error "Cannot copy `%s'" filename)))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
369
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
370 ;; KEEP-DATE handling.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
371 (when keep-date (set-file-times newname (nth 5 (file-attributes filename)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
372
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
373 (defun tramp-smb-handle-delete-directory (directory &optional recursive)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
374 "Like `delete-directory' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
375 (setq directory (directory-file-name (expand-file-name directory)))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
376 (when (file-exists-p directory)
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
377 (if recursive
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
378 (mapc
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
379 (lambda (file)
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
380 (if (file-directory-p file)
105897
d8ba90718d44 * net/tramp-smb.el (tramp-smb-handle-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents: 105690
diff changeset
381 (tramp-compat-delete-directory file recursive)
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
382 (delete-file file)))
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
383 ;; We do not want to delete "." and "..".
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
384 (directory-files
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
385 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
386
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
387 (with-parsed-tramp-file-name directory nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
388 ;; We must also flush the cache of the directory, because
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
389 ;; `file-attributes' reads the values from there.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
390 (tramp-flush-file-property v (file-name-directory localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
391 (tramp-flush-directory-property v localname)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
392 (unless (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
393 v (format
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
394 "%s \"%s\""
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
395 (if (tramp-smb-get-cifs-capabilities v) "posix_rmdir" "rmdir")
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
396 (tramp-smb-get-localname v)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
397 ;; Error.
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
398 (with-current-buffer (tramp-get-connection-buffer v)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
399 (goto-char (point-min))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
400 (search-forward-regexp tramp-smb-errors nil t)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
401 (tramp-error
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
402 v 'file-error "%s `%s'" (match-string 0) directory))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
403
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
404 (defun tramp-smb-handle-delete-file (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
405 "Like `delete-file' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
406 (setq filename (expand-file-name filename))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
407 (when (file-exists-p filename)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
408 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
409 ;; We must also flush the cache of the directory, because
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
410 ;; `file-attributes' reads the values from there.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
411 (tramp-flush-file-property v (file-name-directory localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
412 (tramp-flush-file-property v localname)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
413 (unless (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
414 v (format
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
415 "%s \"%s\""
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
416 (if (tramp-smb-get-cifs-capabilities v) "posix_unlink" "rm")
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
417 (tramp-smb-get-localname v)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
418 ;; Error.
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
419 (with-current-buffer (tramp-get-connection-buffer v)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
420 (goto-char (point-min))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
421 (search-forward-regexp tramp-smb-errors nil t)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
422 (tramp-error
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
423 v 'file-error "%s `%s'" (match-string 0) filename))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
424
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
425 (defun tramp-smb-handle-directory-files
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
426 (directory &optional full match nosort)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
427 "Like `directory-files' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
428 (let ((result (mapcar 'directory-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
429 (file-name-all-completions "" directory))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
430 ;; Discriminate with regexp.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
431 (when match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
432 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
433 (delete nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
434 (mapcar (lambda (x) (when (string-match match x) x))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
435 result))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
436 ;; Append directory.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
437 (when full
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
438 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
439 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
440 (lambda (x) (expand-file-name x directory))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
441 result)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
442 ;; Sort them if necessary.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
443 (unless nosort (setq result (sort result 'string-lessp)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
444 ;; That's it.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
445 result))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
446
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
447 (defun tramp-smb-handle-directory-files-and-attributes
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
448 (directory &optional full match nosort id-format)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
449 "Like `directory-files-and-attributes' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
450 (mapcar
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
451 (lambda (x)
105276
0c6bc9d2b10c (tramp-smb-handle-directory-files-and-attributes): Use
Glenn Morris <rgm@gnu.org>
parents: 105249
diff changeset
452 (cons x (tramp-compat-file-attributes
105249
99d98ed749b9 * net/tramp-smb.el (tramp-smb-handle-directory-files-and-attributes):
Michael Albinus <michael.albinus@gmx.de>
parents: 103531
diff changeset
453 (if full x (expand-file-name x directory)) id-format)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
454 (directory-files directory full match nosort)))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
455
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
456 (defun tramp-smb-handle-expand-file-name (name &optional dir)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
457 "Like `expand-file-name' for Tramp files."
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
458 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
459 (setq dir (or dir default-directory "/"))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
460 ;; Unless NAME is absolute, concat DIR and NAME.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
461 (unless (file-name-absolute-p name)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
462 (setq name (concat (file-name-as-directory dir) name)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
463 ;; If NAME is not a Tramp file, run the real handler.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
464 (if (not (tramp-tramp-file-p name))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
465 (tramp-run-real-handler 'expand-file-name (list name nil))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
466 ;; Dissect NAME.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
467 (with-parsed-tramp-file-name name nil
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
468 ;; Tilde expansion if necessary. We use the user name as share,
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
469 ;; which is offen the case in domains.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
470 (when (string-match "\\`/?~\\([^/]*\\)" localname)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
471 (setq localname
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
472 (replace-match
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
473 (if (zerop (length (match-string 1 localname)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
474 (tramp-file-name-real-user v)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
475 (match-string 1 localname))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
476 nil nil localname)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
477 ;; Make the file name absolute.
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
478 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
479 (setq localname (concat "/" localname)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
480 ;; No tilde characters in file name, do normal
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
481 ;; `expand-file-name' (this does "/./" and "/../").
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
482 (tramp-make-tramp-file-name
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
483 method user host
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
484 (tramp-run-real-handler 'expand-file-name (list localname))))))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
485
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
486 (defun tramp-smb-handle-file-attributes (filename &optional id-format)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
487 "Like `file-attributes' for Tramp files."
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
488 (unless id-format (setq id-format 'integer))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
489 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
490 (with-file-property v localname (format "file-attributes-%s" id-format)
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
491 (if (and (tramp-smb-get-share v) (tramp-smb-get-stat-capability v))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
492 (tramp-smb-do-file-attributes-with-stat v id-format)
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
493 ;; Reading just the filename entry via "dir localname" is not
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
494 ;; possible, because when filename is a directory, some
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
495 ;; smbclient versions return the content of the directory, and
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
496 ;; other versions don't. Therefore, the whole content of the
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
497 ;; upper directory is retrieved, and the entry of the filename
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
498 ;; is extracted from.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
499 (let* ((entries (tramp-smb-get-file-entries
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
500 (file-name-directory filename)))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
501 (entry (assoc (file-name-nondirectory filename) entries))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
502 (uid (if (equal id-format 'string) "nobody" -1))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
503 (gid (if (equal id-format 'string) "nogroup" -1))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
504 (inode (tramp-get-inode v))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
505 (device (tramp-get-device v)))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
506
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
507 ;; Check result.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
508 (when entry
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
509 (list (and (string-match "d" (nth 1 entry))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
510 t) ;0 file type
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
511 -1 ;1 link count
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
512 uid ;2 uid
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
513 gid ;3 gid
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
514 '(0 0) ;4 atime
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
515 (nth 3 entry) ;5 mtime
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
516 '(0 0) ;6 ctime
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
517 (nth 2 entry) ;7 size
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
518 (nth 1 entry) ;8 mode
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
519 nil ;9 gid weird
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
520 inode ;10 inode number
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
521 device))))))) ;11 file system number
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
522
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
523 (defun tramp-smb-do-file-attributes-with-stat (vec &optional id-format)
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
524 "Implement `file-attributes' for Tramp files using stat command."
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
525 (tramp-message
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
526 vec 5 "file attributes with stat: %s" (tramp-file-name-localname vec))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
527 (with-current-buffer (tramp-get-buffer vec)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
528 (let* (size id link uid gid atime mtime ctime mode inode)
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
529 (when (tramp-smb-send-command
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
530 vec (format "stat \"%s\"" (tramp-smb-get-localname vec)))
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
531
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
532 ;; Loop the listing.
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
533 (goto-char (point-min))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
534 (unless (re-search-forward tramp-smb-errors nil t)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
535 (while (not (eobp))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
536 (cond
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
537 ((looking-at
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
538 "Size:\\s-+\\([0-9]+\\)\\s-+Blocks:\\s-+[0-9]+\\s-+\\(\\w+\\)")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
539 (setq size (string-to-number (match-string 1))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
540 id (if (string-equal "directory" (match-string 2)) t
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
541 (if (string-equal "symbolic" (match-string 2)) ""))))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
542 ((looking-at
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
543 "Inode:\\s-+\\([0-9]+\\)\\s-+Links:\\s-+\\([0-9]+\\)")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
544 (setq inode (string-to-number (match-string 1))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
545 link (string-to-number (match-string 2))))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
546 ((looking-at
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
547 "Access:\\s-+([0-9]+/\\(\\S-+\\))\\s-+Uid:\\s-+\\([0-9]+\\)\\s-+Gid:\\s-+\\([0-9]+\\)")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
548 (setq mode (match-string 1)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
549 uid (if (equal id-format 'string) (match-string 2)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
550 (string-to-number (match-string 2)))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
551 gid (if (equal id-format 'string) (match-string 3)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
552 (string-to-number (match-string 3)))))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
553 ((looking-at
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
554 "Access:\\s-+\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)\\s-+\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
555 (setq atime
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
556 (encode-time
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
557 (string-to-number (match-string 6)) ;; sec
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
558 (string-to-number (match-string 5)) ;; min
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
559 (string-to-number (match-string 4)) ;; hour
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
560 (string-to-number (match-string 3)) ;; day
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
561 (string-to-number (match-string 2)) ;; month
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
562 (string-to-number (match-string 1))))) ;; year
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
563 ((looking-at
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
564 "Modify:\\s-+\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)\\s-+\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
565 (setq mtime
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
566 (encode-time
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
567 (string-to-number (match-string 6)) ;; sec
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
568 (string-to-number (match-string 5)) ;; min
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
569 (string-to-number (match-string 4)) ;; hour
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
570 (string-to-number (match-string 3)) ;; day
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
571 (string-to-number (match-string 2)) ;; month
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
572 (string-to-number (match-string 1))))) ;; year
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
573 ((looking-at
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
574 "Change:\\s-+\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)\\s-+\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
575 (setq ctime
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
576 (encode-time
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
577 (string-to-number (match-string 6)) ;; sec
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
578 (string-to-number (match-string 5)) ;; min
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
579 (string-to-number (match-string 4)) ;; hour
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
580 (string-to-number (match-string 3)) ;; day
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
581 (string-to-number (match-string 2)) ;; month
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
582 (string-to-number (match-string 1)))))) ;; year
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
583 (forward-line))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
584 ;; Return the result.
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
585 (list id link uid gid atime mtime ctime size mode nil inode
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
586 (tramp-get-device vec)))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
587
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
588 (defun tramp-smb-handle-file-directory-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
589 "Like `file-directory-p' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
590 (and (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
591 (eq ?d (aref (nth 8 (file-attributes filename)) 0))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
592
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
593 (defun tramp-smb-handle-file-exists-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
594 "Like `file-exists-p' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
595 (not (null (file-attributes filename))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
596
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
597 (defun tramp-smb-handle-file-local-copy (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
598 "Like `file-local-copy' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
599 (with-parsed-tramp-file-name filename nil
103531
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
600 (unless (file-exists-p filename)
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
601 (tramp-error
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
602 v 'file-error
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
603 "Cannot make local copy of non-existing file `%s'" filename))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
604 (let ((tmpfile (tramp-compat-make-temp-file filename)))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
605 (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
606 (if (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
607 v (format "get \"%s\" \"%s\"" (tramp-smb-get-localname v) tmpfile))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
608 (tramp-message
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
609 v 4 "Fetching %s to tmp file %s...done" filename tmpfile)
103531
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
610 ;; Oops, an error. We shall cleanup.
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
611 (delete-file tmpfile)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
612 (tramp-error
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
613 v 'file-error "Cannot make local copy of file `%s'" filename))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
614 tmpfile)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
615
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
616 ;; This function should return "foo/" for directories and "bar" for
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
617 ;; files.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
618 (defun tramp-smb-handle-file-name-all-completions (filename directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
619 "Like `file-name-all-completions' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
620 (all-completions
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
621 filename
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
622 (with-parsed-tramp-file-name directory nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
623 (with-file-property v localname "file-name-all-completions"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
624 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
625 (let ((entries (tramp-smb-get-file-entries directory)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
626 (mapcar
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
627 (lambda (x)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
628 (list
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
629 (if (string-match "d" (nth 1 x))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
630 (file-name-as-directory (nth 0 x))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
631 (nth 0 x))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
632 entries)))))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
633
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
634 (defun tramp-smb-handle-file-newer-than-file-p (file1 file2)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
635 "Like `file-newer-than-file-p' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
636 (cond
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
637 ((not (file-exists-p file1)) nil)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
638 ((not (file-exists-p file2)) t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
639 (t (tramp-time-less-p (nth 5 (file-attributes file2))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
640 (nth 5 (file-attributes file1))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
641
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
642 (defun tramp-smb-handle-file-writable-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
643 "Like `file-writable-p' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
644 (if (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
645 (string-match "w" (or (nth 8 (file-attributes filename)) ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
646 (let ((dir (file-name-directory filename)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
647 (and (file-exists-p dir)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
648 (file-writable-p dir)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
649
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
650 (defun tramp-smb-handle-insert-directory
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
651 (filename switches &optional wildcard full-directory-p)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
652 "Like `insert-directory' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
653 (setq filename (expand-file-name filename))
107092
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
654 (if full-directory-p
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
655 ;; Called from `dired-add-entry'.
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
656 (setq filename (file-name-as-directory filename))
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
657 (setq filename (directory-file-name filename)))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
658 (with-parsed-tramp-file-name filename nil
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
659 (save-match-data
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
660 (let ((base (file-name-nondirectory filename))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
661 ;; We should not destroy the cache entry.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
662 (entries (copy-sequence
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
663 (tramp-smb-get-file-entries
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
664 (file-name-directory filename)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
665
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
666 (when wildcard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
667 (string-match "\\." base)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
668 (setq base (replace-match "\\\\." nil nil base))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
669 (string-match "\\*" base)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
670 (setq base (replace-match ".*" nil nil base))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
671 (string-match "\\?" base)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
672 (setq base (replace-match ".?" nil nil base)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
673
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
674 ;; Filter entries.
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
675 (setq entries
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
676 (delq
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
677 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
678 (if (or wildcard (zerop (length base)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
679 ;; Check for matching entries.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
680 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
681 (lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
682 (when (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
683 (format "^%s" base) (nth 0 x))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
684 x))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
685 entries)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
686 ;; We just need the only and only entry FILENAME.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
687 (list (assoc base entries)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
688
87368
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
689 ;; Sort entries.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
690 (setq entries
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
691 (sort
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
692 entries
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
693 (lambda (x y)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
694 (if (string-match "t" switches)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
695 ;; Sort by date.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
696 (tramp-time-less-p (nth 3 y) (nth 3 x))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
697 ;; Sort by name.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
698 (string-lessp (nth 0 x) (nth 0 y))))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
699
87368
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
700 ;; Handle "-F" switch.
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
701 (when (string-match "F" switches)
87559
59f471917fe0 (tramp-smb-handle-insert-directory): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents: 87368
diff changeset
702 (mapc
87368
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
703 (lambda (x)
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
704 (when (not (zerop (length (car x))))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
705 (cond
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
706 ((char-equal ?d (string-to-char (nth 1 x)))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
707 (setcar x (concat (car x) "/")))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
708 ((char-equal ?x (string-to-char (nth 1 x)))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
709 (setcar x (concat (car x) "*"))))))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
710 entries))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
711
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
712 ;; Print entries.
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
713 (mapc
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
714 (lambda (x)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
715 (when (not (zerop (length (nth 0 x))))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
716 (let ((attr
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
717 (when (tramp-smb-get-stat-capability v)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
718 (ignore-errors
107092
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
719 (file-attributes filename 'string)))))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
720 (insert
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
721 (format
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
722 "%10s %3d %-8s %-8s %8s %s "
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
723 (or (nth 8 attr) (nth 1 x)) ; mode
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
724 (or (nth 1 attr) 1) ; inode
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
725 (or (nth 2 attr) "nobody") ; uid
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
726 (or (nth 3 attr) "nogroup") ; gid
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
727 (or (nth 7 attr) (nth 2 x)) ; size
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
728 (format-time-string
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
729 (if (tramp-time-less-p
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
730 (tramp-time-subtract (current-time) (nth 3 x))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
731 tramp-half-a-year)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
732 "%b %e %R"
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
733 "%b %e %Y")
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
734 (nth 3 x)))) ; date
107085
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 106959
diff changeset
735 ;; We mark the file name. The inserted name could be
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 106959
diff changeset
736 ;; from somewhere else, so we use the relative file
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 106959
diff changeset
737 ;; name of `default-directory'.
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
738 (let ((start (point)))
107085
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 106959
diff changeset
739 (insert
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 106959
diff changeset
740 (format
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 106959
diff changeset
741 "%s\n"
107092
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
742 (file-relative-name
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
743 (expand-file-name
2e763e444bc2 * net/ange-ftp.el (ange-ftp-insert-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
744 (nth 0 x) (file-name-directory filename)))))
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
745 (put-text-property start (1- (point)) 'dired-filename t))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
746 (forward-line)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
747 (beginning-of-line))))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
748 entries)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
749
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
750 (defun tramp-smb-handle-make-directory (dir &optional parents)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
751 "Like `make-directory' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
752 (setq dir (directory-file-name (expand-file-name dir)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
753 (unless (file-name-absolute-p dir)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
754 (setq dir (expand-file-name dir default-directory)))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
755 (with-parsed-tramp-file-name dir nil
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
756 (save-match-data
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
757 (let* ((ldir (file-name-directory dir)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
758 ;; Make missing directory parts.
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
759 (when (and parents
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
760 (tramp-smb-get-share v)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
761 (not (file-directory-p ldir)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
762 (make-directory ldir parents))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
763 ;; Just do it.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
764 (when (file-directory-p ldir)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
765 (make-directory-internal dir))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
766 (unless (file-directory-p dir)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
767 (tramp-error v 'file-error "Couldn't make directory %s" dir))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
768
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
769 (defun tramp-smb-handle-make-directory-internal (directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
770 "Like `make-directory-internal' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
771 (setq directory (directory-file-name (expand-file-name directory)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
772 (unless (file-name-absolute-p directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
773 (setq directory (expand-file-name directory default-directory)))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
774 (with-parsed-tramp-file-name directory nil
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
775 (save-match-data
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
776 (let* ((file (tramp-smb-get-localname v)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
777 (when (file-directory-p (file-name-directory directory))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
778 (tramp-smb-send-command
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
779 v
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
780 (if (tramp-smb-get-cifs-capabilities v)
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
781 (format
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
782 "posix_mkdir \"%s\" %s"
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
783 file (tramp-decimal-to-octal (default-file-modes)))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
784 (format "mkdir \"%s\"" file)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
785 ;; We must also flush the cache of the directory, because
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
786 ;; `file-attributes' reads the values from there.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
787 (tramp-flush-file-property v (file-name-directory localname))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
788 (tramp-flush-file-property v localname))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
789 (unless (file-directory-p directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
790 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
791 v 'file-error "Couldn't make directory %s" directory))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
792
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
793 (defun tramp-smb-handle-make-symbolic-link
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
794 (filename linkname &optional ok-if-already-exists)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
795 "Like `make-symbolic-link' for Tramp files.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
796 If LINKNAME is a non-Tramp file, it is used verbatim as the target of
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
797 the symlink. If LINKNAME is a Tramp file, only the localname component is
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
798 used as the target of the symlink.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
799
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
800 If LINKNAME is a Tramp file and the localname component is relative, then
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
801 it is expanded first, before the localname component is taken. Note that
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
802 this can give surprising results if the user/host for the source and
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
803 target of the symlink differ."
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
804 (unless (tramp-equal-remote filename linkname)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
805 (with-parsed-tramp-file-name
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
806 (if (tramp-tramp-file-p filename) filename linkname) nil
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
807 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
808 v 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
809 "make-symbolic-link: %s"
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
810 "only implemented for same method, same user, same host")))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
811 (with-parsed-tramp-file-name filename v1
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
812 (with-parsed-tramp-file-name linkname v2
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
813 (when (file-directory-p filename)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
814 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
815 v2 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
816 "make-symbolic-link: %s must not be a directory" filename))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
817 (when (and (not ok-if-already-exists)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
818 (file-exists-p linkname)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
819 (not (numberp ok-if-already-exists))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
820 (y-or-n-p
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
821 (format
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
822 "File %s already exists; make it a new name anyway? "
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
823 linkname)))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
824 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
825 v2 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
826 "make-symbolic-link: file %s already exists" linkname))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
827 (unless (tramp-smb-get-cifs-capabilities v1)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
828 (tramp-error v2 'file-error "make-symbolic-link not supported"))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
829 ;; We must also flush the cache of the directory, because
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
830 ;; `file-attributes' reads the values from there.
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
831 (tramp-flush-file-property v2 (file-name-directory v2-localname))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
832 (tramp-flush-file-property v2 v2-localname)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
833 (unless
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
834 (tramp-smb-send-command
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
835 v1
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
836 (format
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
837 "symlink \"%s\" \"%s\""
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
838 (tramp-smb-get-localname v1)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
839 (tramp-smb-get-localname v2)))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
840 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
841 v2 'file-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
842 "error with make-symbolic-link, see buffer `%s' for details"
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
843 (buffer-name))))))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
844
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
845 (defun tramp-smb-handle-rename-file
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
846 (filename newname &optional ok-if-already-exists)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
847 "Like `rename-file' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
848 (setq filename (expand-file-name filename)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
849 newname (expand-file-name newname))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
850
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
851 (let ((tmpfile (file-local-copy filename)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
852
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
853 (if tmpfile
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
854 ;; Remote filename.
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
855 (condition-case err
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
856 (rename-file tmpfile newname ok-if-already-exists)
100931
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
857 ((error quit)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
858 (delete-file tmpfile)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
859 (signal (car err) (cdr err))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
860
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
861 ;; Remote newname.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
862 (when (file-directory-p newname)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
863 (setq newname (expand-file-name
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
864 (file-name-nondirectory filename) newname)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
865
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
866 (with-parsed-tramp-file-name newname nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
867 (when (and (not ok-if-already-exists)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
868 (file-exists-p newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
869 (tramp-error v 'file-already-exists newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
870 ;; We must also flush the cache of the directory, because
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
871 ;; `file-attributes' reads the values from there.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
872 (tramp-flush-file-property v (file-name-directory localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
873 (tramp-flush-file-property v localname)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
874 (tramp-message v 0 "Copying file %s to file %s..." filename newname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
875 (if (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
876 v (format "put %s \"%s\"" filename (tramp-smb-get-localname v)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
877 (tramp-message
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
878 v 0 "Copying file %s to file %s...done" filename newname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
879 (tramp-error v 'file-error "Cannot rename `%s'" filename)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
880
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
881 (delete-file filename))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
882
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
883 (defun tramp-smb-handle-set-file-modes (filename mode)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
884 "Like `set-file-modes' for Tramp files."
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
885 (with-parsed-tramp-file-name filename nil
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
886 (when (tramp-smb-get-cifs-capabilities v)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
887 (tramp-flush-file-property v localname)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
888 (unless (tramp-smb-send-command
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
889 v (format "chmod \"%s\" %s"
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
890 (tramp-smb-get-localname v)
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
891 (tramp-decimal-to-octal mode)))
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
892 (tramp-error
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
893 v 'file-error "Error while changing file's mode %s" filename)))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
894
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
895 (defun tramp-smb-handle-substitute-in-file-name (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
896 "Like `handle-substitute-in-file-name' for Tramp files.
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
897 \"//\" substitutes only in the local filename part. Catches
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
898 errors for shares like \"C$/\", which are common in Microsoft Windows."
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
899 (with-parsed-tramp-file-name filename nil
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
900 ;; Ignore in LOCALNAME everything before "//".
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
901 (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
902 (setq filename
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
903 (concat (file-remote-p filename)
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
904 (replace-match "\\1" nil nil localname)))))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
905 (condition-case nil
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
906 (tramp-run-real-handler 'substitute-in-file-name (list filename))
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
907 (error filename)))
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
908
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
909 (defun tramp-smb-handle-write-region
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
910 (start end filename &optional append visit lockname confirm)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
911 "Like `write-region' for Tramp files."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
912 (setq filename (expand-file-name filename))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
913 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
914 (unless (eq append nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
915 (tramp-error
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
916 v 'file-error "Cannot append to file using Tramp (`%s')" filename))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
917 ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
918 (when (and (not (featurep 'xemacs))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
919 confirm (file-exists-p filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
920 (unless (y-or-n-p (format "File %s exists; overwrite anyway? "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
921 filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
922 (tramp-error v 'file-error "File not overwritten")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
923 ;; We must also flush the cache of the directory, because
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
924 ;; `file-attributes' reads the values from there.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
925 (tramp-flush-file-property v (file-name-directory localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
926 (tramp-flush-file-property v localname)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
927 (let ((curbuf (current-buffer))
85041
a42b8750a992 * net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents: 85024
diff changeset
928 (tmpfile (tramp-compat-make-temp-file filename)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
929 ;; We say `no-message' here because we don't want the visited file
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
930 ;; modtime data to be clobbered from the temp file. We call
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
931 ;; `set-visited-file-modtime' ourselves later on.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
932 (tramp-run-real-handler
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
933 'write-region
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
934 (if confirm ; don't pass this arg unless defined for backward compat.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
935 (list start end tmpfile append 'no-message lockname confirm)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
936 (list start end tmpfile append 'no-message lockname)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
937
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
938 (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfile filename)
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
939 (unwind-protect
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
940 (if (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
941 v (format "put %s \"%s\"" tmpfile (tramp-smb-get-localname v)))
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
942 (tramp-message
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
943 v 5 "Writing tmp file %s to file %s...done" tmpfile filename)
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
944 (tramp-error v 'file-error "Cannot write `%s'" filename))
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
945 (delete-file tmpfile))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
946
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
947 (unless (equal curbuf (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
948 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
949 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
950 "Buffer has changed from `%s' to `%s'" curbuf (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
951 (when (eq visit t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
952 (set-visited-file-modtime)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
953
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
954
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
955 ;; Internal file name functions.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
956
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
957 (defun tramp-smb-get-share (vec)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
958 "Returns the share name of LOCALNAME."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
959 (save-match-data
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
960 (let ((localname (tramp-file-name-localname vec)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
961 (when (string-match "^/?\\([^/]+\\)/" localname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
962 (match-string 1 localname)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
963
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
964 (defun tramp-smb-get-localname (vec)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
965 "Returns the file name of LOCALNAME.
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
966 If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
967 (save-match-data
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
968 (let ((localname (tramp-file-name-localname vec)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
969 (setq
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
970 localname
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
971 (if (string-match "^/?[^/]+\\(/.*\\)" localname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
972 ;; There is a share, sparated by "/".
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
973 (if (not (tramp-smb-get-cifs-capabilities vec))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
974 (mapconcat
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
975 (lambda (x) (if (equal x ?/) "\\" (char-to-string x)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
976 (match-string 1 localname) "")
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
977 (match-string 1 localname))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
978 ;; There is just a share.
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
979 (if (string-match "^/?\\([^/]+\\)$" localname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
980 (match-string 1 localname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
981 "")))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
982
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
983 ;; Sometimes we have discarded `substitute-in-file-name'.
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
984 (when (string-match "\\(\\$\\$\\)\\(/\\|$\\)" localname)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
985 (setq localname (replace-match "$" nil nil localname 1)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
986
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
987 localname)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
988
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
989 ;; Share names of a host are cached. It is very unlikely that the
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
990 ;; shares do change during connection.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
991 (defun tramp-smb-get-file-entries (directory)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
992 "Read entries which match DIRECTORY.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
993 Either the shares are listed, or the `dir' command is executed.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
994 Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
995 (with-parsed-tramp-file-name (file-name-as-directory directory) nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
996 (setq localname (or localname "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
997 (with-file-property v localname "file-entries"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
998 (with-current-buffer (tramp-get-buffer v)
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
999 (let* ((share (tramp-smb-get-share v))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1000 (cache (tramp-get-connection-property v "share-cache" nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1001 res entry)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1002
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1003 (if (and (not share) cache)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1004 ;; Return cached shares.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1005 (setq res cache)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1006
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1007 ;; Read entries.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1008 (if share
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1009 (tramp-smb-send-command
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1010 v (format "dir \"%s*\"" (tramp-smb-get-localname v)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1011 ;; `tramp-smb-maybe-open-connection' lists also the share names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1012 (tramp-smb-maybe-open-connection v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1013
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1014 ;; Loop the listing.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1015 (goto-char (point-min))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1016 (if (re-search-forward tramp-smb-errors nil t)
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1017 (tramp-error v 'file-error "%s `%s'" (match-string 0) directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1018 (while (not (eobp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1019 (setq entry (tramp-smb-read-file-entry share))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1020 (forward-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1021 (when entry (add-to-list 'res entry))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1022
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1023 ;; Cache share entries.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1024 (unless share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1025 (tramp-set-connection-property v "share-cache" res)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1026
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1027 ;; Add directory itself.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1028 (add-to-list 'res '("" "drwxrwxrwx" 0 (0 0)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1029
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1030 ;; There's a very strange error (debugged with XEmacs 21.4.14)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1031 ;; If there's no short delay, it returns nil. No idea about.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1032 (when (featurep 'xemacs) (sleep-for 0.01))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1033
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1034 ;; Return entries.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1035 (delq nil res))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1036
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1037 ;; Return either a share name (if SHARE is nil), or a file name.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1038 ;;
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1039 ;; If shares are listed, the following format is expected:
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1040 ;;
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1041 ;; Disk| - leading spaces
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1042 ;; [^|]+| - share name, 14 char
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1043 ;; .* - comment
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1044 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1045 ;; Entries provided by smbclient DIR aren't fully regular.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1046 ;; They should have the format
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1047 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1048 ;; \s-\{2,2} - leading spaces
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1049 ;; \S-\(.*\S-\)\s-* - file name, 30 chars, left bound
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1050 ;; \s-+[ADHRSV]* - permissions, 7 chars, right bound
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1051 ;; \s- - space delimeter
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1052 ;; \s-+[0-9]+ - size, 8 chars, right bound
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1053 ;; \s-\{2,2\} - space delimeter
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1054 ;; \w\{3,3\} - weekday
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1055 ;; \s- - space delimeter
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1056 ;; \w\{3,3\} - month
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1057 ;; \s- - space delimeter
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1058 ;; [ 12][0-9] - day
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1059 ;; \s- - space delimeter
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1060 ;; [0-9]\{2,2\}:[0-9]\{2,2\}:[0-9]\{2,2\} - time
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1061 ;; \s- - space delimeter
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1062 ;; [0-9]\{4,4\} - year
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1063 ;;
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1064 ;; samba/src/client.c (http://samba.org/doxygen/samba/client_8c-source.html)
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1065 ;; has function display_finfo:
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1066 ;;
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1067 ;; d_printf(" %-30s%7.7s %8.0f %s",
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1068 ;; finfo->name,
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1069 ;; attrib_string(finfo->mode),
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1070 ;; (double)finfo->size,
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1071 ;; asctime(LocalTime(&t)));
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1072 ;;
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1073 ;; in Samba 1.9, there's the following code:
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1074 ;;
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1075 ;; DEBUG(0,(" %-30s%7.7s%10d %s",
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1076 ;; CNV_LANG(finfo->name),
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1077 ;; attrib_string(finfo->mode),
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1078 ;; finfo->size,
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1079 ;; asctime(LocalTime(&t))));
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1080 ;;
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1081 ;; Problems:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1082 ;; * Modern regexp constructs, like spy groups and counted repetitions, aren't
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1083 ;; available in older Emacsen.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1084 ;; * The length of constructs (file name, size) might exceed the default.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1085 ;; * File names might contain spaces.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1086 ;; * Permissions might be empty.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1087 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1088 ;; So we try to analyze backwards.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1089 (defun tramp-smb-read-file-entry (share)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1090 "Parse entry in SMB output buffer.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1091 If SHARE is result, entries are of type dir. Otherwise, shares are listed.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1092 Result is the list (LOCALNAME MODE SIZE MTIME)."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1093 ;; We are called from `tramp-smb-get-file-entries', which sets the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1094 ;; current buffer.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
1095 (let ((line (buffer-substring (point) (tramp-compat-line-end-position)))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1096 localname mode size month day hour min sec year mtime)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1097
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1098 (if (not share)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1099
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1100 ;; Read share entries.
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1101 (when (string-match "^Disk|\\([^|]+\\)|" line)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1102 (setq localname (match-string 1 line)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1103 mode "dr-xr-xr-x"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1104 size 0))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1105
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1106 ;; Real listing.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1107 (block nil
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1108
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1109 ;; year.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1110 (if (string-match "\\([0-9]+\\)$" line)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1111 (setq year (string-to-number (match-string 1 line))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1112 line (substring line 0 -5))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1113 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1114
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1115 ;; time.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1116 (if (string-match "\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)$" line)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1117 (setq hour (string-to-number (match-string 1 line))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1118 min (string-to-number (match-string 2 line))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1119 sec (string-to-number (match-string 3 line))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1120 line (substring line 0 -9))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1121 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1122
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1123 ;; day.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1124 (if (string-match "\\([0-9]+\\)$" line)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1125 (setq day (string-to-number (match-string 1 line))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1126 line (substring line 0 -3))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1127 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1128
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1129 ;; month.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1130 (if (string-match "\\(\\w+\\)$" line)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1131 (setq month (match-string 1 line)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1132 line (substring line 0 -4))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1133 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1134
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1135 ;; weekday.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1136 (if (string-match "\\(\\w+\\)$" line)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1137 (setq line (substring line 0 -5))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1138 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1139
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1140 ;; size.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1141 (if (string-match "\\([0-9]+\\)$" line)
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1142 (let ((length (- (max 10 (1+ (length (match-string 1 line)))))))
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1143 (setq size (string-to-number (match-string 1 line)))
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1144 (when (string-match "\\([ADHRSV]+\\)" (substring line length))
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1145 (setq length (+ length (match-end 0))))
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1146 (setq line (substring line 0 length)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1147 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1148
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1149 ;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID.
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1150 (if (string-match "\\([ADHRSV]+\\)?$" line)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1151 (setq
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1152 mode (or (match-string 1 line) "")
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1153 mode (save-match-data (format
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1154 "%s%s"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1155 (if (string-match "D" mode) "d" "-")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1156 (mapconcat
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1157 (lambda (x) "") " "
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1158 (concat "r" (if (string-match "R" mode) "-" "w") "x"))))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1159 line (substring line 0 -6))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1160 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1161
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1162 ;; localname.
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1163 (if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-*$" line)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1164 (setq localname (match-string 1 line))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1165 (return))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1166
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1167 (when (and localname mode size)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1168 (setq mtime
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1169 (if (and sec min hour day month year)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1170 (encode-time
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1171 sec min hour day
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1172 (cdr (assoc (downcase month) tramp-parse-time-months))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1173 year)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1174 '(0 0)))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1175 (list localname mode size mtime))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1176
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
1177 (defun tramp-smb-get-cifs-capabilities (vec)
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
1178 "Check, whether the SMB server supports POSIX commands."
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1179 ;; When we are not logged in yet, we return nil.
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1180 (if (let ((p (tramp-get-connection-process vec)))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1181 (and p (processp p) (memq (process-status p) '(run open))))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1182 (with-connection-property
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1183 (tramp-get-connection-process vec) "cifs-capabilities"
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1184 (save-match-data
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1185 (when (tramp-smb-send-command vec "posix")
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1186 (with-current-buffer (tramp-get-buffer vec)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1187 (goto-char (point-min))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1188 (when
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1189 (re-search-forward "Server supports CIFS capabilities" nil t)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1190 (member
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1191 "pathnames"
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1192 (split-string
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1193 (buffer-substring
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1194 (point) (tramp-compat-line-end-position)) nil t)))))))))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1195
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1196 (defun tramp-smb-get-stat-capability (vec)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1197 "Check, whether the SMB server supports the STAT command."
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1198 ;; When we are not logged in yet, we return nil.
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1199 (if (let ((p (tramp-get-connection-process vec)))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1200 (and p (processp p) (memq (process-status p) '(run open))))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1201 (with-connection-property
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1202 (tramp-get-connection-process vec) "stat-capability"
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1203 (tramp-smb-send-command vec "stat ."))))
105551
2025d7d04cb9 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105524
diff changeset
1204
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1205
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1206 ;; Connection functions.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1207
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1208 (defun tramp-smb-send-command (vec command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1209 "Send the COMMAND to connection VEC.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1210 Returns nil if there has been an error message from smbclient."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1211 (tramp-smb-maybe-open-connection vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1212 (tramp-message vec 6 "%s" command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1213 (tramp-send-string vec command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1214 (tramp-smb-wait-for-output vec))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1215
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1216 (defun tramp-smb-maybe-open-connection (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1217 "Maybe open a connection to HOST, log in as USER, using `tramp-smb-program'.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1218 Does not do anything if a connection is already open, but re-opens the
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1219 connection if a previous connection has died for some reason."
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1220 (let* ((share (tramp-smb-get-share vec))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1221 (buf (tramp-get-buffer vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1222 (p (get-buffer-process buf)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1223
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1224 ;; Check whether we still have the same smbclient version.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1225 ;; Otherwise, we must delete the connection cache, because
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1226 ;; capabilities migh have changed.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1227 (unless (processp p)
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1228 (let ((default-directory (tramp-compat-temporary-file-directory))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1229 (command (concat tramp-smb-program " -V")))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1230
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1231 (unless tramp-smb-version
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1232 (unless (executable-find tramp-smb-program)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1233 (tramp-error
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1234 vec 'file-error
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1235 "Cannot find command %s in %s" tramp-smb-program exec-path))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1236 (setq tramp-smb-version (shell-command-to-string command))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1237 (tramp-message vec 6 command)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1238 (tramp-message vec 6 "\n%s" tramp-smb-version)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1239 (if (string-match "[ \t\n\r]+\\'" tramp-smb-version)
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1240 (setq tramp-smb-version
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1241 (replace-match "" nil nil tramp-smb-version))))
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1242
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1243 (unless (string-equal
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1244 tramp-smb-version
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1245 (tramp-get-connection-property
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1246 vec "smbclient-version" tramp-smb-version))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1247 (tramp-flush-directory-property vec "")
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1248 (tramp-flush-connection-property vec))
105690
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1249
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1250 (tramp-set-connection-property
8d8fc5285759 * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 105634
diff changeset
1251 vec "smbclient-version" tramp-smb-version)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1252
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1253 ;; If too much time has passed since last command was sent, look
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1254 ;; whether there has been an error message; maybe due to
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1255 ;; connection timeout.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1256 (with-current-buffer buf
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1257 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1258 (when (and (> (tramp-time-diff
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1259 (current-time)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1260 (tramp-get-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1261 p "last-cmd-time" '(0 0 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1262 60)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1263 p (processp p) (memq (process-status p) '(run open))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1264 (re-search-forward tramp-smb-errors nil t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1265 (delete-process p)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1266 (setq p nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1267
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1268 ;; Check whether it is still the same share.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1269 (unless
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1270 (and p (processp p) (memq (process-status p) '(run open))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1271 (string-equal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1272 share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1273 (tramp-get-connection-property p "smb-share" "")))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1274
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1275 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1276 ;; There might be unread output from checking for share names.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1277 (when buf (with-current-buffer buf (erase-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1278 (when (and p (processp p)) (delete-process p))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1279
100857
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1280 (let* ((user (tramp-file-name-user vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1281 (host (tramp-file-name-host vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1282 (real-user (tramp-file-name-real-user vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1283 (real-host (tramp-file-name-real-host vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1284 (domain (tramp-file-name-domain vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1285 (port (tramp-file-name-port vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1286 args)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1287
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1288 (if share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1289 (setq args (list (concat "//" real-host "/" share)))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1290 (setq args (list "-g" "-L" real-host )))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1291
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1292 (if (not (zerop (length real-user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1293 (setq args (append args (list "-U" real-user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1294 (setq args (append args (list "-N"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1295
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1296 (when domain (setq args (append args (list "-W" domain))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1297 (when port (setq args (append args (list "-p" port))))
106959
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
1298 (when tramp-smb-conf
5071660bbec4 * net/tramp-smb.el (tramp-smb-conf): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 106815
diff changeset
1299 (setq args (append args (list "-s" tramp-smb-conf))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1300
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1301 ;; OK, let's go.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1302 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1303 vec 3 "Opening connection for //%s%s/%s..."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1304 (if (not (zerop (length user))) (concat user "@") "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1305 host (or share ""))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1306
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1307 (let* ((coding-system-for-read nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1308 (process-connection-type tramp-process-connection-type)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
1309 (p (let ((default-directory
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
1310 (tramp-compat-temporary-file-directory)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1311 (apply #'start-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1312 (tramp-buffer-name vec) (tramp-get-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1313 tramp-smb-program args))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1314
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1315 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1316 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1317 (tramp-set-process-query-on-exit-flag p nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1318
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1319 ;; Set variables for computing the prompt for reading password.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1320 (setq tramp-current-method tramp-smb-method
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1321 tramp-current-user user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1322 tramp-current-host host)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1323
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1324 ;; Play login scenario.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1325 (tramp-process-actions
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1326 p vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1327 (if share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1328 tramp-smb-actions-with-share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1329 tramp-smb-actions-without-share))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1330
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1331 ;; Check server version.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1332 (with-current-buffer (tramp-get-connection-buffer vec)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1333 (goto-char (point-min))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1334 (search-forward-regexp
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1335 "Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]" nil t)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1336 (let ((smbserver-version (match-string 0)))
105616
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1337 (unless
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1338 (string-equal
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1339 smbserver-version
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1340 (tramp-get-connection-property
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1341 vec "smbserver-version" smbserver-version))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1342 (tramp-flush-directory-property vec "")
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1343 (tramp-flush-connection-property vec))
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1344 (tramp-set-connection-property
13878abadf01 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105572
diff changeset
1345 vec "smbserver-version" smbserver-version)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1346
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1347 ;; Set chunksize. Otherwise, `tramp-send-string' might
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1348 ;; try it itself.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1349 (tramp-set-connection-property p "smb-share" share)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1350 (tramp-set-connection-property p "chunksize" tramp-chunksize)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1351
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1352 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1353 vec 3 "Opening connection for //%s%s/%s...done"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1354 (if (not (zerop (length user))) (concat user "@") "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1355 host (or share ""))))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1356
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1357 ;; We don't use timeouts. If needed, the caller shall wrap around.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1358 (defun tramp-smb-wait-for-output (vec)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1359 "Wait for output from smbclient command.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1360 Returns nil if an error message has appeared."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1361 (with-current-buffer (tramp-get-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1362 (let ((p (get-buffer-process (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1363 (found (progn (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1364 (re-search-forward tramp-smb-prompt nil t)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1365 (err (progn (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1366 (re-search-forward tramp-smb-errors nil t))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1367
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1368 ;; Algorithm: get waiting output. See if last line contains
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1369 ;; tramp-smb-prompt sentinel or tramp-smb-errors strings.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1370 ;; If not, wait a bit and again get waiting output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1371 (while (and (not found) (not err))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1372
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1373 ;; Accept pending output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1374 (tramp-accept-process-output p)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1375
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1376 ;; Search for prompt.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1377 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1378 (setq found (re-search-forward tramp-smb-prompt nil t))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1379
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1380 ;; Search for errors.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1381 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1382 (setq err (re-search-forward tramp-smb-errors nil t)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1383
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1384 ;; When the process is still alive, read pending output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1385 (while (and (not found) (memq (process-status p) '(run open)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1386
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1387 ;; Accept pending output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1388 (tramp-accept-process-output p)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1389
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1390 ;; Search for prompt.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1391 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1392 (setq found (re-search-forward tramp-smb-prompt nil t)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1393
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1394 ;; Return value is whether no error message has appeared.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1395 (tramp-message vec 6 "\n%s" (buffer-string))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1396 (not err))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1397
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1398
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1399 (provide 'tramp-smb)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1400
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1401 ;;; TODO:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1402
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1403 ;; * Error handling in case password is wrong.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1404 ;; * Read password from "~/.netrc".
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1405 ;; * Return more comprehensive file permission string.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1406 ;; * Try to remove the inclusion of dummy "" directory. Seems to be at
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1407 ;; several places, especially in `tramp-smb-handle-insert-directory'.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1408 ;; * (RMS) Use unwind-protect to clean up the state so as to make the state
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1409 ;; regular again.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1410 ;; * Make it multi-hop capable.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1411
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91489
diff changeset
1412 ;; arch-tag: fcc9dbec-7503-4d73-b638-3c8aa59575f5
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1413 ;;; tramp-smb.el ends here