From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Shuguang Sun Newsgroups: gmane.emacs.bugs Subject: bug#29149: Tramp shell uses local shell setting in windows Date: Sun, 5 Nov 2017 12:10:08 +0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11482a267baf55055d3483be" X-Trace: blaine.gmane.org 1509855075 9081 195.159.176.226 (5 Nov 2017 04:11:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Nov 2017 04:11:15 +0000 (UTC) To: 29149@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 05 05:11:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBCH4-0001jn-J7 for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Nov 2017 05:11:06 +0100 Original-Received: from localhost ([::1]:42918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBCH9-0005Yt-VY for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Nov 2017 00:11:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBCH1-0005Yl-Ty for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:11:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBCH0-0006TF-95 for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:11:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBCH0-0006Sr-4y for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eBCGz-0002Rh-TO for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:11: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: Sun, 05 Nov 2017 04:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29149 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15098550229355 (code B ref -1); Sun, 05 Nov 2017 04:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Nov 2017 04:10:22 +0000 Original-Received: from localhost ([127.0.0.1]:51109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBCGM-0002Qn-EJ for submit@debbugs.gnu.org; Sun, 05 Nov 2017 00:10:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBCGK-0002Qb-Vt for submit@debbugs.gnu.org; Sun, 05 Nov 2017 00:10:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBCGE-000612-5K for submit@debbugs.gnu.org; Sun, 05 Nov 2017 00:10:15 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eBCGD-0005zz-Rw for submit@debbugs.gnu.org; Sun, 05 Nov 2017 00:10:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBCGC-0005SQ-1N for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:10:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBCGA-0005yB-12 for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:10:11 -0400 Original-Received: from mail-qt0-x22a.google.com ([2607:f8b0:400d:c0d::22a]:50688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBCG9-0005xt-Qi for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 00:10:09 -0400 Original-Received: by mail-qt0-x22a.google.com with SMTP id d9so7456508qtd.7 for ; Sat, 04 Nov 2017 21:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=EaW+tvpri68y6CrDbyMJYqoEkBs+gSQ0I65Oj/XdqDY=; b=HSReuqKsUA1nzj7Rp+WgySwZ9+KVffy7/kFaf1DcnUHJbO+DlWax+SrAhfmNI/z/cO ECWmSA0+xaY5HRdbi4RNDu8VjAt5toVa/zRD3d2ORoBFzluwEXrzdGMSvYXsKCjjHPdO HOOCasL5tKDWQ8GCkekYZK9HLY1rgiLieo40gSx/5bGVw9aU0fcYZdISml+Zsx8Rx72J 7a3x6DxN+bC+pFkTK5LcOhYcUXDXvwgW3bCAdDhMouFJARXiGSmPHhi/tpzwr/f9unH0 OjF7LHr20pARASG1xdSU4pDmanZ8OjHmawtBmndAIlSb5YjSAjJwEPOMzBBdC32PiPXb GlNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=EaW+tvpri68y6CrDbyMJYqoEkBs+gSQ0I65Oj/XdqDY=; b=aMaX21XIjSmpXCoiDwUZhEFwOfddAhrMECaOhDSN01pLVEfMAxpWjnGJ1CgWItgHBI O/w5azVQNnC+b4FAReG2g76XFUyBnAztgd4DXyFd2GsBxUcvwhKe5GjLue2UbRR/+2Zq WnvkzJByGeMLqzjSKBN85Eh47pDEGVuK6ggoDlxMBHBCMymDRl3JlTA0h5/EiWjMHltm FCCk5zrF1fZgNkdUVAaDYOeM5+L1yXaQkNQvJhEi/Hj0x3VOiHnuBWYLFRUgle+5KpPd jCp4At+JhtFkzArcOrpCHgHLbMu1SBiYHNk0AjfyWEp8VRfM00e6W0jker9C2JLwNiAO cG2Q== X-Gm-Message-State: AMCzsaVV30TFyxtw1QQNlqp4e0JU+qP0Qal30vkkU/9CpNQXnIbk4XxW cIjBKJrtz79ztoy+F7xjsdqcu5IVcKJSsAYNLgI1Cw== X-Google-Smtp-Source: ABhQp+RbsK83aO8Zpyof/sVQVMzyRImyICHiV+Sc9lycc8+ZGYHTUMr2dv0yeATfplQcC/3LIkA7jMaqgokT/nxtp7w= X-Received: by 10.200.25.171 with SMTP id u40mr17443384qtj.297.1509855009155; Sat, 04 Nov 2017 21:10:09 -0700 (PDT) Original-Received: by 10.237.52.37 with HTTP; Sat, 4 Nov 2017 21:10:08 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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: 208.118.235.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:139457 Archived-At: --001a11482a267baf55055d3483be Content-Type: text/plain; charset="UTF-8" Hi, The tramp shell uses local shell setting (explicit-shell-file-name and shell-file-name) in Windows. However, according to the documents, for example, in tramp-handle-shell-command: ;; We cannot use `shell-file-name' and `shell-command-switch', ;; they are variables of the local host. Instead, it uses the arguments tramp-remote-shell and tramp-remote-shell-args from the variable tramp-methods. Windows7, GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-10-21 explicit-shell-file-name = nil shell-file-name = "C:/Users/username/emacs/libexec/emacs/27.0.50/x86_64-w64-mingw32/cmdproxy.exe" - Problem 1: tramp and dired-do-shell-command: start: Unknown job: /b Why "start /b" is called remote side? When I run tramp (plink) and go to a remote buffer (dired mode), run dired-do-shell-command (!) on marked file (for example, /opt/bin/R CMD BATCH * &). It popup the buffer of * Async Shell Command *, and the command is not run but a message "start: Unknown job: /b" which looks it runs the windows-like command "start /b ..." on the remote shell. A test without "&" (non-ascync): 11:07:06.340383 tramp-handle-insert-directory (0) # Opening directory /plink:user@host:/opt/user/test/...done 11:07:35.748442 tramp-send-command (6) # ( cd /opt/user/test/ && /bin/sh -c start\ /b\ /opt/bin/R\ CMD\ BATCH\ --no-restore\ --no-save\ \"coxph.r\" /dev/null; echo tramp_exit_status $? I have set ido-mode or icomplete-mode to nil. The only tramp setting I used: (push '("plink" (tramp-login-program "plink") (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-args ("-c")) (tramp-copy-program "pscp") (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k") ("-q") ("-r"))) (tramp-copy-keep-date t) (tramp-copy-recursive t) (tramp-default-port 22)) tramp-methods) Best Regards, Shuguang Sun --001a11482a267baf55055d3483be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

The tramp shell use= s local shell setting (explicit-shell-file-name and shell-file-name) in Win= dows. However, according to the documents, for example, in tramp-handle-she= ll-command:
;; We cannot use `shell-file-name' and `shell-com= mand-switch',
;; they are variables of the local host.
Instead, i= t uses the arguments tramp-remote-shell and tramp-remote-shell-args from th= e variable tramp-methods.

Windows7,
=
GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-10-21
explicit-shell-file-name =3D nil
shell-file-name =3D "C:/U= sers/username/emacs/libexec/emacs/27.0.50/x86_64-w64-mingw32/cmdproxy.exe&q= uot;

- Problem 1: tramp and dired-do-shell-com= mand:=C2=A0 start: Unknown job: /b
Why "start /b" i= s called remote side?

When I run tramp (plink) and go to a remote buffer (dired mode), run=20 dired-do-shell-command (!) on marked file (for example, /opt/bin/R CMD BATC= H *=20 &). It popup the buffer of * Async Shell Command *, and the command=20 is not run but a message "start: Unknown job: /b" which looks it = runs=20 the windows-like command "start /b ..." on the remote shell.
=

A test without "&" (non-= ascync):
11:07:06.340383 tramp-handle-insert-directory (0) # = Opening directory /plink:user@host:/opt/user/test/...done
11:07:35.74844= 2 tramp-send-command (6) # ( cd /opt/user/test/ && /bin/sh -c start= \ /b\ /opt/bin/R\ CMD\ BATCH\ --no-restore\ --no-save\ \"coxph.r\"= ; </dev/null; echo tramp_exit_status $? )
11:07:36.033413 tramp-wait-= for-regexp (6) #
start: invalid option: --no-restore
Try `start --he= lp' for more information.
tramp_exit_status 1
<= br>
It doen't help if (setq explicit-shell-file-name "/b= in/sh"). It looks like due to the construction of the command which co= ncats shell-file-name and args even if it is for tramp and remote host.
=

- Problem 2: tramp and shell: env: c:/bin/sh : No= such file or directory
where "c:/" comes? Does it come= s from some feature of completion of read-file-name?

In a tramp dried buffer, call shell which suppose to raise the shell=20 buffer on remote server. However, I got error messge in the * shell *=20 buffer that "env: c:/bin/sh : No such file or directory". I don&#= 39;t know=20 where the "c:/" comes from. When shell is called, it reads the re= mote=20 path in the minibufer with promotes (for remote shell path) "/plink:us= er@host:/path/to/dired/C:/Users/username/emacs/libexec/emacs/27.0= .50/x86_64-w64-mingw32/cmdproxy.exe", and I change it to "/plink:user@host:/bin/", and then I got erro= r=20 message above. Below is the tracking:

12:00:20.871919 tramp-send-command (6) # cd /opt/user/test/ &&= =C2=A0 exec=C2=A0 env PS1\=3D/plink\:user\@host\:/opt/user/test/\ \#\$\=C2= =A0 TERM\=3Demacs TERMCAP\=3Demacs\:co\#135\:tc\=3Dunknown\: INSIDE_EMACS\= =3D27.0.50\,comint c\:/bin/sh -i

"c\"/bi= n/sh" is because I change the remote path to /plink:user@host:/bin/ wh= en it asked in the minibuffer.

It opens the sh= ell remotely if (setq explicit-shell-file-name "/bin/sh").
<= div>11:50:36.476919 tramp-send-command (6) # cd /opt/user/test/ &&= =C2=A0 exec=C2=A0 env PS1\=3D/plink\:user\@host\:/opt/user/test/\ \#\$\=C2= =A0 TERM\=3Demacs TERMCAP\=3Demacs\:co\#135\:tc\=3Dunknown\: INSIDE_EMACS\= =3D27.0.50\,comint /bin/sh -i
The remote shell path is not asked = in this case.
Shoud it get tramp-remote-shell from tramp-met= hods or remote-shell from tramp-connection-properties directly?

- Problem 3: as in problem 2, shell-file-name is used in = the complete of promote for remote path. It should not do in this way becau= se shell-file-name is for local.
It triggered lots of try in hos = side for completion:
11:16:47.779920 tramp-send-command (6) # tes= t -d /opt/bee/user/test/C\:/Users/username/emacs/libexec/emacs/27.0.50/x86_= 64-w64-mingw32 2>/dev/null; echo tramp_exit_status $?
I ha= ve set ido-mode or icomplete-mode to nil.

The only= tramp setting I used:
=C2=A0 (push '("plink"
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (tramp-login-p= rogram=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "plink")
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (tramp-login-args= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (("-l&quo= t; "%u") ("-P" "%p") ("-ssh") (&quo= t;%h")))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (tramp-remote-shell=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &qu= ot;/bin/sh")
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (tramp-remote-shell-args=C2=A0=C2=A0=C2=A0 ("-c"))
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (tramp-copy-progr= am=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "pscp")
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (tramp-copy-args= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (("= -l" "%u") ("-P" "%p") ("-scp")= ("-p" "%k") ("-q") ("-r")))
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (tramp-copy-keep-= date t)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (tr= amp-copy-recursive t)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (tramp-default-port=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 22))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tramp-methods)



Best Regards,<= /div>Shuguang Sun
--001a11482a267baf55055d3483be--