From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: 70792@debbugs.gnu.org
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 21:43:00 +0300 [thread overview]
Message-ID: <86cypybx3f.fsf@gnu.org> (raw)
In-Reply-To: <fe51fb39-13c0-05a9-0204-daab292cf34f@gmail.com> (message from Jim Porter on Mon, 6 May 2024 11:13:20 -0700)
> Date: Mon, 6 May 2024 11:13:20 -0700
> Cc: 70792@debbugs.gnu.org
> From: Jim Porter <jporterbugs@gmail.com>
>
> File names are expanded according to the current working directory when
> you enter your command, so unless you explicitly type out the host in a
> file name, it's treated as belonging to the host associated with cwd.
I know this, but we are explicitly talking about _absolute_ file
names, which normally trivially expand to themselves. _That_ is the
problem which I was talking about: you seem to propose a feature where
an absolute file name is sometimes expanded not to itself, but to a
remote file name.
> ##### 1. Change to root
> ~ $ cd /sudo::
> /sudo:root@host:~ # pwd; *pwd
> /sudo:root@host:/root
> /root
>
> ##### 2. Change to an absolute directory, stay as root
> /sudo:root@host:~ # cd /etc; pwd; *pwd
> /sudo:root@host:/etc
> /etc
So you are saying that to chdir to the _local_ /etc I must quote it as
in "/:/etc", or somesuch? If not, how do I chdir to a local directory
by its absolute file name?
> ##### 3. Change to the home directory, stay as root
> /sudo:root@host:~ # cd ~; pwd; *pwd
> /sudo:root@host:/root
> /root
Likewise here: how to chdir to the _local_ home directory? quote it?
> ##### 4. Write the expanded "~/foo.txt" to the *local* "~/bar.txt".
> ##### Using "/:" quoting lets you explicitly name a local file
> /sudo:root@host:~ # *echo ~/foo.txt > /:~/bar.txt
> /sudo:root@host:~ # cat bar.txt
> /bin/cat: bar.txt: No such file or directory
>
> ##### 5. Change to the *local* home directory, stop being root
> /sudo:root@host:~ # cd /:~; pwd; *pwd
> /home/jim
> /home/jim
That's awful! Completely un-natural, let alone a lot of typing!
Also, am I still able to specify remote file names when my default
directory is local? Or do I have to chdir to a remote directory
first?
> ##### 6. "bar.txt" ended up here
> ~ $ cat bar.txt
> ['-c', '/root/foo.txt']
Is "/root/foo.txt" a local or remote file name? (I know you used
*echo, but the file bar.text has no memory of that.)
> In the last line above, note that the value we wrote to our file is just
> the local part.
And that's considered a feature??
> With this option *disabled* (the default), there are some problems that
> (in my opinion) make working with remote file names in Eshell even more
> complex. For example, suppose I'm on a remote host, and want to change
> to my home directory on that remote. There's not an easy way to do that:
The simplest solution is to introduce a special command for that, so
that the user could tell Eshell explicitly whether he/she wants to
consider him/herself on the local or the remote host. Similar to what
we did with rlogin or ssh.
> Or suppose my cwd is /ssh:user@remote:/somedir. If I run "cat
> /etc/hosts", Eshell will print my local hosts file. But what if I run
> "cat -n /etc/hosts"? Eshell's "cat" implementation doesn't understand
> "-n", so it calls the "cat" on "remote". Now it prints the remote hosts
> file. You can only predict which hosts files you'll get if you know
> exactly which flags Eshell's "cat" implementation supports.
If Eshel knew that I consider myself on the remote, it could have
modified the logic accordingly, to DTRT. Without such an explicit
knowledge, we are _guessing_, and our guesses are bound to be wrong
sometimes.
Bottom line: instead of trying to improve our guesswork, I suggest to
explore the possibility of adding new command(s) that will tell Eshell
exactly what the user means wrt local/remote operation.
next prev parent reply other threads:[~2024-05-06 18:43 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-05 20:58 bug#70792: 30.0.50; [PATCH] Add Eshell support for expanding absolute file names within the current remote connection Jim Porter
2024-05-06 11:14 ` Eli Zaretskii
2024-05-06 18:13 ` Jim Porter
2024-05-06 18:43 ` Eli Zaretskii [this message]
2024-05-06 20:05 ` Jim Porter
2024-05-07 2:01 ` Jim Porter
2024-05-07 11:55 ` Eli Zaretskii
2024-05-07 18:54 ` Jim Porter
2024-05-08 13:20 ` Eli Zaretskii
2024-05-08 16:13 ` Jim Porter
2024-05-08 18:32 ` Eli Zaretskii
2024-05-08 18:57 ` Jim Porter
2024-05-09 18:14 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 18:53 ` Eli Zaretskii
2024-05-09 19:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 20:30 ` Jim Porter
2024-05-09 22:15 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 22:28 ` Jim Porter
2024-05-10 5:45 ` Eli Zaretskii
2024-05-10 19:35 ` Jim Porter
2024-05-13 7:39 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-16 2:12 ` Jim Porter
2024-05-08 18:17 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-08 18:49 ` Eli Zaretskii
2024-05-09 18:22 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 19:02 ` Eli Zaretskii
2024-05-07 8:12 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-06 16:56 ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-06 17:59 ` Eli Zaretskii
2024-05-06 18:28 ` Jim Porter
2024-05-06 18:37 ` Jim Porter
2024-05-07 8:50 ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86cypybx3f.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=70792@debbugs.gnu.org \
--cc=jporterbugs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.