jash-kothari-forks / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
0 stars 0 forks source link

"Segmentation fault" while setting a custom piece length in "set_piece_hashes" #299

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Run the following program in Python:
{{{
import libtorrent as t
tfs = t.file_storage()
t.add_files(tfs, 
"/mnt/data/external/101/install/libtorrent-rasterbar-0.15.6.tar.gz")
torrent = t.create_torrent(tfs)
tfs.set_piece_length(2**15)
t.set_piece_hashes(torrent, "/mnt/data/external/101/install")
io.open("/tmp/_.torrent", "wb").write(t.bencode(torrent.generate()))
}}}
"set_piece_hashes" terminates because of "Segmentation fault". If I remove or 
move earlier the line "tfs.set_piece_length(2**15)" then the program succeeds 
but the piece length is not what I want. 

libtorrent-rasterbar 0.15.10-1

Original issue reported on code.google.com by rabes...@gmail.com on 19 Mar 2012 at 10:39

Attachments:

GoogleCodeExporter commented 9 years ago
So, how may I set a piece length properly?

Original comment by rabes...@gmail.com on 19 Mar 2012 at 10:41

GoogleCodeExporter commented 9 years ago
I cannot reproduce this in the latest stable, 0.16 nor with the latest 0.15 
release (on mac os). Which operating system are you using? Did you build 
libtorrent and the python binding yourself?

Original comment by arvid.no...@gmail.com on 5 May 2012 at 7:29

GoogleCodeExporter commented 9 years ago
I checked again in versions 0.15.10 and the latest svn and got the same error. 
I'm using Arch Linux. Here is the script which compiles the library and the 
binding to Python: 
https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packa
ges/libtorrent-rasterbar .

I guess that the error depends on lengths of files and pieces. Did you hashed 
"libtorrent-rasterbar-0.15.6.tar.gz"? I also got this error on bigger data, but 
hashing several GBs is not suitable for testing.

Original comment by rabes...@gmail.com on 7 May 2012 at 10:11

GoogleCodeExporter commented 9 years ago
There is a stack trace in an attachment.

Original comment by rabes...@gmail.com on 9 May 2012 at 4:45

Attachments: