all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Shuguang Sun <shuguang@gmail.com>
To: "michael.albinus" <michael.albinus@gmx.de>
Cc: 29149@debbugs.gnu.org
Subject: bug#29149: Tramp shell uses local shell setting in windows
Date: Sat, 6 Jan 2018 23:18:11 +0800	[thread overview]
Message-ID: <CACspjXcv2fSJfVKnybCEkfzAJXg+GSj5gg+k0cLPHS9=rRCEqA@mail.gmail.com> (raw)
In-Reply-To: <CACspjXeP5SjBqiTLN9NaqKqLDcXjdL_Yze1KHC_XdLxUU+y=Cw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1570 bytes --]

Dear all,

I have a patch to shell.el and dired-aux.el which
1. to use the tramp-remote-shell and tramp-remote-shell-args (in shell.el)
2. remove the "start /b" in dired-do-shell-command (in dired-aux.el)

https://github.com/ShuguangSun/emacsimprovement/tree/master/bug%2329149



On Sun, Nov 26, 2017 at 2:09 AM, Shuguang Sun <shuguang@gmail.com> wrote:

> Hi,
>
> I put some trace log for problem2:For problem 2: I don't know why it
> doesn't take tramp-remote-shell as the shell, but to ask user to input the
> shell path in the server side.
>
> When I input /bin/sh, the same as the tramp-remote-shell, it raise the
> error "
>
> - "env: c:/bin/sh: No such file or directory" in shell buffer
> -  "Process shell exited abnormally with code 127" in tramp_shell2.txt
> (the trace buffer)
> -  in tramp_shell_debug2.txt, (the tramp debug buffer)
> 00:34:02.040229 tramp-send-command (6) # cd /opt/bee/home/username/test/
> &&  exec  env PS1\=/plink\:username\@host\:/opt/bee/home/username/test/\
> \#\$\  TERM\=emacs TERMCAP\=emacs\:co\#135\:tc\=unknown\:
> INSIDE_EMACS\=27.0.50\,comint c\:/bin/sh -i
>
> The file is too large, therefore, I put them in github:
> https://github.com/ShuguangSun/Emacs-bug-29149
>
> Hope it works.
>
>
>
>
>
>
>
>
> On Sat, Nov 11, 2017 at 5:10 PM, michael.albinus <michael.albinus@gmx.de>
> wrote:
>
>> Hi Eli,
>>
>> My laptop crashed last night. If I cannot recover over the weekend, it
>> might take some days before I could react. Sorry.
>>
>> Best regards, Michael.
>>
>>
>>
>> Von meinem Samsung Galaxy Smartphone gesendet.
>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 2941 bytes --]

[-- Attachment #2: dired-aux.el.diff --]
[-- Type: text/plain, Size: 1102 bytes --]

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 7fff7e7a24..d3ecde95ec 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -794,13 +794,14 @@ dired-shell-stuff-it
           (and in-background (not sequentially) (not (eq system-type 'ms-dos))))
          (w32-shell (and (fboundp 'w32-shell-dos-semantics)
                          (w32-shell-dos-semantics)))
+         (file-remote (file-remote-p default-directory))
          ;; The way to run a command in background in Windows shells
          ;; is to use the START command.  The /B switch means not to
          ;; create a new window for the command.
-         (cmd-prefix (if w32-shell "start /b " ""))
+         (cmd-prefix (if (and w32-shell (not file-remote)) "start /b " ""))
          ;; Windows shells don't support chaining with ";", they use
          ;; "&" instead.
-         (cmd-sep (if (and (not w32-shell) (not parallel-in-background))
+         (cmd-sep (if (and (or (not w32-shell) file-remote) (not parallel-in-background))
                       ";"
                     "&"))
 	 (stuff-it

[-- Attachment #3: shell.el.diff --]
[-- Type: text/plain, Size: 1568 bytes --]

diff --git a/lisp/shell.el b/lisp/shell.el
index f046d7830e..ca8cc60c9c 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -727,11 +727,28 @@ shell
                (null explicit-shell-file-name)
                (null (getenv "ESHELL")))
           (set (make-local-variable 'explicit-shell-file-name)
-               (expand-file-name
+               ;;(expand-file-name ;; add c: to /bin/sh
                 (file-local-name
                  (read-file-name
-                  "Remote shell path: " default-directory shell-file-name
-                  t shell-file-name)))))))
+                  "Remote shell path: "
+                  (concat (file-remote-p default-directory) "/")
+                  (cadr (assoc
+                        'tramp-remote-shell
+                        (assoc (file-remote-p default-directory 'method) tramp-methods)))
+                  t
+                  (cadr (assoc
+                        'tramp-remote-shell
+                        (assoc (file-remote-p default-directory 'method) tramp-methods)))
+                  ))
+                ;;)
+                )
+        ;; need to be improved. It just works for /bin/sh
+        (set (make-local-variable 'explicit-sh-args)
+             (cadr (assoc
+                   'tramp-remote-shell-args
+                   (assoc (file-remote-p default-directory 'method) tramp-methods)))
+             )
+        )))

   ;; The buffer's window must be correctly set when we call comint
   ;; (so that comint sets the COLUMNS env var properly).

  reply	other threads:[~2018-01-06 15:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACspjXcv2fSJfVKnybCEkfzAJXg+GSj5gg+k0cLPHS9=rRCEqA@mail.gmail.com' \
    --to=shuguang@gmail.com \
    --cc=29149@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.