Bug 2528 - sftp "put -r ." broken starting with 6.8
Summary: sftp "put -r ." broken starting with 6.8
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: 6.8p1
Hardware: All All
: P5 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_7_2
  Show dependency treegraph
 
Reported: 2016-01-20 05:25 AEDT by Mike Frysinger
Modified: 2018-04-06 12:26 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2016-01-20 05:25:59 AEDT
here's the testcase:
  cd ~/
  rm -rf test x
  mkdir -p x/test
  touch x/test/{1,2,3}
  cd x
  sftp localhost <<<'put -r .'

with openssh-6.7 and older, you'd get:
Connected to localhost.
sftp> put -r .
Uploading ./ to /home/vapier/.
Entering ./
Entering ./test
./test/3   100%    0     0.0KB/s   00:00
./test/2   100%    0     0.0KB/s   00:00
./test/1   100%    0     0.0KB/s   00:00

starting with openssh-6.8, you get:
Connected to localhost.
sftp> put -r .
Uploading ./ to /home/vapier/.
Entering ./

and nothing is actually uploaded.  the failure is due to the remote doing mkdir(/home/vapier/.), getting EEXIST, and then returning an error to the client which makes it stop.

bisecting the public github repo shows the first bad commit is this one:
https://github.com/openssh/openssh-portable/commit/7d845f4a0b7ec97887be204c3760e44de8bf1f32
(i had to cherry pick 0cdc5a3eb6fb383569a4da2a30705d9b90428d6b and 83b9678a62cbdc74eb2031cf1e1e4ffd58e233ae to get it to build)

its parent obviously works fine too:
https://github.com/openssh/openssh-portable/commit/139ca81866ec1b219c717d17061e5e7ad1059e2a

it might be that the new one is doing more error checking, but it seems like the server or client should handle EEXIST correctly.
Comment 2 Damien Miller 2018-04-06 12:26:44 AEST
Close all resolved bugs after release of OpenSSH 7.7.