zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: zsh-workers@zsh.org
Subject: Re: OpenSSH scp completion reminder
Date: Thu, 14 Apr 2022 16:44:33 -0400	[thread overview]
Message-ID: <YliHsb367+0YjCBq@fullerene.field.pennock-tech.net> (raw)
In-Reply-To: <20220414161814.k5jtyuzyony2axz5@sym.noone.org>

On 2022-04-14 at 18:18 +0200, Axel Beckert wrote:
> I thought so as well, but I so far couldn't find anything which didn't
> work with zsh remote file completion with OpenSSH 9.0 on the client
> side. Otherwise I would have reported it.

What version was the server running?

With localhost being 9.0 for client and server and zsh 5.8, I see this
reproduction case; setup, then the results of tab-completion, and then
at the end a manually-constructed filename which definitely would not
have worked with older scp.

% pwd
/home/pdp/t3
% ls -lR
.:
total 4
drwxr-xr-x 2 pdp pdp 4096 Apr 14 16:31 'foo bar'$'\t''baz'

'./foo bar'$'\t''baz':
total 8
-rw-r--r-- 1 pdp pdp 4785 Apr 14 16:31 'An Artist - Foo Bar Baz.mp3'

% cd ~/Downloads/t
% scp localhost:t3/<TAB><TAB><ENTER>
% scp localhost:t3/foo\\\ bar\$\'\\t\'baz/An\\\ Artist\\\ -\\\ Foo\\\ Bar\\\ Baz.mp3 .
/opt/openssh/bin/scp: t3/foo\\ bar$'\\t'baz/An\\ Artist\\ -\\ Foo\\ Bar\\ Baz.mp3: No such file or directory

% scp $'localhost:t3/foo bar\tbaz/An Artist - Foo Bar Baz.mp3' .
An Artist - Foo Bar Baz.mp3                100% 4785     2.1MB/s   00:00

% ssh -V
OpenSSH_9.0p1, OpenSSL 1.1.1f  31 Mar 2020

So the good news is that scp in the new mode is "pass the filename
exactly as it really is, no escaping for the remote side, whatever
reaches us in argv[] is what will be used, so you only need to worry
about local shell escaping".

Note that scp(1) does not have a version flag, whereas ssh(1) does.
It might be reasonable to expect them to be paired.  Invoking `scp -O`
exits 1 in both versions below, but you can see the output text
differences.  -O to use original SCP protocol, -s to use sftp protocol.
-D is for local debugging.

So I think full support means knowing the version, knowing which version
switched the default behaviour (looks like 9.0 man-page might be wrong),
and then knowing which options have been set on the command-line already
for this version.

OpenSSH 9.0:
usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]
           [-i identity_file] [-J destination] [-l limit]
           [-o ssh_option] [-P port] [-S program] source ... target
OpenSSH 8.6:
/usr/bin/scp: unrecognized option: O
usage: scp [-346ABCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
            [-J destination] [-l limit] [-o ssh_option] [-P port]
            [-S program] source ... target

-Phil


  parent reply	other threads:[~2022-04-14 20:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 15:20 Phil Pennock
2022-04-14 16:18 ` Axel Beckert
2022-04-14 17:04   ` Bart Schaefer
2022-04-14 17:27     ` Axel Beckert
2022-04-14 17:34       ` Mikael Magnusson
2022-04-14 20:44   ` Phil Pennock [this message]
2022-04-15 12:46     ` Axel Beckert

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=YliHsb367+0YjCBq@fullerene.field.pennock-tech.net \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=zsh-workers@zsh.org \
    /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 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).