From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70792: 30.0.50; [PATCH] Add Eshell support for expanding absolute file names within the current remote connection Date: Mon, 06 May 2024 14:14:22 +0300 Message-ID: <86y18nb3ap.fsf@gnu.org> References: <5b881f54-4c29-f8d8-d1f7-57b44e7cfc80@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34331"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70792@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 06 13:16:01 2024 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 1s3wK8-0008j7-Pl for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 May 2024 13:16:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3wJo-0007Qy-4t; Mon, 06 May 2024 07:15:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3wJl-0007QO-Qz for bug-gnu-emacs@gnu.org; Mon, 06 May 2024 07:15:38 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3wJl-0002Df-GA for bug-gnu-emacs@gnu.org; Mon, 06 May 2024 07:15:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s3wK9-0008Lu-KK for bug-gnu-emacs@gnu.org; Mon, 06 May 2024 07:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 May 2024 11:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70792 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70792-submit@debbugs.gnu.org id=B70792.171499410732084 (code B ref 70792); Mon, 06 May 2024 11:16:01 +0000 Original-Received: (at 70792) by debbugs.gnu.org; 6 May 2024 11:15:07 +0000 Original-Received: from localhost ([127.0.0.1]:37366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s3wJG-0008LQ-Np for submit@debbugs.gnu.org; Mon, 06 May 2024 07:15:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s3wJB-0008Kg-9K for 70792@debbugs.gnu.org; Mon, 06 May 2024 07:15:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3wIh-00019e-Kv; Mon, 06 May 2024 07:14:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=BzaN+O/mt+Bvj7iWA8bnZND9Wxo7qr/0W1inOnL80KQ=; b=Cd6tzMTH/Ij6 AL652SC2CRp7lfSqWNP2cXDmM8gBTiEGdU7iE4MXajYB1xwWlR/RpWp2EqS9yXN/RvYlOnAWV8hOs RMQKRI38IYVY0H9tgj2VomsMyBNPC2kaQwBaJvG51mZkmbhTBveJ1a2KZJ52Cc5nsnwFyIb/dborR nZyvUnzksgqKcjB8vwfhgm5s82hI/KolUfhlLYmtxOf1MlUR4wooRdNE9WSMz8+w6CZyxReC0QuTT hi2+pStayw73LA6+/4RVN4cwCrQt2IWF5UXLxfvxXyiRR72UtHxfjln0V6BdzvPDbOeWEXUJtt+7o hALWLtAxWqhLNcHAmAVcpw==; In-Reply-To: <5b881f54-4c29-f8d8-d1f7-57b44e7cfc80@gmail.com> (message from Jim Porter on Sun, 5 May 2024 13:58:55 -0700) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284569 Archived-At: > Date: Sun, 5 May 2024 13:58:55 -0700 > From: Jim Porter > > One oddity of Eshell is that even when you're connected to a remote host > (usually you just "cd" into a remote directory using Tramp syntax), > absolute file names are still on your *local* host when running any Lisp > commands. However, running *external* commands (programs on the remote > host), absolute file names are on that remote host. > > When you think about how it's implemented, this makes sense: Lisp > commands always run in the local Emacs process, but external programs > run on the remote. So naturally, "absolute" file names are relative to a > different host in either case. This wouldn't be so bad except that it's > not always obvious when you're running a Lisp command or not. Eshell > provides Lisp implementations of some common commands, like "cat", but > it also transparently falls back to the external program if it doesn't > understand some option. This results in it being pretty hard to tell > what's going to happen when you run a command. > > There's an "elecslash" module for Eshell that helps with this, but it > can't tell when you have a Lisp command that will actually fallback to > the external program when you run it. > > Instead, the attached patch provides a new way to handle this: if you > enable 'eshell-connection-local-file-names', then "normal" absolute file > names like "/foo/bar" or "~/user" are evaluated relative to the current > remote connection (if any). Eshell does this by expanding the file name > to a full remote name like "/ssh:remote:/foo/bar". If these strings get > sent to an external program, Eshell will unexpand them back to a > host-local name (it will make sure that the remote host is correct, too). > > You can also keep Eshell from performing this expansion on a > case-by-case basis by quoting the file name (like "this", 'this', or > /:this) or escaping the leading / or ~. I don't understand how would this work conceptually. Suppose I want to run a command on a remote host, but pipe the results into a command that runs locally -- how will Eshell know which file name to interpret relative to which directory, and how can the user indicate which is which unequivocally? IOW, I fear that this problem cannot be solved in principle in a shell-like application, and so trying to solve it will only cause us a terrible complexity mess. What am I missing? Thanks.