From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16697 invoked from network); 14 Apr 2022 17:27:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Apr 2022 17:27:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1649957260; b=d9Nu0f+twQ6i59h1HrdsbSNRBY5OGvXgqVJh/4V8Uw2kUkFhh3ywRGtmSyZkhDksJLVvPO48Eb dS41zYib7mw9+6fo3j3yBDtiOQ67Iryz/1Z414uXxQbuMty3jupNEjgP5uyPFvHVLWpnkL1OTT WiIatzye6z88/Bouei39xlfhFnVmSNCRyrVGDX40D9q5HjKBf6T66eBywhMbcZXjxQ/5skCha9 PLKY+jz5IspFUqSK+ksKEHiXWyszYfTRVs+mZo86bHjUUFQWdV4UZ60uPUXriBpH2qaT8EL88w seEGkoNRqHQhTR+AWmn26OTjLci7IdmnYc6y7+kQI/14kg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (sym.noone.org) smtp.remote-ip=178.63.92.236; dmarc=none header.from=deuxchevaux.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1649957260; bh=SzMCcfotRjQzmzkv1+88+P9PUMUS0Nqsr/VdD37BHI0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:DKIM-Signature; b=B9vItGQEX3P1MTnZcYMObM3QljxL/qHFaFivIrVmC/AiUYE5RLnQKk5mN5TGR8EJ5G2SZtvIQu XJn0JAR01jXhDrwlO1Zyv3EFRm3UcSCrgREYZF0zRuVq70SD2+pnxitigKcXQyZQLSbv4MEHE/ cS8ssdWBJcoQ1nGy1QU/lLLm30OIFh522313PvDQXv//kgUoJLLIsNP9ie9wtme/gz7vrYnczA rYjPOmi4/ytKTg/yzdgnBdV0oJ//KTBho9GvR25CfRH2rSYZCB4wHwRAG+4A82EkQ0NIs4e0jZ +i18PLjBvDLB9lec/MGt62BhYSvMNTC+tTboLYxZ0Prekw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=MnkO5EyoBBnvNz1r2Sg5ShNeODoUxFc0B3AXyf3jShM=; b=YB8oJl6LEh+JW5TH/zVcQsOcC1 r2+hfOcZ57UJEF1+pP0H0z7yES3T1j4u+ew5UCuF8XPGnuMgyM0tGRKiR3HuvIDIdk6G5gXRkqNQK eKwgDiOqmZvHJ714JYI3fN/FGlSJ5GW41sVmLIMlwAydCwIaH+LkXnUS5liY+yMv1xP1ZMc1xOS+R NJQkRZveRFCJCYc7Zb+/3bgp70FLvLCCjsUxwWmNWo1tSN4u2Z/FsFmfvR0i5rHLl4fnTIiB8+SB5 ZMOxtwi1vdyzeYuACvzg+TbOD8DsQExBlj79LeQ9sC0lKhalasizwoeOpcww+HsV7B8rYfgvvUeIR q4hIIJpA==; Received: from authenticated user by zero.zsh.org with local id 1nf3Fr-000GTz-AN; Thu, 14 Apr 2022 17:27:39 +0000 Authentication-Results: zsh.org; iprev=pass (sym.noone.org) smtp.remote-ip=178.63.92.236; dmarc=none header.from=deuxchevaux.org; arc=none Received: from sym.noone.org ([178.63.92.236]:38404 helo=sym2.noone.org) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1nf3FY-000G9c-2u; Thu, 14 Apr 2022 17:27:20 +0000 Received: by sym2.noone.org (Postfix, from userid 1000) id 4KfRGv3BhQzvjfn; Thu, 14 Apr 2022 19:27:19 +0200 (CEST) Date: Thu, 14 Apr 2022 19:27:18 +0200 From: Axel Beckert To: zsh-workers@zsh.org Subject: Re: OpenSSH scp completion reminder Message-ID: <20220414172717.nfjrqfa7ebm5xloo@sym.noone.org> Mail-Followup-To: zsh-workers@zsh.org References: <20220414161814.k5jtyuzyony2axz5@sym.noone.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux 4.9.0-18-amd64 X-Machine: sym2 x86_64 X-Editor: GNU Emacs 25.1.1 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAAAAAC3mUtaAAAABGdBTUEAALGPC/xhBQAAADh0RVh0U29mdHdhcmUAWFYgVmVyc2lvbiAzLjEwYSAgUmV2OiAxMi8yOS85NCAoUE5HIHBhdGNoIDEuMindFS5JAAACGElEQVQ4jXXQMU8UYRDG8f8shNjdDH4AbpfGDjAWlKiJiZ0ajL1aGCvsNCbGaCGG1koLaztaTYz6ATy+gOyehYmF3MxVxgg3FnDsHcTpJr/M+8w7Rf6nCsaVTTDqxbg9hoOXmw83H71+Eyfg4E1d7/Z2fG9rGkZbTQiu+K+3U/C+76lmkvAhJuDndnoAiftou4V84okAGclop4U/jYACZDTxrYWP0gkxVfAm/W//GLZpxIzwIN0Hn8dw0B+IWkZmQmRsj2HfhwokEklHfNCCiQCRgAR7YyhQVRVTCKCzP4Y5zBBE0t0zY3Q8oQaBqqAMlVEcgVQd9706zGirAFium8HXumlMIeMwqQCInju+2+uB6MRENupdpMt8pRlHZyuAW0F+Mb6XSIVqtxjD+iVmVqqystLEzFTGT92YqRaXpNT5eTVjeJhbALPnrTxLUZUKZsgxcNm64hAOYisT/xhF+oKTGU5RegtC3Rt6eEDi/QnIevdTx9Md2EMmYBRmCQR1026FCGQQJJExsRUqgkMGaWSbwYLnoO4T6VgpbQbdELPMBAHWWrhYrcxXnYgAsatPWygkFCBD4K62MAsOTqA6szYRPpsu6e6Y8mPiVrBMNuGIMrgwBUu4p2DgG1Ownu6hpuTv7hScefHAzAC/yRRw5U5pALMbJ4AUALvHSZhxgHPXTsHcdWD1GadAHr9avP+c0wCr7263Df8ASLwXWHWs+KIAAAAHdElNRQfYBQEBODPr Organization: DeuxChevaux.org -- The =?iso-8859-1?Q?Citr?= =?iso-8859-1?B?b+tu?= 2CV Database User-Agent: NeoMutt/20170113 (1.7.2) X-Seq: 50065 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Hi, On Thu, Apr 14, 2022 at 10:04:42AM -0700, Bart Schaefer wrote: > On Thu, Apr 14, 2022 at 9:43 AM Axel Beckert wrote: > > On Thu, Apr 14, 2022 at 11:20:34AM -0400, Phil Pennock wrote: > > > This change impacts quoting of things like whitespace. > > > Which I have assumed will impact zsh completion. > > > > 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. > > Completion itself doesn't use scp to do the remote file name > generation, it uses plain ssh. Of course once the file names are > returned, getting the quoting right for the actual scp invocation is > down to what appears on the command line, so the only way completion > could be implicated in messing this up is if it somehow automatically > inserted the wrong quoting. Yep, and that's the point: In theory, the amount of quoting (e.g. three backslashes vs one backslash) is expected to be different with the different scp backends. But for some reason the variant with three backslashes still worked for me with OpenSSH 9.0 on the client side which defaults to use the SFTP backend which does no shell globbing or escaping on the server side. To copy a file named "tmp/foo bar" from remotehost to my local directory "tmp/", I did: % scp -p remotehost:tmp/foo tmp/ It expanded to: % scp -p remotehost:tmp/foo\\\ bar tmp/ Accoding to the docs, this does no more work with OpenSSH 9.0's default settings, but it did. Running "scp" with "-vvvv" confirms that the new default (SFTP backend) is used: scp -pvvvv remotehost:tmp/foo\\\ bar tmp/ |& fgrep tmp/foo scp: debug3: sink_sftp: copying remote tmp/foo\\ bar to local tmp/ scp: debug1: Fetching tmp/foo bar to tmp/foo bar scp: debug2: do_download: download remote "tmp/foo bar" to local "tmp/foo bar" scp: debug2: Sending SSH2_FXP_STAT "tmp/foo bar" scp: debug2: Sending SSH2_FXP_OPEN "tmp/foo bar" scp: debug3: Sent remote message SSH2_FXP_OPEN I:4 P:tmp/foo bar M:0x0001 It seems as if scp has some capability to recognize of there's too much shell quoting in a file name and reducres it, since there are still two backslashes in the first line with "debug3:" which vanish after that line. And this even seems to go wrong if I want to copy a file created with "touch 'foo\ bar'", i.e. with an backslash in there. I would have had expected that OpenSSH 9.0 would fetch that file with "scp -p remotehost:tmp/foo\\\ bar tmp/" but it actually stripped the file name down and I needed five backslashes: scp -pvvvv remotehost:tmp/foo\\\\\ bar tmp/ |& fgrep tmp/foo scp: debug3: sink_sftp: copying remote tmp/foo\\\\ bar to local tmp/ scp: debug1: Fetching tmp/foo\\ bar to tmp/foo\\ bar scp: debug2: do_download: download remote "tmp/foo\\ bar" to local "tmp/foo\\ bar" scp: debug2: Sending SSH2_FXP_STAT "tmp/foo\\ bar" scp: debug2: Sending SSH2_FXP_OPEN "tmp/foo\\ bar" scp: debug3: Sent remote message SSH2_FXP_OPEN I:4 P:tmp/foo\\ bar M:0x0001 Looks like either a bug in OpenSSH 9.0 or an undocumented compatibility feature to me. Kind regards, Axel -- PGP: 2FF9CD59612616B5 /~\ Plain Text Ribbon Campaign, http://arc.pasp.de/ Mail: abe@deuxchevaux.org \ / Say No to HTML in E-Mail and Usenet Mail+Jabber: abe@noone.org X https://axel.beckert.ch/ / \ I love long mails: https://email.is-not-s.ms/