Opened 19 months ago

Last modified 8 months ago

#2898 new bug

deluged-1.3.13/libtorrent-1.1.0 messes up torrent directory names

Reported by: edechamps Owned by:
Priority: minor Milestone: not applicable
Component: libtorrent Version: 1.3.13
Keywords: Cc:

Description

I've been using Deluge 1.3.12 with libtorrent 1.0.7 on Debian Sid for quite some time. Recently Debian Sid upgraded to Deluge 1.3.13 and libtorrent 1.1.0. When I restarted Deluge on my existing torrents, I noticed that the directory names on some of my torrents were badly messed up. Specifically, Deluge seemed to add spurious slashes in the middle of top-level torrent directory names at random for no apparent reason.

For example, say that a torrent has the following top-level directory name (i.e. the name of the directory inside the torrent itself):

"Foo - Bar - Baz"

For no apparent reason, that name changed to the following when the new version of deluged/libtorrent loaded the torrent:

"Foo/- Bar - Baz"

Basically the name is corrupted - a space was replaced by a slash, and I ended up with a subdirectory. It seems like, for some reason, it's only spaces or dots that get replaced by slashes. This is *very* weird.

Additional information:

  • Obviously this prevented the affected torrents from starting, since Deluge couldn't find the data using the wrong path.
  • This only happened on a small subset (around 2%) of my torrents. I couldn't determine why these torrents were affected but not others - it seemed random. There were plenty of unaffected torrents using similar naming schemes.
  • If I downgrade libtorrent to 1.0.9 (keeping deluged-1.3.13), the problem goes away. This seems to indicate a regression was introduced between libtorrent 1.0.9 and 1.1.0.
  • I cannot use the rename functionality to try to fix the problem - it behaves very erratically on these corrupted torrents and basically refuses to rename the directory, or even manages to somehow corrupt the torrent itself (e.g. bencode complaining that end-of-file was reached).
  • None of my torrents use the top-level original directory name from the original torrent. I always rename every torrent with a custom top-level directory name immediately after I add them. Maybe this has something to do with the issue.

Change History (2)

comment:1 Changed 19 months ago by Cas

  • Component changed from Unknown to libtorrent
  • Milestone changed from needs verified to not applicable

You will need to report this to libtorent https://github.com/arvidn/libtorrent/issues

comment:2 Changed 8 months ago by edechamps

An update for those who might stumble upon this bug…

I updated directly to libtorrent 1.1.4 and that solved the problem. (This needs to be done from 1.0.9 directly, skipping 1.1.0 - otherwise some corruption will still be present in the deluge UI, though it seems to use the correct paths internally.)

Be especially careful when using Debian packages - the version currently packaged in the Debian repositories is 1.1.1, which has the bug. Just running "apt-get upgrade" can be enough to turn your life into a living hell if you have a large number of torrents that are affected (true story).

Digging further, this issue was also reported in other libtorrent-based applications (qBittorrent):

https://github.com/qbittorrent/qBittorrent/issues/5820

https://github.com/arvidn/libtorrent/issues/1242

This was fixed by https://github.com/arvidn/libtorrent/pull/1524 which is included in libtorrent 1.1.2.

From what I understand, that bug only occurs if the torrent was renamed to a prefix of the original torrent name. This explains why the corruption looked more or less random to me initially.

Last edited 8 months ago by edechamps (previous) (diff)
Note: See TracTickets for help on using tickets.