alexpdev / torrentfile

Bittorrent Protocol v1 & v2 metafile creator, checker, editor, builder, reviewer. Assemble .torrent files from the command line.
Apache License 2.0
43 stars 4 forks source link

libtorrent v2 creation broken #181

Closed AlyoshaVasilieva closed 6 months ago

AlyoshaVasilieva commented 1 year ago

Repro:

$ head -c 1048575 </dev/urandom >1mb-1.bin
$ torrentfile -m --meta-version 3 -a udp://tracker.opentrackr.org:1337/announce -o 1mb-1.bin.v3.torrent 1mb-1.bin

Loading this torrent file into qBittorrent (v4.5.3 libtorrent 2.0.9) and hashing against 1mb-1.bin results in 98.4% progress, missing the last piece. (Pieces: 64 x 16.0 KiB (have 63))

$ torrentfile -m --meta-version 2 -a udp://tracker.opentrackr.org:1337/announce -o 1mb-1.bin.v2.torrent 1mb-1.bin

Loading this torrent file into qBittorrent and hashing against 1mb-1.bin results in 0% progress.

$ torrentfile -m --meta-version 1 -a udp://tracker.opentrackr.org:1337/announce -o 1mb-1.bin.v1.torrent 1mb-1.bin

Loading this torrent file into qBittorrent and hashing against 1mb-1.bin results in 100% progress.

Using torrentfile v0.9.0. It occurred on an earlier version but I didn't come up with a repro. I initially thought this was some kind of last-block issue, but as I wrote this report it seems more like a v2 issue.

alexpdev commented 1 year ago

You are right... I am reproducing the same results. I will investigate further.

alexpdev commented 1 year ago

Beleive it or not this actually appears to be an issue with qbittorrent and not torrentfile. I checked the output against the torrent checker from the official bittorrent v2 creator and both output the exact same piece hashes at every size.

AlyoshaVasilieva commented 1 year ago

Would you be able to file an issue to libtorrent? I've checked and Deluge w/ libtorrent 2.0 has the same issue as qBittorrent, as well as PicoTorrent which reports "Error: v1 and v2 hashes do not describe the same data". All are based on https://github.com/arvidn/libtorrent

alexpdev commented 1 year ago

Hi @AlyoshaVasilieva It already is an issue on libtorrent https://github.com/arvidn/libtorrent/issues/7439