qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.46k stars 3.91k forks source link

Files not moved to save location when too long #10121

Open ashleywaite opened 5 years ago

ashleywaite commented 5 years ago

qBittorrent version and Operating System

Windows 7 (64-bit) (6.1.760x) qBittorrent v4.1.5 (64-bit) Libtorrent v1.1.11.0 (according to about)

What is the problem

Files that have a long file name are downloaded fine, but are not moved when the torrent is completed and relocated to the save directory. It will now subsequently throw I\O errors when attempting to seed from any files that failed to move as they are not in the new location. They are still in the incomplete location however!

In the case I encountered it, the subdirectory was 190 characters long and successfully created in the save location, but all the files within that subdirectory exceeded 255 characters (full path name) and were not moved.

When I subsequently relocated the torrent by changing category when using Automatic Torrent Management the empty directory was not created in the new location moved to and still no errors reported in the log. The files were just absent and the move reported no errors!

What is the expected behavior

Files with long file names should to be moved! When files fail to be moved, proper errors should be reported in the log. It should not incorrectly claim in the log that it was "Successfully moved"! When files are absent and moving a torrent, it should not claim in the log that it was "Successfully moved"

Steps to reproduce

Failure to move or report error on completion

  1. Set an incomplete location different to download location
  2. Download a torrent with multiple files, where some files and subdirectories exceed the win32 api file name limit (255 chars)
  3. Wait for torrent to finish

    Log will now report a successful move to save location, but files with a long file name will be absent from save location and still remain in incomplete location

Failure to move or report error on location move

  1. Set torrent to Automatic Torrent Management
  2. Assign torrent to a category with a different save location.

Log will now report a successful move to new location in spite of files being absent

Extra info

This will likely be a consequence of not using the \\?\ prefix when moving files via the win32 api. Details about this limitation are in this microsoft doc.

Potentially same issue as #9447 if reporter didn't realise it was the moving on completion that caused the problem, and not the downloading itself. If you check the save location the files are missing as they were not moved, so it would be easy to think they were not downloaded, but they are present in the incomplete location!

annomatik commented 5 years ago

same here, thanks for reporting. I have to check each "completed" directory, if there are leftovers in the "download" directory. If so, I have to move them manually with Total Commander. Total Commander will report, that the length limit is exceeded but will be able to move anyways.

R-Adrian commented 5 years ago

i just hit this issue too... when trying to move the downloaded data to the "finished" location qBittorrent v4.1.5 will instead delete anything it downloaded and start again downloading from zero... basically it gets in an infinite download loop when it hits the MAX_PATH limit when trying to move the files.

changlek commented 5 years ago

I am surprised but yes I got this same issue. I use qBittorrent to complement another torrent program and for years no problems at all !

qbittorrent long names qbittorrent long names 5 qbittorrent long names 4 qbittorrent long names 3 qbittorrent long names 2

zybexXL commented 5 years ago

Same issue on 4.1.6, just got back from vacation to find out QBt downloaded the same torrent over and over for 10 days straight because of this long path issue (total path was 275 chars). I witnessed the last iteration where it downloaded, then the file check failed and it just restarted downloading from zero.

The same 2.25GB file was downloaded 488 times, for a total of about 1.1TB. I don't have a download cap, but my ISP is probably not pleased, I bet I'm now on their monitoring/blacklist :-/

Please fix LFN support under Windows.