unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29149: Tramp shell uses local shell setting in windows
@ 2017-11-05  4:10 Shuguang Sun
  2017-11-09  9:27 ` Shuguang Sun
  2017-11-11  9:10 ` michael.albinus
  0 siblings, 2 replies; 25+ messages in thread
From: Shuguang Sun @ 2017-11-05  4:10 UTC (permalink / raw)
  To: 29149

[-- Attachment #1: Type: text/plain, Size: 4256 bytes --]

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 $? )
11:07:36.033413 tramp-wait-for-regexp (6) #
start: invalid option: --no-restore
Try `start --help' for more information.
tramp_exit_status 1

It doen't help if (setq explicit-shell-file-name "/bin/sh"). It looks like
due to the construction of the command which concats 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 comes from some feature of completion of
read-file-name?

In a tramp dried buffer, call shell which suppose to raise the shell buffer
on remote server. However, I got error messge in the * shell * buffer that
"env: c:/bin/sh : No such file or directory". I don't know where the "c:/"
comes from. When shell is called, it reads the remote path in the minibufer
with promotes (for remote shell path) "/plink:user@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 error message
above. Below is the tracking:

12:00:20.871919 tramp-send-command (6) # cd /opt/user/test/ &&  exec  env
PS1\=/plink\:user\@host\:/opt/user/test/\ \#\$\  TERM\=emacs
TERMCAP\=emacs\:co\#135\:tc\=unknown\: INSIDE_EMACS\=27.0.50\,comint
c\:/bin/sh -i

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

It opens the shell remotely if (setq explicit-shell-file-name "/bin/sh").
11:50:36.476919 tramp-send-command (6) # cd /opt/user/test/ &&  exec  env
PS1\=/plink\:user\@host\:/opt/user/test/\ \#\$\  TERM\=emacs
TERMCAP\=emacs\:co\#135\:tc\=unknown\: INSIDE_EMACS\=27.0.50\,comint
/bin/sh -i
The remote shell path is not asked in this case.
Shoud it get tramp-remote-shell from tramp-methods 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 because
shell-file-name is for local.
It triggered lots of try in hos side for completion:
11:16:47.779920 tramp-send-command (6) # test -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 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

[-- Attachment #2: Type: text/html, Size: 5559 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-01-26 15:43 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-05  4:10 bug#29149: Tramp shell uses local shell setting in windows Shuguang Sun
2017-11-09  9:27 ` Shuguang Sun
2017-11-11  8:57   ` Eli Zaretskii
2017-11-14 15:44     ` Michael Albinus
2017-11-16  2:20       ` Shuguang Sun
2017-11-17 14:53         ` Michael Albinus
2017-11-20 13:31           ` Michael Albinus
2017-11-25 15:26             ` Shuguang Sun
2017-11-11  9:10 ` michael.albinus
2017-11-11 10:11   ` Eli Zaretskii
2017-11-25 18:09   ` Shuguang Sun
2018-01-06 15:18     ` Shuguang Sun
2018-01-06 18:51       ` Michael Albinus
2018-01-07  4:52         ` Shuguang Sun
2018-01-07 12:44           ` Michael Albinus
2018-01-13 17:37           ` Michael Albinus
2018-01-13 19:21             ` Eli Zaretskii
2018-01-14  9:05               ` Michael Albinus
2018-01-25 12:01             ` Shuguang Sun
2018-01-25 12:30               ` Michael Albinus
2018-01-25 14:25                 ` Shuguang Sun
2018-01-25 14:50                   ` Michael Albinus
2018-01-26  2:03                     ` Shuguang Sun
2018-01-26 14:37                       ` Richard Stallman
2018-01-26 15:43                         ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).