From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Shuguang Sun Newsgroups: gmane.emacs.bugs 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 Message-ID: <49984.3619576254$1553314703@news.gmane.org> References: <41148.0504948244$1553236696@news.gmane.org> <87tvfvatfn.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="17638"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) Cc: 34943@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 23 05:18:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h7Y6r-0004St-TO for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Mar 2019 05:18:18 +0100 Original-Received: from localhost ([127.0.0.1]:38418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7Y6q-0007pc-Bq for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Mar 2019 00:18:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7Y6d-0007pJ-MN for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:18:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7Y6c-0002pW-8l for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:18:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h7Y6c-0002ow-00 for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h7Y6b-00031e-NU for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Shuguang Sun Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Mar 2019 04:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34943 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.155331465911598 (code B ref -1); Sat, 23 Mar 2019 04:18:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Mar 2019 04:17:39 +0000 Original-Received: from localhost ([127.0.0.1]:54906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7Y6F-00030z-0g for submit@debbugs.gnu.org; Sat, 23 Mar 2019 00:17:39 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7Y6C-00030m-S8 for submit@debbugs.gnu.org; Sat, 23 Mar 2019 00:17:37 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7Y67-00025T-KR for submit@debbugs.gnu.org; Sat, 23 Mar 2019 00:17:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7Y66-0007o6-4B for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:17:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7Y2N-0005lr-5r for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:13:40 -0400 Original-Received: from smtpbgsg2.qq.com ([54.254.200.128]:34178) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7Y2L-0005l9-UK for bug-gnu-emacs@gnu.org; Sat, 23 Mar 2019 00:13:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1553314409; bh=A+DJr12zrSFirLRd5yOuHenafjRjEiVbRdCU034xJJ0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:MIME-Version:Content-Type; b=RDVLSeD79XHctGDR+Hfegod1iWAZVMFGgmgOf5nKbuu4cXXLM4hDsd/ds7yCiTEOg wYJ/u0DNRUOnOjstIrt9LtVTu5WfOZ5RqzEgs7xc1AK/oyActa1fhVutrXzOBdSKDW PbzBbh25enQHgT6KPoasUy6urnoYJUpl30szrBr8= X-QQ-mid: esmtp2t1553314407thiy8ques Original-Received: from rshmx11052 (unknown [211.144.221.1]) by esmtp4.qq.com (ESMTP) with id ; Sat, 23 Mar 2019 12:13:26 +0800 (CST) X-QQ-SSF: 01000000000000F0F5200F00000000G X-QQ-FEAT: qYS6qym2pYdYn3eXAkRGi8jjQ4CJisb5bHqwV3pB1FiDIbxhd/t1qHApF6Hhi kkeGAHW8mRmyAW8BIFZ1uOgRpkbL5I1WB35uSFy+Dbm1op0dyyovGda/yrZSmSzoEDlESI0 lPtyk+w/Y3cnTc6APdXS+CE7IqWYW3QSJbCN35oUtjRY6xuI2lKENrYzRAaER5kEHMnKdDz nJfHeEitW+dkLKzavJsSZjezFUNO8gGBTfkK8wZlQIBxayG8inNjrWZh5emjPee328XyRk4 vGoY5LDg1QmFI6SeRi5pKLlj5VwGcZd74t6RP11aHBIZ+W X-QQ-GoodBg: 0 In-Reply-To: <87tvfvatfn.fsf@gmx.de> (Michael Albinus's message of "Fri, 22 Mar 2019 15:13:16 +0100") X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:qq.com:bgforeign:bgforeign2 X-QQ-Bgrelay: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156644 Archived-At: Michael Albinus writes: > Shuguang Sun 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