Hello, After a deeper investigation I think I can explain what happens. Special thanks to Jakub Jelen who did the server side investigation. Red Hat Enterprise Linux 8 series is based on OpenSSH 8.0, which is rather old. Soon after the OpenSSH 8.0 was published, the upstream introduced a server-side fix for sftp, which changes the use of POSIX realpath (on LInux) to the OpenBSD one with various quirks: https://github.com/openssh/openssh-portable/commit/569b650f93b561c09c655f83f128e1dfffe74101 If the OpenBSD realpath is in use on the server, the current master successfully copies directories using scp in SFTP mode. Otherwise problems occur. As RHEL 8 series will definitely be in wide use for several more years, I kindly ask the OpenSSH upstream to consider this patch, which is trying to workaround the server side on the client side: https://github.com/openssh/openssh-portable/pull/299 It's a slightly tidied up version of the POC patch I've sent to this ML before. Many thanks in advance! On Fri, Feb 4, 2022 at 11:15 AM Dmitry Belyavskiy <dbelyavs at redhat.com> wrote:> > > On Fri, Feb 4, 2022 at 7:29 AM Dan Yefihmov <dan at lightwave.net.ru> wrote: > >> On February 3, 2022 3:03:25 PM GMT+03:00, Dmitry Belyavskiy < >> dbelyavs at redhat.com> wrote: >> >Dear Damien, >> > >> >Here is a proof-of-concept patch fixing this issue for me. If it could be >> >polished, it would be great. >> > >> Didn't you forget to free both error message string and ssh buffer in the >> error path after do_mkdir? >> > > I did, and there are definitely more problems related to this patch. I'll > try to elaborate a better version. > > -- > Dmitry Belyavskiy >-- Dmitry Belyavskiy
Dmitry Belyavskiy wrote:> As RHEL 8 series will definitely be in wide use for several more years, I > kindly ask the OpenSSH upstream to consider this patch, which is trying to > workaround the server side on the client side:I find it rude and quite outrageous to push a burden of compatibility with a paid-for commercial product onto an open source project. It's asking for the wrong solution in the wrong place. If RHEL doesn't work as you like then you should obviously engage RH to get them to qualify the software you want their product to have. Now, if you can make a case explicitly for how OpenSSH git can improve compatibility with older releases of upstream OpenSSH then that could be a different story, and if you do so smartly it might also benefit your commercial systems. //Peter
On Fri, Feb 4, 2022 at 10:36 AM Dmitry Belyavskiy <dbelyavs at redhat.com> wrote:> Red Hat Enterprise Linux 8 series is based on OpenSSH 8.0, which is > rather old. > > Soon after the OpenSSH 8.0 was published, the upstream introduced a > server-side fix for sftp, which changes the use of POSIX realpath > (on Linux) to the OpenBSD one with various quirks: > > https://github.com/openssh/openssh-portable/commit/569b650f93b561c09c655f83f128e1dfffe74101 > > If the OpenBSD realpath is in use on the server, the current master > successfully copies directories using scp in SFTP mode. Otherwise > problems occur. > > As RHEL 8 series will definitely be in wide use for several more > years, I kindly ask the OpenSSH upstream to consider this patch, > which is trying to workaround the server side on the client side: > > https://github.com/openssh/openssh-portable/pull/299 > > It's a slightly tidied up version of the POC patch I've sent to this > ML before.Something else to consider: RHEL8 is still in Full Support phase: https://access.redhat.com/support/policy/updates/errata/ While Red Hat almost never updates software packages to new versions within the same release of RHEL, Red Hat will frequently apply patches, so long as: 1. The version of RHEL for which you are requested the patch is still under the Full Support phase. 2. The patch has already been accepted by upstream; that is, you are requesting a backport of a feature / bugfix that was officially added to the package after that version of RHEL shipped. Both of these are true for RHEL8: RHEL8 is under Full Support through 2024, and the patch in question is part of the official OpenSSH portable distribution. The patch is also small and reasonably self-contained. While it would be nice if later OpenSSH sftp client versions could work around OpenSSH sftp server versions that still use the POSIX realpath() function instead of the OpenBSD sftp_realpath() function, fixing the RHEL8 sftp server would be nice, too. What I normally do in cases like this is open a polite and thorough Bugzilla bug to request the feature/patch, then open a Red Hat support case and refer to the Bugzilla bug. I?ve had pretty good success over the years getting fixes into RHEL with this approach.