GNU bug report logs - #34943
27.0.50; Tramp explicte-shell-file-name not work and not safe local variable

Previous Next

Package: emacs;

Reported by: Shuguang Sun <shuguang79 <at> qq.com>

Date: Fri, 22 Mar 2019 06:35:01 UTC

Severity: normal

Tags: fixed

Found in version 27.0.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34943 in the body.
You can then email your comments to 34943 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 06:35:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Shuguang Sun <shuguang79 <at> qq.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 22 Mar 2019 06:35:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Fri, 22 Mar 2019 14:17:25 +0800
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.

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.


In GNU Emacs 27.0.50 (build 3, x86_64-w64-mingw32)
 of 2019-03-21 built on RSHMX11052
Repository revision: c569cceb2d334564d320d2b4098c855db7eb88a0
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.15063
System Description: Microsoft Windows 10 Enterprise (v10.0.1703.15063.1631)

Recent messages:
Wrote c:/Users/user/HOME/.emacs [2 times]
Tramp: Opening connection for user <at> host.com using plink...done
Opening directory /plink:user <at> host.com:/opt/bee/home_NEW/user/...done
Tramp: Opening connection for user <at> host.com using plink...
Tramp: Sending command `plink -l user  -ssh -t host.com " env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=#$ ' /bin/sh " && exit || exit'
Tramp: Waiting for prompts from remote shell...
Tramp: Sending password
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on `host.com'
Tramp: Opening connection for user <at> host.com using plink...done

Configured using:
 'configure --without-imagemagick --without-pop
 '--program-transform-name=s/^ctags$/ctags.emacs/''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
ZLIB TOOLKIT_SCROLL_BARS THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: CHS
  locale-coding-system: cp936






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 07:32:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Fri, 22 Mar 2019 15:16:13 +0800
I see that according to the 49.2.6 Per-Connection Local Variables, it use shell-file-name now.

Sorry to disturbance.


-- 
Best Regards
Shuguang Sun






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 07:58:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Fri, 22 Mar 2019 15:56:55 +0800

Shuguang Sun <shuguang79 <at> qq.com> writes:
> I see that according to the 49.2.6 Per-Connection Local Variables, it use shell-file-name now.

1. shell-file-name to "/bin/bash" defaultly not safey local variables, and it pops to (Y/N/!) buffer
```
  (connection-local-set-profile-variables   'remote-bash
   '((shell-file-name . "/bin/bash")
     (shell-command-switch . "-c")))
```
2. In this setting, M-x shell whill ask the path to the shell like:
/plink:username <at> host.com:/opt/home/username//bin/bash
Even I change to (shell-file-name . "/usr/bin/bash"), it is the same. Bothe /bin/bash and /usr/bin/bash exist.



-- 
Best Regards
Shuguang Sun






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 14:14:02 GMT) Full text and rfc822 format available.

Message #14 received at 34943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 34943 <at> debbugs.gnu.org
Subject: Re: bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Fri, 22 Mar 2019 15:13:16 +0100
[Message part 1 (text/plain, inline)]
Shuguang Sun <shuguang79 <at> 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:

[Message part 2 (text/x-diff, inline)]
*** /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
[Message part 3 (text/plain, inline)]
> 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.

Best regards, Michael.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 14:16:01 GMT) Full text and rfc822 format available.

Message #17 received at 34943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 34943 <at> debbugs.gnu.org
Subject: Re: bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Fri, 22 Mar 2019 15:14:47 +0100
Shuguang Sun <shuguang79 <at> qq.com> writes:

Hi,

> I see that according to the 49.2.6 Per-Connection Local Variables, it
> use shell-file-name now.

This manual section explains how to set shell-file-name. But
explicit-shell-file-name shall still work as it happens until recently.

> Sorry to disturbance.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 15:10:02 GMT) Full text and rfc822 format available.

Message #20 received at 34943 <at> debbugs.gnu.org (full text, mbox):

From: Chris Zheng <chriszheng99 <at> gmail.com>
To: 34943 <at> debbugs.gnu.org
Cc: Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#34943: 27.0.50;
Date: Fri, 22 Mar 2019 23:09:28 +0800
Hello Michael,

The patch works for me. I am running Emacs under MS-Windows and try to
connect to a GNU/Linux box.

Thank you,

Chris




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Fri, 22 Mar 2019 15:36:02 GMT) Full text and rfc822 format available.

Message #23 received at 34943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Chris Zheng <chriszheng99 <at> gmail.com>
Cc: 34943 <at> debbugs.gnu.org
Subject: Re: bug#34943: 27.0.50;
Date: Fri, 22 Mar 2019 16:35:49 +0100
Chris Zheng <chriszheng99 <at> gmail.com> writes:

> Hello Michael,

Hi Chris,

> The patch works for me. I am running Emacs under MS-Windows and try to
> connect to a GNU/Linux box.

Thanks for testing! I'm waiting for the confirmation of the OP, then
I'll push.

> Thank you,
>
> Chris

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Sat, 23 Mar 2019 04:18:01 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 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
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Shuguang Sun <shuguang79 <at> 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






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Sat, 23 Mar 2019 09:00:03 GMT) Full text and rfc822 format available.

Message #29 received at 34943 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 34943 <at> debbugs.gnu.org
Subject: Re: bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Sat, 23 Mar 2019 09:59:42 +0100
Shuguang Sun <shuguang79 <at> qq.com> writes:

[Pls Cc 34943 <at> debbugs.gnu.org, and NOT bug-gnu-emacs <at> gnu.org]

Hi,

> The patch works. Thanks.

Thanks for checking.

>>> 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.

This shall be fixed now as well. Could you, pls, confirm?

Everything pushed to master.

Best regards, Michael.




Added tag(s) fixed. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Sat, 23 Mar 2019 09:01:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34943; Package emacs. (Sat, 23 Mar 2019 15:43:01 GMT) Full text and rfc822 format available.

Message #34 received at 34943 <at> debbugs.gnu.org (full text, mbox):

From: "Shuguang Sun" <shuguang79 <at> qq.com>
To: "Michael Albinus" <michael.albinus <at> gmx.de>
Cc: 34943 <34943 <at> debbugs.gnu.org>
Subject: Re:  bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Sat, 23 Mar 2019 23:41:48 +0800
[Message part 1 (text/plain, inline)]
It is fixed. Thanks.




------------------ Original ------------------
From:  "Michael Albinus"<michael.albinus <at> gmx.de>;



> [Pls Cc 34943 <at> debbugs.gnu.org, and NOT bug-gnu-emacs <at> gnu.org]



Thanks for the reminder.
[Message part 2 (text/html, inline)]

Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sun, 24 Mar 2019 12:43:02 GMT) Full text and rfc822 format available.

Notification sent to Shuguang Sun <shuguang79 <at> qq.com>:
bug acknowledged by developer. (Sun, 24 Mar 2019 12:43:02 GMT) Full text and rfc822 format available.

Message #39 received at 34943-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: "Shuguang Sun" <shuguang79 <at> qq.com>
Cc: 34943 <34943-done <at> debbugs.gnu.org>
Subject: Re: bug#34943: 27.0.50;
 Tramp explicte-shell-file-name not work and not safe local variable
Date: Sun, 24 Mar 2019 13:42:37 +0100
"Shuguang Sun" <shuguang79 <at> qq.com> writes:

> It is fixed. Thanks.

Thanks for checking, I'm closing the bug.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Apr 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.