From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#49229: 27.2; `M-x shell' fails over TRAMP from local MS Windows Date: Fri, 25 Jun 2021 16:05:57 -0700 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000056480205c59f2f63" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3413"; mail-complaints-to="usenet@ciao.gmane.io" To: 49229@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 26 01:07: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 1lwuul-0000my-Uf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Jun 2021 01:07:12 +0200 Original-Received: from localhost ([::1]:54864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwuuj-0002pk-W7 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 25 Jun 2021 19:07:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwuud-0002oR-7F for bug-gnu-emacs@gnu.org; Fri, 25 Jun 2021 19:07:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwuuc-0003t8-W3 for bug-gnu-emacs@gnu.org; Fri, 25 Jun 2021 19:07:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwuuc-0004Dt-Kv for bug-gnu-emacs@gnu.org; Fri, 25 Jun 2021 19:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 25 Jun 2021 23:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49229 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162466237616136 (code B ref -1); Fri, 25 Jun 2021 23:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Jun 2021 23:06:16 +0000 Original-Received: from localhost ([127.0.0.1]:46924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwutr-0004CA-NI for submit@debbugs.gnu.org; Fri, 25 Jun 2021 19:06:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:42254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwuto-0004Bz-Kp for submit@debbugs.gnu.org; Fri, 25 Jun 2021 19:06:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwuto-0002jB-Fv for bug-gnu-emacs@gnu.org; Fri, 25 Jun 2021 19:06:12 -0400 Original-Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:39779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwutm-0003Is-PL for bug-gnu-emacs@gnu.org; Fri, 25 Jun 2021 19:06:12 -0400 Original-Received: by mail-pf1-x42e.google.com with SMTP id g192so8627721pfb.6 for ; Fri, 25 Jun 2021 16:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=tnA5mutKG7tet3+VBXANZWC6ZoV6zgOue1irIRdrrAo=; b=Jt4zUoIiZ0hYgAk+z8dZ7kdmGxUhPQ0l5fA5c4AKzttg+TD10lvae2avxry7HPpSWR 1NAmMCflUz7XVU7kFWIoThY1vaDBLeV9w26naV01p2mWpE98oF8hyv2wbVa1+FKx2vMR fpDFrZ7A/SO25VE/VkD0cfS40OiA/V24REKuZRrTl7U8wJjG05ovfLxBZ84l59ft8jtE MkLMoAgXIDuYd1AZ9rs+zYu9tK+sCiSGWftm9ycPQ3BR7AHUAlk4TIKW3j0gXdsatyeK 7P73BN9i1BpO3PzkaAi3857G25NNPv+nwOSYRbTMX5lL06/CfhLR97HuuQfaRKhTuHy5 EPTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=tnA5mutKG7tet3+VBXANZWC6ZoV6zgOue1irIRdrrAo=; b=GNPTlqgjeBKUmUH+icGBlPMVDTmZf7g9gFL7oY/n94TJSwJRKP8kjVkoHFcvgDX/Ft Ur7jcQ/UanC/rBU7j452wfqRMpb1JsY2leV+I3pKeTcWDLXwEz3EjBT5Njf+8BJHEi3S 70mxvNqK1Bs9kg+Y61x0ZTh1Enns4U5jI/G/gN0SHMjXqmvaa4RpAJBiAsR7AxJOCI2m 6NHSVV8dsF5hIqCiUEo5xlWHBUcUxJriMFekFAzZ+pxj8vS+fcQJv+fBe1KUz5YAQFxJ 9Ww2rGPjtcHPMwCJfdntrpVQMsUGVqP0CjbYXwxYNWvW05aS9CnHlo11pnhijJif8GQA X84g== X-Gm-Message-State: AOAM533t+92nveQ37F8IeCboKsorqpPSSvsYCdQ1Y/41lDjAUpFFjQVP LStXdvj3bkHO6BIXHMw1gpMgJGw+aX4x8iXUdTAz8J5NzXE= X-Google-Smtp-Source: ABdhPJwsYDL3yZvxMC2fKpn74Loaf/tdF1Y6F0Otec5FnzF/o1idK8RiIurcSuRn3F0tHY1RbCYQ4KWHiKPNgXQTBXQ= X-Received: by 2002:aa7:9464:0:b029:306:3984:b22a with SMTP id t4-20020aa794640000b02903063984b22amr12743698pfq.81.1624662368202; Fri, 25 Jun 2021 16:06:08 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:209008 Archived-At: --00000000000056480205c59f2f63 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable (Note: I primarily tested on 27.2, but this doesn't look to be any different on 28.0.50.) When invoking `M-x shell' over TRAMP from a local MS Windows system, the default remote shell path is corrupted: emacs -Q C-x C-f /sshx:server:~/some/file.txt M-x shell ;; See the default prompt value: ;; /sshx:server:/path/to/some//bin/sh ;; ("/path/to/some/" is greyed out) RET The result is: "env: =E2=80=98c:/bin/sh=E2=80=99: No such file or directory= ". You can also see this with the code used in `M-x shell' to get the remote shell path: (read-file-name "Remote shell path: " default-directory shell-file-name t shell-file-name) Eval'ing that from a TRAMP buffer and hitting RET returns "/bin/sh" (i.e. `shell-file-name'); that is, we lost the TRAMP prefix, even though the prompt made it look like we'd keep it. If you edit the path to, say, "/sshx:server:/path/to/some//usr/bin/zsh" and hit RET, the result is "/sshx:server:/usr/bin/zsh", which is good. The result of this call is then passed to `expand-file-name', which on MS Windows, turns "/bin/sh" into "c:/bin/sh". Finally, that gets called on the remote (running GNU/Linux), and things break. I've attached a WIP patch that resolves this, but I don't think it's quite right (hence, I didn't use `git format-patch'). This seems to be more of an issue with `read-file-name' not being smart enough; even if we set the `default-filename' argument to nil, the default return value is still a local (non-TRAMP) path, which isn't right. Since `read-file-name' is better able to tell whether the user wanted the default value or they specifically wanted a local shell, it might be better to fix the issue there. However, that's a pretty widely-used function, and I'm hesitant to change the behavior in potentially-breaking ways. If the current WIP patch does look good though, I can clean it up (add a comment and a commit message) for it to be merged. Or I can try to fix `read-file-name' if there's agreement about how it should work in this case. --00000000000056480205c59f2f63 Content-Type: application/octet-stream; name="shell-tramp.patch" Content-Disposition: attachment; filename="shell-tramp.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kqcxo9c80 ZGlmZiAtLWdpdCBhL2xpc3Avc2hlbGwuZWwgYi9saXNwL3NoZWxsLmVsCmluZGV4IDYyZGU1YmU4 MTcuLmU3MzY5NDY0ZmQgMTAwNjQ0Ci0tLSBhL2xpc3Avc2hlbGwuZWwKKysrIGIvbGlzcC9zaGVs bC5lbApAQCAtNzUxLDE1ICs3NTEsMTYgQEAgc2hlbGwKIAogICAod2l0aC1jb25uZWN0aW9uLWxv Y2FsLXZhcmlhYmxlcwogICAgOzsgT24gcmVtb3RlIGhvc3RzLCB0aGUgbG9jYWwgYHNoZWxsLWZp bGUtbmFtZScgbWlnaHQgYmUgdXNlbGVzcy4KLSAgICh3aGVuIChhbmQgKGZpbGUtcmVtb3RlLXAg ZGVmYXVsdC1kaXJlY3RvcnkpCi0gICAgICAgICAgICAgIChjYWxsZWQtaW50ZXJhY3RpdmVseS1w ICdhbnkpCi0gICAgICAgICAgICAgIChudWxsIGV4cGxpY2l0LXNoZWxsLWZpbGUtbmFtZSkKLSAg ICAgICAgICAgICAgKG51bGwgKGdldGVudiAiRVNIRUxMIikpKQorICAgKHdoZW4tbGV0ICgocmVt b3RlLWhvc3QgKGZpbGUtcmVtb3RlLXAgZGVmYXVsdC1kaXJlY3RvcnkpKQorICAgICAgICAgICAg ICAoKGNhbGxlZC1pbnRlcmFjdGl2ZWx5LXAgJ2FueSkpCisgICAgICAgICAgICAgICgobnVsbCBl eHBsaWNpdC1zaGVsbC1maWxlLW5hbWUpKQorICAgICAgICAgICAgICAoKG51bGwgKGdldGVudiAi RVNIRUxMIikpKSkKICAgICAgKHNldHEtbG9jYWwgZXhwbGljaXQtc2hlbGwtZmlsZS1uYW1lCiAg ICAgICAgICAgICAgICAgIChmaWxlLWxvY2FsLW5hbWUKICAgICAgICAgICAgICAgICAgIChleHBh bmQtZmlsZS1uYW1lCiAgICAgICAgICAgICAgICAgICAgKHJlYWQtZmlsZS1uYW1lICJSZW1vdGUg c2hlbGwgcGF0aDogIiBkZWZhdWx0LWRpcmVjdG9yeQotICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBzaGVsbC1maWxlLW5hbWUgdCBzaGVsbC1maWxlLW5hbWUpKSkpKQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY29uY2F0IHJlbW90ZS1ob3N0IHNoZWxsLWZp bGUtbmFtZSkgdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaGVsbC1maWxl LW5hbWUpKSkpKQogCiAgICA7OyBSYWluIG9yIHNoaW5lLCBCVUZGRVIgbXVzdCBiZSBjdXJyZW50 IGJ5IG5vdy4KICAgICh1bmxlc3MgKGNvbWludC1jaGVjay1wcm9jIGJ1ZmZlcikK --00000000000056480205c59f2f63--