jash-kothari-forks / libtorrent

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

torrent_handle::move_storage() can cause infinite loop #304

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take the following torrent:
magnet:?xt=urn:btih:454fface03362f237a2a2e4961121c2db4adb75c&dn=Van.Wilder.Fresh
man.Year.2009.720p.HDTV.x264.Feel-Free&tr=udp%3A%2F%2Ftracker.openbittorrent.com
%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.ccc.de%3A8
0
2. One particularity of this torrent is that it has a file inside that has the 
exact same name as the torrent.
3. Add torrent to sessions and set save_path to X.
4. When the the metadata_received_alert is received, call 
torrent_handle::move_storage("X/Van.Wilder.Freshman.Year.2009.720p.HDTV.x264.Fee
l-Free")

What is the expected output? What do you see instead?

I would expect that the torrent is moved to 
"X/Van.Wilder.Freshman.Year.2009.720p.HDTV.x264.Feel-Free".
However, libtorrent gets confused because there is a file called 
Van.Wilder.Freshman.Year.2009.720p.HDTV.x264.Feel-Free inside the torrent 
already and it will go in some kind of loop and create:
X/Van.Wilder.Freshman.Year.2009.720p.HDTV.x264.Feel-Free/Van.Wilder.Freshman.Yea
r.2009.720p.HDTV.x264.Feel-Free/Van.Wilder.Freshman.Year.2009.720p.HDTV.x264.Fee
l-Free/Van.Wilder.Freshman.Year.2009.720p.HDTV.x264.Feel-Free/...

until you get an I/O error (directory is not a file).

What version of the product are you using? On what operating system?
libtorrent v0.15.11

Please provide any additional information below.
Original bug report: https://bugs.launchpad.net/qbittorrent/+bug/967591

Original issue reported on code.google.com by dch...@gmail.com on 1 Apr 2012 at 9:02

GoogleCodeExporter commented 9 years ago
I think move_storage() should be more careful and make sure that it only moves 
files that were created by libtorrent. Checking file types would also move 
useful because in this case it is confusing a file inside the torrent with a 
folder that has the same path/name.

Original comment by dch...@gmail.com on 1 Apr 2012 at 9:16