On Thu, 27 Jan 2022, Dmitry Belyavskiy wrote:> Hello, > > When we use scp in sftp mode to copy folder to the machines with the "old" > version of ssh, we get the following error: > =====> $ scp -vvv -r test/ touser at machine:/home/touserWhat version of OpenSSH are you using? There are a bunch of fixes in git HEAD after 8.8.> If I understand correctly, the failure is caused by the lack of the " > expand-path at openssh.com" > extension to sftp protocol in old releases and (lack of) processing it on > the server side.No, that extension is only invoked when a ~-prefixed path is used. AFAIK this was juat a behaviour difference: scp in sftp mode wasn't creating the destination directory if it didn't exist, whereas legacy scp would do so. It was fixed in the commit you identify below.> For the recent version self-compatibility it was fixed in > https://github.com/openssh/openssh-portable/commit/ac7c9ec894ed0825d04ef69c55babb49bab1d32e-d
Dear Damien, On Fri, Jan 28, 2022 at 1:40 AM Damien Miller <djm at mindrot.org> wrote:> On Thu, 27 Jan 2022, Dmitry Belyavskiy wrote: > > > Hello, > > > > When we use scp in sftp mode to copy folder to the machines with the > "old" > > version of ssh, we get the following error: > > =====> > $ scp -vvv -r test/ touser at machine:/home/touser > > What version of OpenSSH are you using? There are a bunch of fixes in git > HEAD after 8.8. > > > If I understand correctly, the failure is caused by the lack of the " > > expand-path at openssh.com" > > extension to sftp protocol in old releases and (lack of) processing it on > > the server side. > > No, that extension is only invoked when a ~-prefixed path is used. > > AFAIK this was juat a behaviour difference: scp in sftp mode wasn't > creating the destination directory if it didn't exist, whereas legacy > scp would do so. It was fixed in the commit you identify below. > > > For the recent version self-compatibility it was fixed in > > > https://github.com/openssh/openssh-portable/commit/ac7c9ec894ed0825d04ef69c55babb49bab1d32e > > -d > > I've just retested with the recent master$ ./scp -S `pwd`/ssh -vvv -r -s `pwd`/openbsd-compat/ user at machine: debug2: subsystem request accepted on channel 0 ./scp: debug2: Remote version: 3 ./scp: debug2: Server supports extension "posix-rename at openssh.com" revision 1 ./scp: debug2: Server supports extension "statvfs at openssh.com" revision 2 ./scp: debug2: Server supports extension "fstatvfs at openssh.com" revision 2 ./scp: debug2: Server supports extension "hardlink at openssh.com" revision 1 ./scp: debug2: Server supports extension "fsync at openssh.com" revision 1 ./scp: debug2: Server supports extension "lsetstat at openssh.com" revision 1 ./scp: debug2: Sending SSH2_FXP_STAT "/root" ./scp: debug3: Sent message fd 6 T:17 I:1 ./scp: debug3: Received stat reply T:105 I:1 F:0x000f M:40550 ./scp: debug3: source_sftp: copying local /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat to remote /root/openbsd-compat ./scp: debug2: Sending SSH2_FXP_REALPATH "/root/openbsd-compat" ./scp: debug3: Sent message fd 6 T:16 I:2 ./scp: realpath /root/openbsd-compat: No such file ./scp: upload "/root/openbsd-compat": path canonicalization failed ./scp: failed to upload directory /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat to /root/openbsd-compat The failure occurs even when I specify absolute paths on the source/destination machine. The destination machine has OpenSSH_8.0p1 with patches. -- Dmitry Belyavskiy
Dear Damien, Sorry for being repetitive - but should we consider it to be a known limitation? Many thanks in advance! On Fri, Jan 28, 2022 at 10:53 AM Dmitry Belyavskiy <dbelyavs at redhat.com> wrote:> Dear Damien, > > On Fri, Jan 28, 2022 at 1:40 AM Damien Miller <djm at mindrot.org> wrote: > >> On Thu, 27 Jan 2022, Dmitry Belyavskiy wrote: >> >> > Hello, >> > >> > When we use scp in sftp mode to copy folder to the machines with the >> "old" >> > version of ssh, we get the following error: >> > =====>> > $ scp -vvv -r test/ touser at machine:/home/touser >> >> What version of OpenSSH are you using? There are a bunch of fixes in git >> HEAD after 8.8. >> >> > If I understand correctly, the failure is caused by the lack of the " >> > expand-path at openssh.com" >> > extension to sftp protocol in old releases and (lack of) processing it >> on >> > the server side. >> >> No, that extension is only invoked when a ~-prefixed path is used. >> >> AFAIK this was juat a behaviour difference: scp in sftp mode wasn't >> creating the destination directory if it didn't exist, whereas legacy >> scp would do so. It was fixed in the commit you identify below. >> >> > For the recent version self-compatibility it was fixed in >> > >> https://github.com/openssh/openssh-portable/commit/ac7c9ec894ed0825d04ef69c55babb49bab1d32e >> >> -d >> >> I've just retested with the recent master > > $ ./scp -S `pwd`/ssh -vvv -r -s `pwd`/openbsd-compat/ user at machine: > > debug2: subsystem request accepted on channel 0 > ./scp: debug2: Remote version: 3 > ./scp: debug2: Server supports extension "posix-rename at openssh.com" > revision 1 > ./scp: debug2: Server supports extension "statvfs at openssh.com" revision 2 > ./scp: debug2: Server supports extension "fstatvfs at openssh.com" revision 2 > ./scp: debug2: Server supports extension "hardlink at openssh.com" revision 1 > ./scp: debug2: Server supports extension "fsync at openssh.com" revision 1 > ./scp: debug2: Server supports extension "lsetstat at openssh.com" revision 1 > ./scp: debug2: Sending SSH2_FXP_STAT "/root" > ./scp: debug3: Sent message fd 6 T:17 I:1 > ./scp: debug3: Received stat reply T:105 I:1 F:0x000f M:40550 > ./scp: debug3: source_sftp: copying local > /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat to remote > /root/openbsd-compat > ./scp: debug2: Sending SSH2_FXP_REALPATH "/root/openbsd-compat" > ./scp: debug3: Sent message fd 6 T:16 I:2 > ./scp: realpath /root/openbsd-compat: No such file > ./scp: upload "/root/openbsd-compat": path canonicalization failed > ./scp: failed to upload directory > /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat to > /root/openbsd-compat > > The failure occurs even when I specify absolute paths on the > source/destination machine. > > The destination machine has OpenSSH_8.0p1 with patches. > > -- > Dmitry Belyavskiy >-- Dmitry Belyavskiy