zsh-users
 help / color / mirror / code / Atom feed
* path expansion on remote host
@ 2014-06-10 14:24 Sepp Tannhuber
  2014-06-10 15:58 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sepp Tannhuber @ 2014-06-10 14:24 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Dear all,

when I type
  scp /u/lo/li
and press the Tab key, it is expanded to
  scp /usr/local/lib
But when I do the same on a remote host
  scp user@remotehost:/u/lo/li
the expansion fails. However path expansion
works for the last part, e.g.
  scp user@remotehost:/usr/local/l
is expanded correctly. Why does it fail in the
second case? And how can I fix it?

Best regards
Joseph

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: path expansion on remote host
  2014-06-10 14:24 path expansion on remote host Sepp Tannhuber
@ 2014-06-10 15:58 ` Bart Schaefer
  2014-06-10 16:38   ` Sepp Tannhuber
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2014-06-10 15:58 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]

On Tue, Jun 10, 2014 at 7:24 AM, Sepp Tannhuber <sepp.tannhuber@yahoo.de>
wrote:

>
> But when I do the same on a remote host
>   scp user@remotehost:/u/lo/li
> the expansion fails.
>

Partial path expansion depends on having access to the filesystem to
examine each component of the directory in turn, i.e., find what may be
many possible completions for the first component, then look again below
those possible matches for completions of the next component, etc. -- a
full tree search.  It should be pretty obvious that a remote system's files
aren't readily available for that.  The remote system might not even have
zsh, and even if it does would not have the completion system loaded
because it's not an interactive shell, so there's nothing available on the
remote system to perform that tree search.

To "fix" this, you'd have to re-implement the _path_files helper function
to do remote shell accesses for every level of tree search that it locally
performs with simple globbing, and then you'd have to be willing to pay the
time/network cost for a potentially very large number of round-trips to the
remote system while the search proceeds.  In the end you'd probably find
it's faster to just type remotehost:/u<TAB>/lo<TAB>/li<TAB>.

(There is an alternative, which would be to use _multi_parts as is used on
e.g. tar archives, but that would require dumping a recursive listing of
most of the remote filesystem over the network so that it could be searched
locally for matches.  I don't think you want that either.)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: path expansion on remote host
  2014-06-10 15:58 ` Bart Schaefer
@ 2014-06-10 16:38   ` Sepp Tannhuber
  0 siblings, 0 replies; 3+ messages in thread
From: Sepp Tannhuber @ 2014-06-10 16:38 UTC (permalink / raw)
  To: Bart Schaefer, zsh-users

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

Thank you for the detailed explanation. Now I understand. I can
live with it how it is.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-10 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 14:24 path expansion on remote host Sepp Tannhuber
2014-06-10 15:58 ` Bart Schaefer
2014-06-10 16:38   ` Sepp Tannhuber

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).