@@ -491,8 +491,8 @@ The string is used in `tramp-methods'.")
491
491
For every remote host, this variable will be set buffer local,
492
492
keeping the list of existing directories on that host.
493
493
494
- You can use `~' in this list, but when searching for a shell which groks
495
- tilde expansion, all directory names starting with `~' will be ignored.
494
+ You can use \"~\" in this list, but when searching for a shell which groks
495
+ tilde expansion, all directory names starting with \"~\" will be ignored.
496
496
497
497
`Default Directories' represent the list of directories given by
498
498
the command \"getconf PATH\". It is recommended to use this
@@ -3953,7 +3953,7 @@ hosts, or files, disagree."
3953
3953
First arg VEC specifies the connection, PROGNAME is the program
3954
3954
to search for, and DIRLIST gives the list of directories to
3955
3955
search. If IGNORE-TILDE is non-nil, directory names starting
3956
- with `~' will be ignored. If IGNORE-PATH is non-nil, searches
3956
+ with \"~\" will be ignored. If IGNORE-PATH is non-nil, searches
3957
3957
only in DIRLIST.
3958
3958
3959
3959
Returns the absolute file name of PROGNAME, if found, and nil otherwise.
@@ -4103,18 +4103,26 @@ file exists and nonzero exit status otherwise."
4103
4103
(with-tramp-progress-reporter
4104
4104
vec 5 (format-message "Opening remote shell `%s'" shell)
4105
4105
;; Find arguments for this shell.
4106
- (let ((extra-args (tramp-get-sh-extra-args shell)))
4106
+ (let ((extra-args (tramp-get-sh-extra-args shell))
4107
+ (p (tramp-get-connection-process vec)))
4107
4108
;; The readline library can disturb Tramp. For example, the
4108
4109
;; very recent version of libedit, the *BSD implementation of
4109
4110
;; readline, confuses Tramp. So we disable line editing. Since
4110
4111
;; $EDITRC is not supported on all target systems, we must move
4111
4112
;; ~/.editrc temporarily somewhere else. For bash and zsh we
4112
4113
;; have disabled this already during shell invocation, see
4113
- ;; `tramp-sh-extra-args'. Bug#39399.
4114
+ ;; `tramp-sh-extra-args' (Bug#39399).
4115
+ ;; The shell prompt might not be set yet, so we must read any
4116
+ ;; prompt via `tramp-barf-if-no-shell-prompt'.
4114
4117
(unless extra-args
4115
- (tramp-send-command vec "rm -f ~/.editrc.tramp" t)
4116
- (tramp-send-command vec "mv -f ~/.editrc ~/.editrc.tramp" t)
4117
- (tramp-send-command vec "echo 'edit off' >~/.editrc" t))
4118
+ (tramp-send-command vec "rm -f ~/.editrc.tramp" t t)
4119
+ (tramp-barf-if-no-shell-prompt p 10 "Couldn't find remote shell prompt")
4120
+ (tramp-send-command
4121
+ vec "test -e ~/.editrc && mv -f ~/.editrc ~/.editrc.tramp" t t)
4122
+ (tramp-barf-if-no-shell-prompt p 10 "Couldn't find remote shell prompt")
4123
+ (tramp-send-command vec "echo 'edit off' >~/.editrc" t t)
4124
+ (tramp-barf-if-no-shell-prompt
4125
+ p 10 "Couldn't find remote shell prompt"))
4118
4126
;; It is useful to set the prompt in the following command
4119
4127
;; because some people have a setting for $PS1 which /bin/sh
4120
4128
;; doesn't know about and thus /bin/sh will display a strange
@@ -4150,7 +4158,9 @@ file exists and nonzero exit status otherwise."
4150
4158
(tramp-shell-quote-argument tramp-end-of-output)
4151
4159
shell (or extra-args ""))
4152
4160
t)
4161
+ ;; Reset ~/.editrc.
4153
4162
(unless extra-args
4163
+ (tramp-send-command vec "rm -f ~/.editrc" t)
4154
4164
(tramp-send-command
4155
4165
vec "test -e ~/.editrc.tramp && mv -f ~/.editrc.tramp ~/.editrc" t))
4156
4166
;; Check proper HISTFILE setting. We give up when not working.
0 commit comments