Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.86k stars 451 forks source link

Creating torrent with a name is broken #4674

Open vi opened 5 years ago

vi commented 5 years ago
Tribler version/branch+revision:

v7.3.0-beta6

Operating system and version:

Linux

Steps to reproduce the behavior:
  1. Start Tribler
  2. Pless the "+" button
  3. "Create torrent from files(s)"
  4. Enter the name of torrent: "vmcaffQvOv"
  5. Enter description: "vlKqMqxxtYq"
  6. Choose directory: let it be for example "m19Kasfq" directory, already in TriblerDownloads. A file path ending in "hello.txt" appears in the list.
  7. Leave some mysterious unlabeled directory field below by default: the user profile directory.
  8. Leave "Seed this torrent" and "Add to my channel" checked.
  9. Press "Create torrent". "Torrent successfully added to the channel".
  10. Go do downloads, find the new torrent, inspect its information. Search for this new content using Tribler Search. Go to "My Channel", inspect the new entry.
Expected behavior:

Download is named "vmcaffQvOv". Channel entry is also named "vmcaffQvOv". All of "vmcaffQvOv", "vlKqMqxxtYq" and "hello.txt" are findable using Tribler Search.

Description "vlKqMqxxtYq" is visible in detailed info bottom pane when entry is selected.

"m19Kasfq" may be or may not be searcheable.

Actual behavior:

Download is named "hello.txt". Channel entry is named "hello.txt". Neither "vlKqMqxxtYq" nor "vmcaffQvOv" is nowhere to be found in GUI. Neither words are searcheable by Triber, only "hello.txt".

Relevant log file output:

User home directory gains file vmcaffQvOv.torrent:

$ aria2c -S vmcaffQvOv.torrent 
>>> Printing the contents of file 'vmcaffQvOv.torrent'...
*** BitTorrent File Information ***
Comment: vlKqMqxxtYq
Creation Date: Fri, 12 Jul 2019 20:47:43 GMT
Created By: Tribler version: 7.0.0-GIT
Mode: single
Announce:
Info Hash: b46e98d0bb72890c143723d35b5d7d27b0e6835f
Piece Length: 16KiB
The Number of Pieces: 1
Total Length: 13B (13)
Name: hello.txt
Magnet URI: magnet:?xt=urn:btih:B46E98D0BB72890C143723D35B5D7D27B0E6835F&dn=hello.txt
Files:
idx|path/length
===+===========================================================================
  1|./hello.txt
   |13B (13)
---+---------------------------------------------------------------------------
qstokkink commented 5 years ago

I am not too familiar with our most recent search implementation. However, I do know that the BitTorrent protocol doesn't really support file names, especially the names of single file torrents have to resemble the file name. So any sort of name management will have to come from Tribler's channel management/torrent metadata mechanism.

Regarding the metadata mechanism: @ichorid, we do store the custom torrent name and description in the MetadataStore, right? If so, it should just be a matter of tying that in to the search mechanism.

ichorid commented 5 years ago

@qstokkink , you're completely right: bittorrent protocol does not permit changing the name of the torrent without touching the infohash, and we manage the stuff on our own in GigaChannels metadata entries.

qstokkink commented 5 years ago

So, if I understand the design correctly, the FtsIndex table does not have the correct references to satisfy the $query:

https://github.com/Tribler/tribler/blob/7fb14c73ae8691a4f168654ff2e2356e525adcdd/Tribler/Core/Modules/MetadataStore/OrmBindings/torrent_metadata.py#L123-L125

ichorid commented 5 years ago

Not exactly. By design, GigaChan does not store any information about the contents of the torrent. The problem reported by @vi is due to the fact that the torrent "name" field is the object's name on disk (filename for single files, dirname for directories). And we can only rename stuff at the GigaChan metadata level.

qstokkink commented 5 years ago

Aha, then #4683 is a completely separate issue.

ichorid commented 5 years ago

Torrent creation process is a problem since you have several different cases/parameters that are not orthogonal to each other, and therefor hard to align:

GigaChan just gets the torrent name and puts it in into the metadata entry. So, the problem is not about GigaChan or the GUI, it is about our torrent-creating routine.

ichorid commented 5 years ago

The proper way to fix it is by fixing the torrent creation process. As an ugly workaround, we can pass the torrent name that the user suggested through up to the moment we add the torrent to GigaChannel. However, the torrent name in the downloads will still be the same as the filename.

ichorid commented 5 years ago

So, guys, how should we handle naming torrents created by user, knowing that the toplevel filename/dirname of the torrent must be the same as the user-entered name?

qstokkink commented 5 years ago

We can store the user-entered name in the metadata and display that value when rendering for the GUI.

vi commented 5 years ago

Main thing about name and description is searchability. Filename should not be the only key to search for. Description is a good place to put various tags and keywords.

GUI concerns are a bit secondary, although it is not nice when you don't see why you get a particular search result.

ichorid commented 5 years ago

@vi , at this moment, GigaChan is only able to search by metadata title name, that is the by default copied from the torrent name. We're not going to add content search in the foreseeable future, as we already had problems with it in Dispersy times, and it proved to add more noise than information to the search. The best practice with the most successful torrent trackers is to only index torrent title for the search, but have it descriptive and not bound to the torrent dir/name.

vi commented 5 years ago

Then this torrent name (which becomes metadata title name) should be overridable by user.

Description should also be visible when clicking at search results (maybe after waiting for the file list).

ichorid commented 5 years ago

Metadata title is editable in the personal channel table. You can change the category as well. Torrent's description is not served through GigaChannels. Though it should definitely be shown with the files.

Nubro01 commented 4 years ago

Dec 6th version 7.4.0 still has a problem. Downloaded all Intel docs and tried to make a Torrent and it was created, but it wants to download the files, althought they are already there, so???