Commit e243da25 authored by Michael Albinus's avatar Michael Albinus
Browse files

Some minor Tramp changes

* lisp/net/tramp-sh.el (tramp-get-ls-command-with):
New defun, replacing ...
(tramp-get-ls-command-with-dired)
(tramp-get-ls-command-with-quoting-style)
(tramp-get-ls-command-with-w-option): Removed.
(tramp-do-file-attributes-with-ls)
(tramp-do-directory-files-and-attributes-with-stat)
(tramp-sh-handle-insert-directory): Adapt callees.

* lisp/net/tramp-smb.el (tramp-smb-errors):
Add "NT_STATUS_CONNECTION_RESET".
parent 04a1d639
......@@ -47,13 +47,12 @@
;; discovered during development time, is given in respective
;; comments.
;; The custom option `tramp-gvfs-methods' contains the list of
;; supported connection methods. Per default, these are "afp", "dav",
;; "davs", "gdrive", "obex", "owncloud", "sftp" and "synce". Note
;; that with "obex" it might be necessary to pair with the other
;; bluetooth device, if it hasn't been done already. There might be
;; also some few seconds delay in discovering available bluetooth
;; devices.
;; The user option `tramp-gvfs-methods' contains the list of supported
;; connection methods. Per default, these are "afp", "dav", "davs",
;; "gdrive", "obex", "owncloud", "sftp" and "synce". Note that with
;; "obex" it might be necessary to pair with the other bluetooth
;; device, if it hasn't been done already. There might be also some
;; few seconds delay in discovering available bluetooth devices.
;; "gdrive" and "owncloud" connection methods require a respective
;; account in GNOME Online Accounts, with enabled "Files" service.
......@@ -77,6 +76,8 @@
;; :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
;; tramp-gvfs-interface-mounttracker "ListMountableInfo")))
;; See also /usr/share/gvfs/mounts
;; Note that all other connection methods are not tested, beside the
;; ones offered for customization in `tramp-gvfs-methods'. If you
;; request an additional connection method to be supported, please
......@@ -87,7 +88,7 @@
;; "synce" method), or from the zeroconf daemon (for the "afp", "dav",
;; "davs", and "sftp" methods). The zeroconf daemon is pre-configured
;; to discover services in the "local" domain. If another domain
;; shall be used for discovering services, the custom option
;; shall be used for discovering services, the user option
;; `tramp-gvfs-zeroconf-domain' can be set accordingly.
;; Restrictions:
......@@ -2365,7 +2366,7 @@ They are retrieved from the hal daemon."
;; * (Customizable) unmount when exiting Emacs. See tramp-archive.el.
;; * Host name completion for existing mount points (afp-server,
;; smb-server, google-drive, owncloud) or via smb-network.
;; smb-server, google-drive, owncloud) or via smb-network or network.
;;
;; * Check, how two shares of the same SMB server can be mounted in
;; parallel.
......@@ -2374,5 +2375,7 @@ They are retrieved from the hal daemon."
;; capability.
;;
;; * Implement obex for other serial communication but bluetooth.
;;
;; * What's up with ftps dns-sd afc admin computer?
;;; tramp-gvfs.el ends here
......@@ -1301,10 +1301,8 @@ component is used as the target of the symlink."
;; On systems which have no quoting style, file names
;; with special characters could fail.
(cond
((tramp-get-ls-command-with-quoting-style vec)
"--quoting-style=c")
((tramp-get-ls-command-with-w-option vec)
"-w")
((tramp-get-ls-command-with vec "--quoting-style=c"))
((tramp-get-ls-command-with vec "-w"))
(t ""))
(tramp-shell-quote-argument localname)))
;; Parse `ls -l' output ...
......@@ -1338,7 +1336,7 @@ component is used as the target of the symlink."
(when symlinkp
(search-forward "-> ")
(setq res-symlink-target
(if (tramp-get-ls-command-with-quoting-style vec)
(if (looking-at "\"")
(read (current-buffer))
(buffer-substring (point) (point-at-eol)))))
;; Return data gathered.
......@@ -1835,10 +1833,8 @@ be non-negative integers."
;; On systems which have no quoting style, file names with special
;; characters could fail.
(cond
((tramp-get-ls-command-with-quoting-style vec)
"--quoting-style=shell")
((tramp-get-ls-command-with-w-option vec)
"-w")
((tramp-get-ls-command-with vec "--quoting-style=shell"))
((tramp-get-ls-command-with vec "-w"))
(t ""))
(tramp-get-remote-stat vec)
tramp-stat-marker tramp-stat-marker
......@@ -2639,10 +2635,9 @@ The method used must be an out-of-band method."
filename switches wildcard full-directory-p)
(when (stringp switches)
(setq switches (split-string switches)))
(when (tramp-get-ls-command-with-quoting-style v)
(when (tramp-get-ls-command-with v "--quoting-style=literal")
(setq switches (append switches '("--quoting-style=literal"))))
(when (and (member "--dired" switches)
(not (tramp-get-ls-command-with-dired v)))
(unless (tramp-get-ls-command-with v "--dired")
(setq switches (delete "--dired" switches)))
(when wildcard
(setq wildcard (tramp-run-real-handler
......@@ -5350,36 +5345,18 @@ Nonexistent directories are removed from spec."
(setq dl (cdr dl))))))
(tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))
(defun tramp-get-ls-command-with-dired (vec)
"Check, whether the remote `ls' command supports the --dired option."
(defun tramp-get-ls-command-with (vec option)
"Return OPTION, if the remote `ls' command supports the OPTION option."
(save-match-data
(with-tramp-connection-property vec "ls-dired"
(tramp-message vec 5 "Checking, whether `ls --dired' works")
(with-tramp-connection-property vec (concat "ls" option)
(tramp-message vec 5 "Checking, whether `ls %s' works" option)
;; Some "ls" versions are sensible wrt the order of arguments,
;; they fail when "-al" is after the "--dired" argument (for
;; example on FreeBSD).
(tramp-send-command-and-check
vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec))))))
(defun tramp-get-ls-command-with-quoting-style (vec)
"Check, whether the remote `ls' command supports the --quoting-style option."
(save-match-data
(with-tramp-connection-property vec "ls-quoting-style"
(tramp-message vec 5 "Checking, whether `ls --quoting-style=shell' works")
(tramp-send-command-and-check
vec (format "%s --quoting-style=shell -al /dev/null"
(tramp-get-ls-command vec))))))
(defun tramp-get-ls-command-with-w-option (vec)
"Check, whether the remote `ls' command supports the -w option."
(save-match-data
(with-tramp-connection-property vec "ls-w-option"
(tramp-message vec 5 "Checking, whether `ls -w' works")
;; Option "-w" is available on BSD systems. No argument is
;; given, because this could return wrong results in case "ls"
;; supports the "-w NUM" argument, as for busyboxes.
(tramp-send-command-and-check
vec (format "%s -alw" (tramp-get-ls-command vec))))))
(and
(tramp-send-command-and-check
vec (format "%s %s -al /dev/null" (tramp-get-ls-command vec) option))
option))))
(defun tramp-get-test-command (vec)
"Determine remote `test' command."
......
......@@ -133,6 +133,7 @@ call, letting the SMB client use the default one."
"NT_STATUS_CANNOT_DELETE"
"NT_STATUS_CONNECTION_DISCONNECTED"
"NT_STATUS_CONNECTION_REFUSED"
"NT_STATUS_CONNECTION_RESET"
"NT_STATUS_DIRECTORY_NOT_EMPTY"
"NT_STATUS_DUPLICATE_NAME"
"NT_STATUS_FILE_IS_A_DIRECTORY"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment