Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 566030 - >=net-misc/openssh-6.8_p1: sftp: "put -r ." doesn't work
Summary: >=net-misc/openssh-6.8_p1: sftp: "put -r ." doesn't work
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL: https://bugzilla.mindrot.org/show_bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-17 08:57 UTC by Zoltán Halassy
Modified: 2016-02-11 02:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build_log.txt,213.31 KB, text/plain)
2015-11-18 09:34 UTC, Zoltán Halassy
Details
emerge --info (emerge_info.txt,5.35 KB, text/plain)
2015-11-18 09:34 UTC, Zoltán Halassy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltán Halassy 2015-11-17 08:57:45 UTC
After upgrading OpenSSH from 6.9 to 7.1, recursive sftp upload via the "put" command got broken.

Reproducible: Always

Steps to Reproduce:
0. Install latest net-misc/openssh ebuild (7.1_p1-r2)
$ sudo emerge -v1 openssh

1. create a folder locally, put two files in it, and "cd" into it.
$ mkdir test && cd test && touch test1 && touch test2

2. use the sftp command to log in to some server and get the interactive sftp prompt
$ sftp remoteserver

3. issue "put -r ." command
sftp> put -r .
Actual Results:  
Uploading ./ to /home/user/.
Entering ./

But the code stops there, no files gets uploaded. Prompt is given back.

Expected Results:  
Uploading ./ to /home/user/.
Entering ./
./test1 100%    0     0.0KB/s   0.0KB/s   00:00    
./test2 100%    0     0.0KB/s   0.0KB/s   00:00    


OpenSSH did not have this problem. Didn't try 7.0
Comment 1 Zoltán Halassy 2015-11-17 09:04:46 UTC
Sorry, meant "OpenSSH 6.9 did not have this problem."
Comment 2 SpanKY gentoo-dev 2015-11-17 21:00:54 UTC
please attach emerge info and full build log to every bug report
Comment 3 Zoltán Halassy 2015-11-18 09:34:24 UTC
Created attachment 417268 [details]
build.log
Comment 4 Zoltán Halassy 2015-11-18 09:34:56 UTC
Created attachment 417270 [details]
emerge --info
Comment 5 SpanKY gentoo-dev 2016-01-15 17:42:14 UTC
are you sure this ever worked ?  i can't find a version where it does ... tested back to 6.8.

doing "put -r dir" works, but "put -r ." always fails.  reading the sftp straces, it's because the remote does mkdir(/home/user/) which returns -1/EEXIST, and then the server returns a failure to the client.
Comment 6 Zoltán Halassy 2016-01-16 12:01:42 UTC
Yes, it worked. We noticed this actually when one of our deployment scripts (which we used for several months) got broken right after upgrading. In the script we invoked "sftp -r", then used "put .". Also we knew the remote directory existed, we only overwrote the files and subdirectories.
Comment 7 SpanKY gentoo-dev 2016-01-16 18:31:34 UTC
please find an exact version that worked as well as the exact script you used.  i cannot verify your example with any version between 6.8 and 7.1.  reading the code indicates this never worked.
Comment 8 Zoltán Halassy 2016-01-18 14:08:52 UTC
Found an older system where the old code works:

user@server ~/test $ ssh -V
OpenSSH_6.6p1-hpn14v4, OpenSSL 1.0.2d 9 Jul 2015

user@server ~/test $ ls -l
drwxr-xr-x 2 user users 6 jan   18 15.03 a/
drwxr-xr-x 2 user users 6 jan   18 15.03 b/
drwxr-xr-x 2 user users 6 jan   18 15.03 c/

user@server ~/test $ sftp 127.0.0.1 <<<'put -r .'
Password: 
Connected to 127.0.0.1.
sftp> put -r .
Uploading ./ to /home/user/.
Entering ./
Entering ./a
Entering ./b
Entering ./c
Comment 9 SpanKY gentoo-dev 2016-01-18 21:57:46 UTC
(In reply to Zoltán Halassy from comment #8)

what is the server version ?  client & server matter.  you can check by doing:
$ nc localhost 22 <<<''

what is your server config set to for sftp ?  just attach your sshd_config file.
Comment 10 Zoltán Halassy 2016-01-19 09:14:23 UTC
It's the same.

$ socat - tcp:localhost:22 <<<''
SSH-2.0-OpenSSH_6.6p1-hpn14v4
Protocol mismatch.

Content of the used sshd_config:

PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication yes
KerberosAuthentication yes
KerberosOrLocalPasswd yes
KerberosTicketCleanup yes
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
GSSAPIStrictAcceptorCheck yes
UsePAM yes
PrintMotd no
PrintLastLog no
UsePrivilegeSeparation sandbox
Subsystem       sftp    /usr/lib64/misc/sftp-server
AcceptEnv LANG LC_*
Comment 11 SpanKY gentoo-dev 2016-01-19 16:58:53 UTC
i guess i should have tried going back one more version because 6.8_p1 was the first to fail ;)
Comment 12 SpanKY gentoo-dev 2016-01-19 18:27:03 UTC
moved bug report upstream since it's not critical (just use rsync instead) and we won't be fixing/patching it independently
Comment 13 SpanKY gentoo-dev 2016-02-11 02:52:01 UTC
upstream has fixed it with this small patch:
https://github.com/openssh/openssh-portable/commit/e30cabfa4ab456a30b3224f7f545f1bdfc4a2517

should be in the next release