public inbox for nncp-devel@lists.cypherpunks.ru
Atom feed
From: AsmodeusB <asmodeusb@gmail•com>
To: nncp-devel@lists.cypherpunks.ru
Subject: Bug with chunked files
Date: Fri, 28 Apr 2023 12:42:10 -0400	[thread overview]
Message-ID: <CAACH8H8DrR-eeGFT1_gxuaWm2XkcLepq7cqMLf0nTt4uckZ7GA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

It looks like there is a bug with chunked files where the file size is an
integer multiple of the chunk size.

Version: 8.8.2 built with go1.19.3
(debian-backports 8.8.2-2~bpo11+1 linux amd64)

To replicate:
- Create a file that is exactly 1MB, for example (1048576 bytes)
  dd if=/dev/random bs=1M count=1 of=1m
- nncp-file to send it, -chunked 512  (or 256, 128, 64, 32, 16, 8, 4, 2, 1)
(I was using nncp-xfer to transfer)
- nncp-toss to get the .chunk and .meta files on the destination node in
incoming/
- nncp-reass the file to hit the error:

ERROR Reassembling chunked file "/var/spool/incoming/1m.nncp.meta": chunk
1: invalid size
(this was using 512k chunks; it's always the last chunk it complains about)

If the chunks are concatenated together, the original file is recovered, so
the issue appears to be with nncp-reass, not creation or transmission.

If the file is instead one byte smaller (1048575 bytes), it reassembles
without error; same with one byte larger.

The problem isn't related to a power of 2.  For example, a 6KB file (6144
bytes) -chunked 3, 2, or 1 will hit the same error.

[-- Attachment #2: Type: text/html, Size: 1440 bytes --]

             reply	other threads:[~2023-04-28 16:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 16:42 AsmodeusB [this message]
2023-04-29 11:07 ` Bug with chunked files Sergey Matveev
2023-05-01 17:16   ` AsmodeusB