From: Shuguang Sun <shuguang79@qq.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 34943@debbugs.gnu.org
Subject: bug#34943: 27.0.50; Tramp explicte-shell-file-name not work and not safe local variable
Date: Sat, 23 Mar 2019 12:13:52 +0800 [thread overview]
Message-ID: <49984.3619576254$1553314703@news.gmane.org> (raw)
In-Reply-To: <87tvfvatfn.fsf@gmx.de> (Michael Albinus's message of "Fri, 22 Mar 2019 15:13:16 +0100")
Michael Albinus <michael.albinus@gmx.de> writes:
> Shuguang Sun <shuguang79@qq.com> writes:
>
>> Hi,
>
>> The recent change to Tramp for shell/explict shell has break the remote shell again. For example:
>> - Tramp to a host
>> - in a remote diretory, M-x shell
>> it raise the error message: env path/to/cmdproxy.exe can't be found
>> which looks tramp shell invoke the local shell, instead the remote shell
>>
>> I have the settings:
>> ```
>> (connection-local-set-profile-variables
>> 'remote-bash
>> '((explicit-shell-file-name . "/bin/bash")
>> (explicit-bash-args . ("-i"))
>> ))
>>
>> (connection-local-set-profiles
>> '(:application tramp :protocol "plink" :user "user" :machine "host.com")
>> 'remote-bash)
>> ```
>> In the previous version of tramp (about Feb), it will invoke the explicit-shell-file-name, instead of local cmdproxy.
>
> If `explicit-shell-file-name' is given, it must have precedence. What
> about the following patch to master:
>
> *** /tmp/ediffWyfTux 2019-03-22 15:09:52.065151959 +0100
> --- /home/albinus/src/emacs/lisp/shell.el 2019-03-22 15:09:35.080867417 +0100
> ***************
> *** 721,729 ****
> (current-buffer)))
>
> (with-current-buffer buffer
> ! (when (file-remote-p default-directory)
> ! ;; On remote hosts, the local `shell-file-name' might be useless.
> ! (with-connection-local-variables
> (if (and (called-interactively-p 'any)
> (null explicit-shell-file-name)
> (null (getenv "ESHELL")))
> --- 721,729 ----
> (current-buffer)))
>
> (with-current-buffer buffer
> ! (with-connection-local-variables
> ! ;; On remote hosts, the local `shell-file-name' might be useless.
> ! (when (file-remote-p default-directory)
> (if (and (called-interactively-p 'any)
> (null explicit-shell-file-name)
> (null (getenv "ESHELL")))
> ***************
> *** 732,757 ****
> (expand-file-name
> (read-file-name
> "Remote shell path: " default-directory shell-file-name
> ! t shell-file-name))))))))
>
> ! ;; The buffer's window must be correctly set when we call comint
> ! ;; (so that comint sets the COLUMNS env var properly).
> ! (pop-to-buffer buffer)
> ! ;; Rain or shine, BUFFER must be current by now.
> ! (unless (comint-check-proc buffer)
> ! (let* ((prog (or explicit-shell-file-name
> ! (getenv "ESHELL") shell-file-name))
> ! (name (file-name-nondirectory prog))
> ! (startfile (concat "~/.emacs_" name))
> ! (xargs-name (intern-soft (concat "explicit-" name "-args"))))
> ! (unless (file-exists-p startfile)
> ! (setq startfile (concat user-emacs-directory "init_" name ".sh")))
> ! (apply #'make-comint-in-buffer "shell" buffer prog
> ! (if (file-exists-p startfile) startfile)
> ! (if (and xargs-name (boundp xargs-name))
> ! (symbol-value xargs-name)
> ! '("-i")))
> ! (shell-mode)))
> buffer)
>
> ;;; Directory tracking
> --- 732,757 ----
> (expand-file-name
> (read-file-name
> "Remote shell path: " default-directory shell-file-name
> ! t shell-file-name))))))
>
> ! ;; The buffer's window must be correctly set when we call comint
> ! ;; (so that comint sets the COLUMNS env var properly).
> ! (pop-to-buffer buffer)
> ! ;; Rain or shine, BUFFER must be current by now.
> ! (unless (comint-check-proc buffer)
> ! (let* ((prog (or explicit-shell-file-name
> ! (getenv "ESHELL") shell-file-name))
> ! (name (file-name-nondirectory prog))
> ! (startfile (concat "~/.emacs_" name))
> ! (xargs-name (intern-soft (concat "explicit-" name "-args"))))
> ! (unless (file-exists-p startfile)
> ! (setq startfile (concat user-emacs-directory "init_" name ".sh")))
> ! (apply #'make-comint-in-buffer "shell" buffer prog
> ! (if (file-exists-p startfile) startfile)
> ! (if (and xargs-name (boundp xargs-name))
> ! (symbol-value xargs-name)
> ! '("-i")))
> ! (shell-mode)))))
> buffer)
>
> ;;; Directory tracking
>
The patch works. Thanks.
>
>> Another issue, the emacs treat explicit-shell-file-name and explicit-bash-args
>> as non-safe local variables and ask how to deal it (Y/N/! ...).
>> In the previous version of tramp (about Feb), it takes these two variables as
>> safe which I think is reasonable because user sets it in tramp-way explicitely
>> and it is only used in tramp only.
>
> I'll check when the first problem is solved.
FYI. explicit-shell-file-name and explicit-bash-args are still non-safe local variables now.
>
> Best regards, Michael.
>
--
Best Regards
Shuguang Sun
next prev parent reply other threads:[~2019-03-23 4:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 6:17 bug#34943: 27.0.50; Tramp explicte-shell-file-name not work and not safe local variable Shuguang Sun
2019-03-22 7:16 ` Shuguang Sun
2019-03-22 7:56 ` Shuguang Sun
2019-03-22 14:14 ` Michael Albinus
2019-03-22 14:13 ` Michael Albinus
2019-03-23 4:13 ` Shuguang Sun [this message]
[not found] ` <vk5ybm229qin.fsf@qq.com>
2019-03-23 8:59 ` Michael Albinus
2019-03-23 15:41 ` Shuguang Sun
2019-03-24 12:42 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='49984.3619576254$1553314703@news.gmane.org' \
--to=shuguang79@qq.com \
--cc=34943@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.