From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Erik Hetzner Newsgroups: gmane.emacs.bugs Subject: bug#46466: 28.0.50; Tramp hangs with bad prompt even when using /bin/sh Date: Sat, 13 Feb 2021 09:07:50 -0800 Message-ID: <60280767.1c69fb81.2aa53.b38c@mx.google.com> References: <6026c5a7.1c69fb81.20d04.54d1@mx.google.com> <87eehkbb74.fsf@gmx.de> Reply-To: Erik Hetzner Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33551"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 46466@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 13 18:09:10 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 1lAyPu-0008ea-Ig for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 18:09:10 +0100 Original-Received: from localhost ([::1]:37546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAyPt-0000If-Kn for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 12:09:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAyPm-0000IL-QR for bug-gnu-emacs@gnu.org; Sat, 13 Feb 2021 12:09:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAyPm-0000NY-HR for bug-gnu-emacs@gnu.org; Sat, 13 Feb 2021 12:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lAyPm-00089L-C7 for bug-gnu-emacs@gnu.org; Sat, 13 Feb 2021 12:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Erik Hetzner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Feb 2021 17:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46466 X-GNU-PR-Package: emacs Original-Received: via spool by 46466-submit@debbugs.gnu.org id=B46466.161323608431255 (code B ref 46466); Sat, 13 Feb 2021 17:09:02 +0000 Original-Received: (at 46466) by debbugs.gnu.org; 13 Feb 2021 17:08:04 +0000 Original-Received: from localhost ([127.0.0.1]:34981 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAyOq-000883-K5 for submit@debbugs.gnu.org; Sat, 13 Feb 2021 12:08:04 -0500 Original-Received: from mail-pl1-f181.google.com ([209.85.214.181]:42983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAyOk-00087V-L0 for 46466@debbugs.gnu.org; Sat, 13 Feb 2021 12:08:03 -0500 Original-Received: by mail-pl1-f181.google.com with SMTP id s15so1448708plr.9 for <46466@debbugs.gnu.org>; Sat, 13 Feb 2021 09:07:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:sender:date:from:to:cc:subject:in-reply-to:references :user-agent:reply-to:mime-version:content-transfer-encoding; bh=5x+YFzLknkbyBIREOjsHcA2H9+Zi4kFEYKrvv0wubOY=; b=tnoKpBsJfg7p743Rov7jcD/EfkHcsWJ8kbw53M+j0SDZA6IHzR4bdWbs9B6Jm0RfIw xPQu5T/9QrlHRl6+6vOxAXmgL99C+hWukl7VXq9bRV0EdMWSviondhL46uwFw0UCyeqA UTFdxOfs4ad1nIxOc8n8HrMNSThoi2Whw8ItxcqBBgV0TlDghtcZJ3T+nfsq+3/2zn9g qebEFKusWy7cRbkm6nrKgtR/r37NJcQg9C/Y2LbNVTanyXt/RoUwOQgvNaoZBko2wEpG t7KkzPB288YF3EEZevEtYtwVuOI+mL5fprI1R9ARmrEZLmPIdIZXQjhuI68bsDBP3Yls spmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:sender:date:from:to:cc:subject :in-reply-to:references:user-agent:reply-to:mime-version :content-transfer-encoding; bh=5x+YFzLknkbyBIREOjsHcA2H9+Zi4kFEYKrvv0wubOY=; b=Pl+44ElEDITvuZwXYkqERONUHWtG+tmnuF9ay0+6IHEaGecCEVBDNwXUuVWLUn8PUl uQq4uACiBBp95wdNMVamwahFGOej7VZ5rU/pMGyUH5u58ZO8N9DsRHbk7vPAjZdDP++a elsa6zNw7GqRU3wWx2zmNLtqTDVrFjLsJopSaeANM6l2eaXPg+fbPON9nzxwQvA91wiq HT8h2k8EB1/J49eex05/KDq6iBoYWtexSGYQG7qrsEgplgd3Cchv0MPIMvaMjWM+hsw0 /A2h/dOykLH4YyS97SBASeMaila1mdiNq17sdq3oyGvnJX5DlvOYYht3jyL69HfOGly1 W66g== X-Gm-Message-State: AOAM531suN5BYTGKN6LlPVUbpSOFrR8Tg3U3eFs4VPZJJImC6GFfr/K0 D+dKPCnaCTa1Jlob21Cpzqo= X-Google-Smtp-Source: ABdhPJy9jvEGZUhmMi0dnDjxsA0BOPs2xXE+0FRtJ4wZ+9i7RvWs5SRtfZXUr3eo76rmv5iquC8YIg== X-Received: by 2002:a17:90a:aa8a:: with SMTP id l10mr8049562pjq.86.1613236072592; Sat, 13 Feb 2021 09:07:52 -0800 (PST) Original-Received: from michel.e6h.org ([2601:643:8800:93d:d208:660:6a53:5389]) by smtp.gmail.com with ESMTPSA id t23sm12561418pfl.80.2021.02.13.09.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Feb 2021 09:07:51 -0800 (PST) In-Reply-To: <87eehkbb74.fsf@gmx.de> 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:199942 Archived-At: Hi Michael, On Sat, 13 Feb 2021 00:53:35 -0800, Michael Albinus wrote: >=20 > [=E2=80=A6] >=20 > What is /bin/sh, both locally and remote? In my case, running Fedora 33, > I see >=20 > --8<---------------cut here---------------start------------->8--- > # ls -l /bin/sh > lrwxrwxrwx. 1 root root 4 Jul 27 2020 /bin/sh -> bash > --8<---------------cut here---------------end--------------->8--- Good question, I should have mentioned that. I have tested this on both debian and ubuntu, where /bin/sh is linked to dash $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Dec 10 05:23 /bin/sh -> dash As a follow up, I suspect that in some way this is expected behavior. I see that the *sshx* connection method specifies the shell to run when connecting, whereas the *ssh* connection method connects without specifying a command, and therefore starts a default remote shell. This suggests a fix which turns out to works. The behavior is fixed, for me, by adding `("-o" "RemoteCommand=3D'%l'")` to the list of `tramp-login-args' for `tramp-methods' (see below). It is also possible to set the PS1 value directly with this remote command, e.g. `("-o" "RemoteCommand=3D'PS1=3D\"$ \" %l'")`, which might provide even more safety against unusual prompts. Is this a patch that would be welcome? It would fix cases where users had more elaborate prompts in their default shell and where /bin/sh was a simpler shell (debian and ubuntu, at least). Unusual prompts are more and more popular, but users to do not usually enable them for /bin/sh. However, it might have effects that I am not aware of. ``` (add-to-list 'tramp-methods `("ssh" (tramp-login-program "ssh") (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") ("-o" "RemoteCommand=3D'%l'") (= "%h"))) (tramp-async-args (("-q"))) (tramp-direct-async t) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-c")))) ``` best, Erik