aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2016-10-24 15:04:25 +0200
committerMichael Albinus2016-10-24 15:04:25 +0200
commit31219927a9b2c5ef2f702bda245ffc306be7b1a2 (patch)
tree28a5223e953615f22cf21011d47510e373b2e607
parent7bb5c4f206bfbe46b5f4a376633437f8999d956a (diff)
downloademacs-31219927a9b2c5ef2f702bda245ffc306be7b1a2.tar.gz
emacs-31219927a9b2c5ef2f702bda245ffc306be7b1a2.zip
Fix Bug#24478
* lisp/net/tramp-sh.el (tramp-histfile-override): Change default value to "~/.tramp_history". (tramp-open-shell): Check proper HISTFILE setting. (tramp-maybe-open-connection): Cleanup also for errors. (Bug#24478)
-rw-r--r--lisp/net/tramp-sh.el32
1 files changed, 21 insertions, 11 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 166bc881676..2983d402fa3 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -67,19 +67,18 @@ files conditionalize this setup based on the TERM environment variable."
67 :type 'string) 67 :type 'string)
68 68
69;;;###tramp-autoload 69;;;###tramp-autoload
70(defcustom tramp-histfile-override ".tramp_history" 70(defcustom tramp-histfile-override "~/.tramp_history"
71 "When invoking a shell, override the HISTFILE with this value. 71 "When invoking a shell, override the HISTFILE with this value.
72When setting to a string, it redirects the shell history to that 72When setting to a string, it redirects the shell history to that
73file. Be careful when setting to \"/dev/null\"; this might 73file. Be careful when setting to \"/dev/null\"; this might
74result in undesired results when using \"bash\" as shell. 74result in undesired results when using \"bash\" as shell.
75 75
76The value t, the default value, unsets any setting of HISTFILE, 76The value t unsets any setting of HISTFILE, and sets both
77and sets both HISTFILESIZE and HISTSIZE to 0. If you set this 77HISTFILESIZE and HISTSIZE to 0. If you set this variable to nil,
78variable to nil, however, the *override* is disabled, so the 78however, the *override* is disabled, so the history will go to
79history will go to the default storage location, 79the default storage location, e.g. \"$HOME/.sh_history\"."
80e.g. \"$HOME/.sh_history\"."
81 :group 'tramp 80 :group 'tramp
82 :version "25.1" 81 :version "25.2"
83 :type '(choice (const :tag "Do not override HISTFILE" nil) 82 :type '(choice (const :tag "Do not override HISTFILE" nil)
84 (const :tag "Unset HISTFILE" t) 83 (const :tag "Unset HISTFILE" t)
85 (string :tag "Redirect to a file"))) 84 (string :tag "Redirect to a file")))
@@ -4117,7 +4116,19 @@ file exists and nonzero exit status otherwise."
4117 "")) 4116 ""))
4118 (tramp-shell-quote-argument tramp-end-of-output) 4117 (tramp-shell-quote-argument tramp-end-of-output)
4119 shell (or extra-args "")) 4118 shell (or extra-args ""))
4120 t)) 4119 t)
4120 ;; Check proper HISTFILE setting. We give up when not working.
4121 (when (and (stringp tramp-histfile-override)
4122 (file-name-directory tramp-histfile-override))
4123 (tramp-barf-unless-okay
4124 vec
4125 (format
4126 "(cd %s)"
4127 (tramp-shell-quote-argument
4128 (file-name-directory tramp-histfile-override)))
4129 "`tramp-histfile-override' uses invalid file `%s'"
4130 tramp-histfile-override)))
4131
4121 (tramp-set-connection-property 4132 (tramp-set-connection-property
4122 (tramp-get-connection-process vec) "remote-shell" shell))) 4133 (tramp-get-connection-process vec) "remote-shell" shell)))
4123 4134
@@ -5057,10 +5068,9 @@ connection if a previous connection has died for some reason."
5057 ;; Mark it as connected. 5068 ;; Mark it as connected.
5058 (tramp-set-connection-property p "connected" t))))) 5069 (tramp-set-connection-property p "connected" t)))))
5059 5070
5060 ;; When the user did interrupt, we must cleanup. 5071 ;; Cleanup, and propagate the signal.
5061 (quit 5072 ((error quit)
5062 (tramp-cleanup-connection vec t) 5073 (tramp-cleanup-connection vec t)
5063 ;; Propagate the quit signal.
5064 (signal (car err) (cdr err)))))) 5074 (signal (car err) (cdr err))))))
5065 5075
5066(defun tramp-send-command (vec command &optional neveropen nooutput) 5076(defun tramp-send-command (vec command &optional neveropen nooutput)