Skip to content

Files received by the SFTP server component are not valid

Here is my scenario:

I declared a simple rule to just receive the file:

$ wg rule get recv receive● Rule recv (receive)
    Comment:        
    Path:           /path
    In directory:   
    Out directory:  
    Work directory: 
    Pre tasks:
    Post tasks:
    Error tasks:
    Authorized agents:
    ├─Servers:          
    ├─Partners:         
    ├─Server accounts:  
    └─Partner accounts: 

I upload a file using this rule:

$ ls -ls /vagrant/data_1m.dat 
1236 -rw-r--r--. 1 vagrant vagrant 1264430 Dec  7  2020 /vagrant/data_1m.dat
$ lftp sftp://sftpclient:password@127.0.0.1:6621/ -e "set ssl:verify-certificate false;  set sftp:auto-confirm true; put -O /path /vagrant/data_1m.dat -o test-receive.txt; bye"
cd: Access failed: failed to retrieve rule for path '/' 
1264430 bytes transferred                                          

The transfer has no errors:

$ wg transfer list
No transfers found.

But the content of the file is incorrect:

$ sudo diff /var/lib/waarp-gateway/in/test-receive.txt /vagrant/data_1m.dat
Binary files /var/lib/waarp-gateway/in/file_sftpclient-r66server.dat and /vagrant/data_1m.dat differ

By opening the received file, I observed that (splitting the file in 32768 byte blocks) :

  • The first block just contains null bytes (\0)
  • The first block of the original file has been written as the 7th block of the received file.
Edited by Bruno Carlin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information