GNU bug report logs -
#29149
Tramp shell uses local shell setting in windows
Previous Next
Reported by: Shuguang Sun <shuguang <at> gmail.com>
Date: Sun, 5 Nov 2017 04:11:01 UTC
Severity: normal
Merged with 29442
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Thu, 25 Jan 2018 13:30:34 +0100
with message-id <87lggm5ded.fsf <at> gmx.de>
and subject line Re: bug#29149: Tramp shell uses local shell setting in windows
has caused the debbugs.gnu.org bug report #29149,
regarding Tramp shell uses local shell setting in windows
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
29149: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29149
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
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 <at> 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 <at> 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 <at> 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 <at> 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
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
Shuguang Sun <shuguang <at> gmail.com> writes:
> Thanks Micahel,
Hi Shuguang,
> Now it works!
Thanks for testing. So I mark this bug as closed.
> > 1.2 the default directory for read-file-name is better to use
> > (file-remote-p default-directory) "/" than default-directory
> > "/path/path/..."
>
> I don't see why. Could you pls explain?
>
> If we well set the shell via connection-local-set-profile-variables
> which measn there is explicit-shell-file-name, it will not prompt the
> directory.
>
> For example as in the manual:
> (connection-local-set-profile-variables
> 'remote-bash
> '((explicit-shell-file-name . "/bin/bash")
> (explicit-bash-args . ("-i"))
> ))
Hmm. I still don't understand why you want to change
default-directory. Or do you want to say it doesn't matter, when
explicit-shell-file-name is set?
And even in case there is no explicit-shell-file-name set,
read-file-name shall work as expected with the existing default-directory.
Best regards, Michael.
This bug report was last modified 7 years and 175 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.