aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/tramp-adb.el8
-rw-r--r--lisp/net/tramp-sh.el8
-rw-r--r--lisp/net/tramp-smb.el3
-rw-r--r--lisp/net/tramp.el30
4 files changed, 29 insertions, 20 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index b56ffdd7bc0..f0abb277965 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1156,8 +1156,7 @@ the exit status is not equal 0, and t otherwise."
1156 (format "%s; echo tramp_exit_status $?" command) 1156 (format "%s; echo tramp_exit_status $?" command)
1157 "echo tramp_exit_status $?")) 1157 "echo tramp_exit_status $?"))
1158 (with-current-buffer (tramp-get-connection-buffer vec) 1158 (with-current-buffer (tramp-get-connection-buffer vec)
1159 (goto-char (point-max)) 1159 (unless (tramp-search-regexp "tramp_exit_status [0-9]+")
1160 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
1161 (tramp-error 1160 (tramp-error
1162 vec 'file-error "Couldn't find exit status of `%s'" command)) 1161 vec 'file-error "Couldn't find exit status of `%s'" command))
1163 (skip-chars-forward "^ ") 1162 (skip-chars-forward "^ ")
@@ -1191,9 +1190,8 @@ FMT and ARGS are passed to `error'."
1191 (when (re-search-forward prompt (point-at-eol) t) 1190 (when (re-search-forward prompt (point-at-eol) t)
1192 (forward-line 1) 1191 (forward-line 1)
1193 (delete-region (point-min) (point))) 1192 (delete-region (point-min) (point)))
1194 (goto-char (point-max)) 1193 (when (tramp-search-regexp prompt)
1195 (re-search-backward prompt nil t) 1194 (delete-region (point) (point-max))))
1196 (delete-region (point) (point-max)))
1197 (if timeout 1195 (if timeout
1198 (tramp-error 1196 (tramp-error
1199 proc 'file-error 1197 proc 'file-error
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 8de88d355f9..506c33df466 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -5102,9 +5102,8 @@ function waits for output unless NOOUTPUT is set."
5102 (forward-line 1) 5102 (forward-line 1)
5103 (delete-region (point-min) (point))) 5103 (delete-region (point-min) (point)))
5104 ;; Delete the prompt. 5104 ;; Delete the prompt.
5105 (goto-char (point-max)) 5105 (when (tramp-search-regexp regexp)
5106 (re-search-backward regexp nil t) 5106 (delete-region (point) (point-max))))
5107 (delete-region (point) (point-max)))
5108 (if timeout 5107 (if timeout
5109 (tramp-error 5108 (tramp-error
5110 proc 'file-error 5109 proc 'file-error
@@ -5134,8 +5133,7 @@ DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
5134 "echo tramp_exit_status $?" 5133 "echo tramp_exit_status $?"
5135 (if subshell " )" ""))) 5134 (if subshell " )" "")))
5136 (with-current-buffer (tramp-get-connection-buffer vec) 5135 (with-current-buffer (tramp-get-connection-buffer vec)
5137 (goto-char (point-max)) 5136 (unless (tramp-search-regexp "tramp_exit_status [0-9]+")
5138 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
5139 (tramp-error 5137 (tramp-error
5140 vec 'file-error "Couldn't find exit status of `%s'" command)) 5138 vec 'file-error "Couldn't find exit status of `%s'" command))
5141 (skip-chars-forward "^ ") 5139 (skip-chars-forward "^ ")
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 38149da6643..1a4b63d2c79 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1451,11 +1451,10 @@ component is used as the target of the symlink."
1451 (process-put p 'adjust-window-size-function #'ignore) 1451 (process-put p 'adjust-window-size-function #'ignore)
1452 (set-process-query-on-exit-flag p nil) 1452 (set-process-query-on-exit-flag p nil)
1453 (tramp-process-actions p v nil tramp-smb-actions-set-acl) 1453 (tramp-process-actions p v nil tramp-smb-actions-set-acl)
1454 (goto-char (point-max))
1455 ;; This is meant for traces, and returning from the 1454 ;; This is meant for traces, and returning from the
1456 ;; function. No error is propagated outside, due to 1455 ;; function. No error is propagated outside, due to
1457 ;; the `ignore-errors' closure. 1456 ;; the `ignore-errors' closure.
1458 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t) 1457 (unless (tramp-search-regexp "tramp_exit_status [0-9]+")
1459 (tramp-error 1458 (tramp-error
1460 v 'file-error 1459 v 'file-error
1461 "Couldn't find exit status of `%s'" tramp-smb-acl-program)) 1460 "Couldn't find exit status of `%s'" tramp-smb-acl-program))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e344990f7fc..f419aecbe77 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4163,19 +4163,35 @@ for process communication also."
4163 (buffer-string)) 4163 (buffer-string))
4164 result))) 4164 result)))
4165 4165
4166(defun tramp-search-regexp (regexp)
4167 "Search for REGEXP backwards, starting at point-max.
4168If found, set point to the end of the occurrence found, and return point.
4169Otherwise, return nil."
4170 (goto-char (point-max))
4171 ;; We restrict ourselves to the last 256 characters. There were
4172 ;; reports of 85kB output, which has blocked Tramp forever.
4173 (re-search-backward regexp (max (point-min) (- (point) 256)) 'noerror))
4174
4166(defun tramp-check-for-regexp (proc regexp) 4175(defun tramp-check-for-regexp (proc regexp)
4167 "Check, whether REGEXP is contained in process buffer of PROC. 4176 "Check, whether REGEXP is contained in process buffer of PROC.
4168Erase echoed commands if exists." 4177Erase echoed commands if exists."
4169 (with-current-buffer (process-buffer proc) 4178 (with-current-buffer (process-buffer proc)
4170 (goto-char (point-min)) 4179 (goto-char (point-min))
4171 4180
4172 ;; Check whether we need to remove echo output. 4181 ;; Check whether we need to remove echo output. The max length of
4182 ;; the echo mark regexp is taken for search. We restrict the
4183 ;; search for the second echo mark to PIPE_BUF characters.
4173 (when (and (tramp-get-connection-property proc "check-remote-echo" nil) 4184 (when (and (tramp-get-connection-property proc "check-remote-echo" nil)
4174 (re-search-forward tramp-echoed-echo-mark-regexp nil t)) 4185 (re-search-forward
4186 tramp-echoed-echo-mark-regexp
4187 (+ (point) (* 5 tramp-echo-mark-marker-length)) t))
4175 (let ((begin (match-beginning 0))) 4188 (let ((begin (match-beginning 0)))
4176 (when (re-search-forward tramp-echoed-echo-mark-regexp nil t) 4189 (when
4190 (re-search-forward
4191 tramp-echoed-echo-mark-regexp
4192 (+ (point) (tramp-get-connection-property proc "pipe-buf" 4096)) t)
4177 ;; Discard echo from remote output. 4193 ;; Discard echo from remote output.
4178 (tramp-set-connection-property proc "check-remote-echo" nil) 4194 (tramp-flush-connection-property proc "check-remote-echo")
4179 (tramp-message proc 5 "echo-mark found") 4195 (tramp-message proc 5 "echo-mark found")
4180 (forward-line 1) 4196 (forward-line 1)
4181 (delete-region begin (point)) 4197 (delete-region begin (point))
@@ -4196,8 +4212,7 @@ Erase echoed commands if exists."
4196 ;; overflow in regexp matcher". For example, //DIRED// lines of 4212 ;; overflow in regexp matcher". For example, //DIRED// lines of
4197 ;; directory listings with some thousand files. Therefore, we 4213 ;; directory listings with some thousand files. Therefore, we
4198 ;; look from the end. 4214 ;; look from the end.
4199 (goto-char (point-max)) 4215 (tramp-search-regexp regexp))))
4200 (ignore-errors (re-search-backward regexp nil t)))))
4201 4216
4202(defun tramp-wait-for-regexp (proc timeout regexp) 4217(defun tramp-wait-for-regexp (proc timeout regexp)
4203 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds. 4218 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds.
@@ -4285,8 +4300,7 @@ the remote host use line-endings as defined in the variable
4285 (tramp-flush-connection-properties proc) 4300 (tramp-flush-connection-properties proc)
4286 (tramp-flush-directory-properties vec "")) 4301 (tramp-flush-directory-properties vec ""))
4287 (with-current-buffer (process-buffer proc) 4302 (with-current-buffer (process-buffer proc)
4288 (goto-char (point-max)) 4303 (when (and prompt (tramp-search-regexp (regexp-quote prompt)))
4289 (when (and prompt (re-search-backward (regexp-quote prompt) nil t))
4290 (delete-region (point) (point-max))))))) 4304 (delete-region (point) (point-max)))))))
4291 4305
4292(defun tramp-get-inode (vec) 4306(defun tramp-get-inode (vec)