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, 7 Jan 2018 12:52:58 +0800 Message-ID: References: <0MfmZs-1eYOTH1z1g-00N7E0@mail.gmx.com> <87bmi6rfao.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11377bbea77f78056228746e" X-Trace: blaine.gmane.org 1515300741 28549 195.159.176.226 (7 Jan 2018 04:52:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 7 Jan 2018 04:52:21 +0000 (UTC) Cc: 29149@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 07 05:52:16 2018 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 1eY2wN-0006rt-As for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jan 2018 05:52:11 +0100 Original-Received: from localhost ([::1]:37010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eY2yJ-0005Cl-Lo for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Jan 2018 23:54:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eY2yD-0005CQ-BV for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2018 23:54:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eY2yA-00016Q-Q2 for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2018 23:54:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58187) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eY2yA-00016F-Mc for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2018 23:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eY2yA-0006R6-DJ for bug-gnu-emacs@gnu.org; Sat, 06 Jan 2018 23:54:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Shuguang Sun Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Jan 2018 04:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29149 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29149-submit@debbugs.gnu.org id=B29149.151530078724673 (code B ref 29149); Sun, 07 Jan 2018 04:54:02 +0000 Original-Received: (at 29149) by debbugs.gnu.org; 7 Jan 2018 04:53:07 +0000 Original-Received: from localhost ([127.0.0.1]:38635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eY2xG-0006Ps-Md for submit@debbugs.gnu.org; Sat, 06 Jan 2018 23:53:06 -0500 Original-Received: from mail-qt0-f171.google.com ([209.85.216.171]:38740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eY2xE-0006PO-GV for 29149@debbugs.gnu.org; Sat, 06 Jan 2018 23:53:04 -0500 Original-Received: by mail-qt0-f171.google.com with SMTP id d4so10226034qtj.5 for <29149@debbugs.gnu.org>; Sat, 06 Jan 2018 20:53:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wvtDea8EgHneUshjQkYglUVmF2pKSXVoAO0tUL+B+/4=; b=HzxqimfPx6KzIZaVOgMmlZMRRjS3DEvOKFJaIdhCkIQQyiZAR4bTDwBfgyapRnyBae IdyU72fw5Q1l5ijioOOjliDp6PQZZTzgUOiSr/F/TGVZ8cOZQajFY8jhS8Sinbg2Jw5o 4pLzaf0lmgdGMenY844H5z/5e5TzmgMfpu13YGa7cVTHcUHMzVE1uEkd3yDTBXBepP+/ hX5B3H2wTyOoi4kJ57m8k28prm0C6+2980wEnCqG6dfUXCaBSVGxxqeOWEGbLCIXVLUW A2Ff8Sl3owaDFwJg4Jtl7cItcfA93zYaiSXSAguQxq2Ji5jDaAZMU4sQOPACb4BQYhH5 8WJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wvtDea8EgHneUshjQkYglUVmF2pKSXVoAO0tUL+B+/4=; b=XyPFltxc3JPx9FieZeMXXFM2zzMVcZ/WUJst2gVnCAnWrW66d5LO9YkeP6N7xKAc8p cSuq6obaqUy8lIqunJ5eMjbeaJRYFtUDCpYBqcbC2tmidZ42gqKOgBNR1Q1NkbddLbVw fQyTiti4ZnrO4/R4HXf1USnuY8y/51jjgq1jgXGFLHRG3h+apzsRZIiURvhp92Ffns8u tm3o8oaSu7rKrec+Ly5AYtVPw7TG7UwlFUCDDOh8oplxr9r+ys39z5MuXjEGZVVdH5H6 2vWuBbE8l6Zau+iylMeFYftsTs9zZtpP/F6EKNZKZU2nsIu2+ojgBXs5qa7SM8B4PzOQ /HIg== X-Gm-Message-State: AKwxytcgA1iZmmhLxusq4zCuPtHOY0oom9/LF61TeSaFuGguuDCMqnI6 YeAbpWKImcXjSB5snmoSyVCfS5FnCbNQDgokzBk= X-Google-Smtp-Source: ACJfBovKj7BY51RlAjUNsXI5WnMyX2FRJ9WzJm1KXE/EsuphiuXb3MSpVjFYmVjocPy1Mcbbp9utrzbntE703nuoQok= X-Received: by 10.200.45.105 with SMTP id o38mr10520116qta.263.1515300778900; Sat, 06 Jan 2018 20:52:58 -0800 (PST) Original-Received: by 10.237.43.166 with HTTP; Sat, 6 Jan 2018 20:52:58 -0800 (PST) In-Reply-To: <87bmi6rfao.fsf@gmx.de> 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:141856 Archived-At: --001a11377bbea77f78056228746e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Michael, On Sun, Jan 7, 2018 at 2:51 AM, Michael Albinus wrote: > Shuguang Sun writes: > > > Dear all, > > Hi, > > > 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) > > Thanks for this! However, I believe we should not use tramp-remote-shell > and tramp-remote-shell-args in shell.el. The better approach would be to > use connection-local variables. Have you read the section "Running > =E2=80=98shell=E2=80=99 on a remote host" in the Tramp manual, chapter > (info "(tramp) Remote processes") ? > Here I focus on the connection from Windows local to linux remote 1. For the shell command: The setting below from 6.5.2 does make the shell command work. (connection-local-set-profile-variables 'remote-bash '((explicit-shell-file-name . "/bin/bash") (explicit-bash-args . ("-i")))) It must specify the explicit-shell-file-name. Otherwise, once the code in function shell trying to set explicit-shell-file-name sill has bugs: 1.1 expand-file-name will add c:/ to the shell-file name because the local is windows 1.2 the default directory for read-file-name is better to use (file-remote-p default-directory) "/" than default-directory "/path/path/..." Otherwise this part of code is not necessary. 2. 6.5.3 Running =E2=80=98shell-command=E2=80=99 on a remote host or other = section can't solve "start /b" issue. It is introduced by dired-do-shell-command (in dired-aux.el). It checks w32-shell for local environment and then add "star= t /b" to the command. However if it is in a tramp dir (e.g. linux server), the command with "start /b" will be transpose to remote handler. The linux shell can't understand it. If Windows to Windows connection will not meet this issue. > > Best regards, Michael. > --001a11377bbea77f78056228746e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Michael,



On Sun, Jan 7, 2018 at = 2:51 AM, Michael Albinus <michael.albinus@gmx.de> wrote= :
Shuguang Sun <shuguang@gmail.com> writes:

> Dear all,

Hi,

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

Thanks for this! However, I believe we should not use tramp-remote-s= hell
and tramp-remote-shell-args in shell.el. The better approach would be to use connection-local variables. Have you read the section "Running
=E2=80=98shell=E2=80=99 on a remote host" in the Tramp manual, chapter=
(info "(tramp) Remote processes") ?

Here I focus on the connection from Windows local to linux remote

1. For the shell command:
The setting = below from 6.5.2 does make the shell command work.
=C2=A0 (connec= tion-local-set-profile-variables
=C2=A0=C2=A0 'remote-bash
=C2=A0= =C2=A0 '((explicit-shell-file-name . "/bin/bash")
=C2=A0= =C2=A0=C2=A0=C2=A0 (explicit-bash-args . ("-i"))))
=
It must specify the explicit-shell-file-name. Otherwise, onc= e the code in function shell trying to set explicit-shell-file-name sill ha= s bugs:
1.1 expand-file-name will add c:/ to the shell-file name = because the local is windows
1.2 the default directory for read-f= ile-name is better to use (file-remote-p default-directory) "/" t= han default-directory "/path/path/..."

O= therwise this part of code is not necessary.

2= . 6.5.3 Running =E2=80=98shell-command=E2=80=99 on a remote host or other s= ection can't solve "start /b" issue. I= t is introduced by dir= ed-do-shell-command (in dired-aux.el). It checks w32-shell for local enviro= nment and then add "start /b" to the command. However if = it is in a tramp dir (e.g. linux server), the command with <= span class=3D"gmail-">"start /b" will be transpose to remote hand= ler. The linux shell can't understand it.
If Windows to Windows connection will not meet th= is issue.

=C2=A0

Best regards, Michael.

--001a11377bbea77f78056228746e--