From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#49229: 27.2; `M-x shell' fails over TRAMP from local MS Windows Date: Sun, 27 Jun 2021 10:41:52 +0200 Message-ID: <87czs7pulr.fsf@gmx.de> References: <87h7hkpufg.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15240"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 49229@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 27 10:43:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxQNj-0003pZ-Ap for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Jun 2021 10:43:11 +0200 Original-Received: from localhost ([::1]:47898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxQNh-0000jr-5J for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Jun 2021 04:43:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxQNa-0000jf-61 for bug-gnu-emacs@gnu.org; Sun, 27 Jun 2021 04:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37361) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxQNZ-00028Q-VJ for bug-gnu-emacs@gnu.org; Sun, 27 Jun 2021 04:43:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxQNZ-0005Qf-QQ for bug-gnu-emacs@gnu.org; Sun, 27 Jun 2021 04:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Jun 2021 08:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49229 X-GNU-PR-Package: emacs Original-Received: via spool by 49229-submit@debbugs.gnu.org id=B49229.162478332720801 (code B ref 49229); Sun, 27 Jun 2021 08:43:01 +0000 Original-Received: (at 49229) by debbugs.gnu.org; 27 Jun 2021 08:42:07 +0000 Original-Received: from localhost ([127.0.0.1]:48907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxQMh-0005PP-4N for submit@debbugs.gnu.org; Sun, 27 Jun 2021 04:42:07 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:52759) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxQMa-0005Oq-NV for 49229@debbugs.gnu.org; Sun, 27 Jun 2021 04:42:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1624783313; bh=hA6SKviPlt0VuAHJrwSa6o28Bm0eH7BOWrN81Fy8LFw=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=G9OWejy+V62dx1UUQ7FbiDDYLjarIiGr/RkQanlhgPpmurPbvio4HDbz6kCkwoDeh vemyFc+qVqOY/Dx7Ozl41IGtBwWVy6NKijbRwqfTVtpfUnNlIbmj48XJoZq1qe1o0Q lWbIR6KGwHisrOx12e+Sirf+7TfTZDwsknwjTLt8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([79.140.124.38]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdvqW-1lQ1Hr2grO-00b1db; Sun, 27 Jun 2021 10:41:53 +0200 In-Reply-To: (Jim Porter's message of "Sat, 26 Jun 2021 11:01:41 -0700") X-Provags-ID: V03:K1:J6alYMx9TPShN2Djtvig9yLp7ezPx/c6rGBG0GgXz7UciPE2D6p 42wzcn77+3rT8uidxrPzoIpGyFb38uxqBUv2vK4il+3KANM5PboBu7YUgRDat/yJ2quyobt D60jY+2tOAGABHZmdRa5NeGLouOwHtrYYSVVH4vL5ifHe5CwJIceRsZ96fUMBYCxyGkzgih sZ/FXImGPUNfKhYbe8guQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:wp73eEJCMPU=:0p0ZRvmOqmexsTBzR7Ar7E hefYhtPNMZQLe3mhB7WtifxOjIbn11X64DgYjGf0UPflgnmtg4fk5am5v0oyQ6x6BkL5nGumE /J7TJ29QDIRnUdvpnyxDFJ4s+wSI/z7oGDR+UvMYyaV3AoULgDO7zZZZlhE4B/Nbg1KNLzsIJ mTZ02hrcjFVs9UOaerssq9nNpisRaigBzBGziqydmM6VJhTGAXuSlx0+sscAbPyKot+ABKQ9a sFqqsKI+VnYc4QwI7KadCfDXTkUdKGP9HGvBXW29oU1mvvizN97quuOi6dJ1xjqHkIG4mQRqb 6UCNaARjcV2lMFZFVJZpaEFpnekzj1bQzOybFIuAMW2kRM3dmD5mTou/nuOUy3CPLgANYOIX6 woLN7M7UrKVn+EpSzvWKHWJZ8r2E59nkqpit7W9K4x9LSU6dhNExzB7M8Emgthbfv/3BtC/zC 23Im1TyeJIFaBif+YY6tvDgFSAVe2RnZiHdj/QUsvXhFAA8QJPBgVltI8IWV9pdpPD5KVeCcC 3Fa6b3LAjZaSKVxM+44p5yDVk0DvPs2hLHDy254ne6WqqIWVgmrAi6gJ0mqmSEs29zQ1Huso+ /YsUspx1w6m00RuafUeQ8c6JLlmkW0QiGV7BqOaocT+Pv0/amZrIaaMEKrjkDIJnnVRInMZ+w NM6pMWWFGluzouQ/b7t2p5KVWKnlv2Z2VXkcWyv1PmEbtRQaKiDkYaoieGB1qqL8urhwWS+ze tKLbvI7KvxAjQ2ynide5AYZNQcJCMQ2xBaXbCgaU9n9B6HjIPdYaVLf16LaxQEnoAu2r0JdX X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209031 Archived-At: --=-=-= Content-Type: text/plain Jim Porter writes: Hi Jim, >> I've pushed a fix to the master branches of Emacs and Tramp. Could you, >> pls, check? > > I tested on MS Windows and it works correctly for me. (Note that I > just copied and eval'ed the new version of `tramp-file-name-handler', > since I don't have a proper build environment on MS Windows.) Thanks for confirmation. > If I erase the default text and instead enter > "C:/Windows/System32/cmd.exe" into the `M-x shell' prompt, it treats > *that* as a remote path too. Now, the prompt does say to enter a > *remote* shell path, so if I enter a local path, I made a mistake. > However, the default shell path for `M-x shell' from a remote > directory is a TRAMP path ("/sshx:server:/path/to/some//bin/sh"), so > it's surprising that when I delete the TRAMP host prefix, I still end > up running a shell on the remote server. `read-file-name' as used in `shell' just reads a file name, no matter whether a local or remote one. > Perhaps it would be nicer if, when `M-x shell' prompted for the remote > shell path, it didn't include the TRAMP prefix by default (e.g. the > default value would just be "/bin/sh"). That might not interact well > with `read-file-name' completion though; is it possible to use > file-name completion on a remote path without the TRAMP prefix? No, that doesn't work. File name completion and alike wouldn't work any more. But we could teach `read-file-name' to accept only remote file names. What about this patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/lisp/shell.el b/lisp/shell.el index 62de5be817..4339e8c0a3 100644 =2D-- a/lisp/shell.el +++ b/lisp/shell.el @@ -759,7 +759,8 @@ shell (file-local-name (expand-file-name (read-file-name "Remote shell path: " default-director= y - shell-file-name t shell-file-name))))) + shell-file-name t shell-file-name + #'file-remote-p))))) ;; Rain or shine, BUFFER must be current by now. (unless (comint-check-proc buffer) --=-=-= Content-Type: text/plain It is not perfect, one can still enter "/sudo::/bin/sh" when `default-directory' is "/ssh::". But I wouldn't count this as mistake, it would be rather a "user error by intention" :-) Best regards, Michael. --=-=-=--