qbittorrent / qBittorrent

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

Cheking files after adding torrent change "date modified" for existing files. #21788

Closed GDXN closed 6 days ago

GDXN commented 2 weeks ago

qBittorrent & operating system versions

PC1 qBittorrent: 5.0.0 x64 Operating system: Windows 10 Home libtorrent-rasterbar: 1.2.X

PC2 qBittorrent: 5.0.1 x64 Operating system: Windows 10 Pro libtorrent-rasterbar: 1.2.X

What is the problem?

When added a new torrent that updates and older one and check the existing files the "date modified" is updated for the existing files.

Steps to reproduce

This can be reproduced with the same torrent file as an updated version is not needed for the behavior.

  1. Add and download a torrent with a folder and some files
  2. Delete the torrent and maintain the files
  3. Add the same torrent and recheck

Additional context

This didn't happen in the 4.6.7 that I was using previously and the problem interferes with backup software making it transfer much more data and take longer.

Log(s) & preferences file(s)

qBittorrent.txt

glassez commented 2 weeks ago

Probably related to Mark-of-the-Web. @Chocobo1, ping.

Chocobo1 commented 2 weeks ago

Probably related to Mark-of-the-Web.

I'm not sure. I cannot reproduce.

Chocobo1 commented 2 weeks ago

@GDXN You can try disabling "Enable Mark-of-the-Web for downloaded files" in advanced options. See if that works for you.

GDXN commented 2 weeks ago

It appears that disabling "Mark-of-the-Web" fixes it, I'm going to test for a few days to view if its really fixed.

stalkerok commented 2 weeks ago

Some files update the modification date because these are the files that contain contiguous pieces with the new files.

GDXN commented 2 weeks ago

Some files update the modification date because these are the files that contain contiguous pieces with the new files.

That is not the problem, that's the expected behavior. The problem Is that all the files modifications dates are updated not only the affected files while rechecking from a new added torrent and indeed "Mark-of-the-Web" appears to be the cause.

Chocobo1 commented 2 weeks ago

I cannot reproduce.

I can now. Will provide a fix.

Chocobo1 commented 1 week ago

@GDXN I've submitted #21806. Please give it a try.

GDXN commented 1 week ago

@Chocobo1 I tried various build with the fix and all of then close intermediately.

Chocobo1 commented 1 week ago

@Chocobo1 I tried various build with the fix and all of then close intermediately.

You meant they crashed? You can try our CI builds here: https://github.com/qbittorrent/qBittorrent/actions/runs/11755999108 I tried it myself and it works as expected.

GDXN commented 1 week ago

@Chocobo1 that version fails for me, in both install and portable mode, with and without clean profile.

this is the only that is written in the the log:

(N) 2024-11-10T12:07:54 - qBittorrent v5.1.0alpha1 started. Process ID: 12456 (N) 2024-11-10T12:07:54 - Ejecutando en modo portátil. Carpeta de perfil detectada automáticamente en: C:\T2\qb5\profile (N) 2024-11-10T12:07:55 - Intentando escuchar en la siguiente lista de direcciones IP: "0.0.0.0:26941,[::]:26941"

xavier2k6 commented 1 week ago

@GDXN Install the Latest Microsoft Visual C++ Redistributable Version & try the builds again.

GDXN commented 1 week ago

@Chocobo1

OK, the problem persist if Mark-of-the-Web is enabled and the files are the old ones that don't contain Mark-of-the-Web even if they are complete, if the files contain Mark-of-the-Web it don't happen anymore and that is also a good thing.

I find two possible solutions to this:

  1. add a switch for Mark-of-the-Web to not be forced on old files and only add the mark on the new files created

  2. use qt functions QFileDevice::fileTime and QFileDevice::setFileTime to read the old time and then after adding Mark-of-the-Web restore it (only needed for the modification time, but possibly also for the creation one).

For me I'm going to have Mark-of-the-Web disabled as in my user case fixes the problem and I think that this need a wiki entry. I need to dust off my programing skills as I haven't touched code in more than 10 years if i want to collaborate more.

And thanks for your work.

Chocobo1 commented 1 week ago

@GDXN Thanks for testing! I've submitted another related PR that should address this issue. In case you are interested to test it: https://github.com/qbittorrent/qBittorrent/pull/21836