SCP with Resume Feature

rapier rapier at psc.edu
Tue Apr 6 00:51:47 AEST 2021



On 4/4/21 9:45 PM, Jim Knoble wrote:
>> [...] I also cannot figure out why I can append directly to the target 
>> file. After opening the file I'd seek to the end but the bytes would 
>> still start at the 0th byte. I'm probably missing something in 
>> atomicio. Writing the temp file and then appending works and it's not 
>> taking up a lot of cycles but it doesn't feel like the 'right' way to 
>> do it.
> 
> This certainly does sound suboptimal. Maybe if you post the code?

In context the you can see the code at 
https://github.com/rapier1/openssh-portable/blob/resume-scp/scp.c

The diff is available at: https://pastebin.com/icXjV2JP

Honestly, I have no idea why the direct append isn't working. In 'sink' 
the code opens ofd with an open. I had initially tried doing an lseek to 
the end of the file which didn't work. Then I tried open the file with 
O_APPEND and that didn't work either. I think the issue is in atomicio6 
but modifying that would be more intrusive than I would like for this 
issue.

Chris


More information about the openssh-unix-dev mailing list