meew0 / namida

Fast file transfer over high-latency connections (Tsunami UDP but modernised)
Other
4 stars 1 forks source link

Duplicate filenames in different subdirectories causes error #4

Open jebriggsy opened 3 weeks ago

jebriggsy commented 3 weeks ago

While testing a file tree like so

# tree
.
├── test1
│   └── example.txt
└── test2
    └── example.txt

3 directories, 2 files

With this get command:

$ ./namida get --server 192.168.100.1 --all
namida client for protocol revision 5 (block size = 1024, magic = 0xf0400805)
Version: 0.5.0 (revision 782ab6b)
Compiled: 2024-10-01 15:35:33 UTC

Encrypted session established.
Requesting all indexed files

Server is sharing 2 files
Multi-GET of 2 files:
 ./test2/example.txt (5 bytes)
 ./test1/example.txt (5 bytes)
Receiving data over UDP at: 0.0.0.0:48384
Transfer complete. Flushing to disk and signaling server to stop...
PC performance figure : 0 packets dropped (if high this indicates receiving PC overload)
Transfer duration     : 0.00 seconds
Total packet data     : 0.01 Mbit
Goodput data          : 0.01 Mbit
File data             : 0.00 Mbit
Throughput            : 25.36 Mbps
Goodput w/ restarts   : 25.36 Mbps
Final file rate       : 0.12 Mbps
Transfer mode         : lossless

File 'example.txt' is already present locally — resuming previous transfer.
Receiving data over UDP at: 0.0.0.0:52229
Error: Io { inner: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }, additional: 2 

Results in this error:

# RUST_BACKTRACE=full namida serve . --verbose
namida server for protocol revision 5 (block size = 1024, magic = 0xf0400805)
Version: 0.5.0 (revision 782ab6b)
Compiled: 2024-10-01 15:35:33 UTC

The specified 2 files will be served:
   1   ./test2/example.txt   5 bytes
   2   ./test1/example.txt   5 bytes

Buffer size: 20000000
Bind: 0.0.0.0:51038

Waiting for clients to connect.
New client connecting from 192.168.100.4:43938...
Encrypted session established.
Client authenticated. Negotiated parameters are:
Block size: 1024
Buffer size: 20000000
Encryption: yes
Request for file: './test2/example.txt'
Sending to client 192.168.100.4:41931
Transmission of ./test2/example.txt complete.
Server 0 transferred 5 bytes in 0.32 seconds (0.0 Mbps)
Request for file: './test1/example.txt'
Sending to client 192.168.100.4:42066
thread '<unnamed>' panicked at src/common.rs:171:10:
chunk size is 0
stack backtrace:
   0:     0x563e20e6f610 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h59aa4ab5fa344d96
   1:     0x563e20e8bc13 - core::fmt::write::h534f790308ebd928
   2:     0x563e20e74f4f - std::io::Write::write_fmt::h9e0734b2cfb85876
   3:     0x563e20e6f410 - std::sys_common::backtrace::print::hcd0c25b5bfaabbee
   4:     0x563e20e69609 - std::panicking::default_hook::{{closure}}::h198b09d53f00f0aa
   5:     0x563e20e692fa - std::panicking::default_hook::h2786a051ab5a848e
   6:     0x563e20e69a39 - std::panicking::rust_panic_with_hook::h911d419a5d4d8529
   7:     0x563e20e6fc96 - std::panicking::begin_panic_handler::{{closure}}::h064fff4b44492fde
   8:     0x563e20e6fad9 - std::sys_common::backtrace::__rust_end_short_backtrace::hf407e812ddd476e8
   9:     0x563e20e69757 - rust_begin_unwind
  10:     0x563e20d55563 - core::panicking::panic_fmt::he104022ca00387f2
  11:     0x563e20d5531b - core::option::expect_failed::h04c7818b2b3689a2
  12:     0x563e20d853f9 - namida::common::calculate_checksums::h33cef937c7b1bb38
  13:     0x563e20d9bd45 - namida::server::protocol::resume::h6851ae6269c7a469
  14:     0x563e20d91dd5 - namida::server::main::client_handler::h09347c0432e8a266
  15:     0x563e20d9d61a - std::sys_common::backtrace::__rust_begin_short_backtrace::h2c4870118e074894
  16:     0x563e20d7eddb - core::ops::function::FnOnce::call_once{{vtable.shim}}::h523643b5832710a9
  17:     0x563e20e6b7fb - std::sys::pal::unix::thread::Thread::new::thread_start::he3fc7c91dab3dea8
  18:     0x7f6f5b04a732 - <unknown>
  19:     0x7f6f5b0c52b8 - <unknown>
  20:                0x0 - <unknown>

Error does not occur when using the --tree argument

jebriggsy commented 3 weeks ago

This probably isn't really it's own issue and would be resolved with whatever the solution is to #5