emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 3121992: Fix Bug#24478


From: Michael Albinus
Subject: [Emacs-diffs] emacs-25 3121992: Fix Bug#24478
Date: Mon, 24 Oct 2016 13:04:37 +0000 (UTC)

branch: emacs-25
commit 31219927a9b2c5ef2f702bda245ffc306be7b1a2
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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)
---
 lisp/net/tramp-sh.el |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 166bc88..2983d40 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."
   :type 'string)
 
 ;;;###tramp-autoload
-(defcustom tramp-histfile-override ".tramp_history"
+(defcustom tramp-histfile-override "~/.tramp_history"
   "When invoking a shell, override the HISTFILE with this value.
 When setting to a string, it redirects the shell history to that
 file.  Be careful when setting to \"/dev/null\"; this might
 result in undesired results when using \"bash\" as shell.
 
-The value t, the default value, unsets any setting of HISTFILE,
-and sets both HISTFILESIZE and HISTSIZE to 0.  If you set this
-variable to nil, however, the *override* is disabled, so the
-history will go to the default storage location,
-e.g. \"$HOME/.sh_history\"."
+The value t unsets any setting of HISTFILE, and sets both
+HISTFILESIZE and HISTSIZE to 0.  If you set this variable to nil,
+however, the *override* is disabled, so the history will go to
+the default storage location, e.g. \"$HOME/.sh_history\"."
   :group 'tramp
-  :version "25.1"
+  :version "25.2"
   :type '(choice (const :tag "Do not override HISTFILE" nil)
                  (const :tag "Unset HISTFILE" t)
                  (string :tag "Redirect to a file")))
@@ -4117,7 +4116,19 @@ file exists and nonzero exit status otherwise."
                ""))
            (tramp-shell-quote-argument tramp-end-of-output)
            shell (or extra-args ""))
-       t))
+       t)
+      ;; Check proper HISTFILE setting.  We give up when not working.
+      (when (and (stringp tramp-histfile-override)
+                (file-name-directory tramp-histfile-override))
+       (tramp-barf-unless-okay
+        vec
+        (format
+         "(cd %s)"
+         (tramp-shell-quote-argument
+          (file-name-directory tramp-histfile-override)))
+        "`tramp-histfile-override' uses invalid file `%s'"
+        tramp-histfile-override)))
+
     (tramp-set-connection-property
      (tramp-get-connection-process vec) "remote-shell" shell)))
 
@@ -5057,10 +5068,9 @@ connection if a previous connection has died for some 
reason."
                ;; Mark it as connected.
                (tramp-set-connection-property p "connected" t)))))
 
-      ;; When the user did interrupt, we must cleanup.
-      (quit
+      ;; Cleanup, and propagate the signal.
+      ((error quit)
        (tramp-cleanup-connection vec t)
-       ;; Propagate the quit signal.
        (signal (car err) (cdr err))))))
 
 (defun tramp-send-command (vec command &optional neveropen nooutput)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]