Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GDXN opened this issue Nov 7, 2024 · 14 comments · May be fixed by #21836
Open

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

GDXN opened this issue Nov 7, 2024 · 14 comments · May be fixed by #21836

Comments

@GDXN
Copy link

GDXN commented Nov 7, 2024

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
Copy link
Member

glassez commented Nov 7, 2024

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

@Chocobo1
Copy link
Member

Chocobo1 commented Nov 7, 2024

Probably related to Mark-of-the-Web.

I'm not sure. I cannot reproduce.

@Chocobo1
Copy link
Member

Chocobo1 commented Nov 7, 2024

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

@GDXN
Copy link
Author

GDXN commented Nov 7, 2024

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
Copy link
Contributor

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

@GDXN
Copy link
Author

GDXN commented Nov 7, 2024

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
Copy link
Member

Chocobo1 commented Nov 7, 2024

I cannot reproduce.

I can now. Will provide a fix.

Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 9, 2024
Also use scope guards to handle resources.

Closes qbittorrent#21788.
@Chocobo1
Copy link
Member

Chocobo1 commented Nov 9, 2024

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

Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 9, 2024
Also use scope guards to handle resources.

Closes qbittorrent#21788.
Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 9, 2024
Also use scope guards to handle resources.

Closes qbittorrent#21788.
Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 9, 2024
Also use scope guards to handle resources.

Closes qbittorrent#21788.
Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 9, 2024
Also use scope guards to handle resources.

Closes qbittorrent#21788.
@GDXN
Copy link
Author

GDXN commented Nov 9, 2024

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

@Chocobo1
Copy link
Member

Chocobo1 commented Nov 10, 2024

@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
Copy link
Author

GDXN commented Nov 10, 2024

@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
Copy link
Member

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

@GDXN
Copy link
Author

GDXN commented Nov 12, 2024

@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 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 13, 2024
Chocobo1 added a commit that referenced this issue Nov 14, 2024
Also use scope guards to handle resources.

Related #21788.
PR #21806.
glassez pushed a commit to glassez/qBittorrent that referenced this issue Nov 14, 2024
Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 14, 2024
Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 14, 2024
@Chocobo1 Chocobo1 linked a pull request Nov 14, 2024 that will close this issue
@Chocobo1
Copy link
Member

@GDXN
Thanks for testing!
I've submitted another related PR that should address this issue. In case you are interested to test it: #21836

Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 14, 2024
`TorrentImpl::isDownloading()` was excessively broad which included unexpected events for the
case here. So use the underlying state directly.

Close qbittorrent#21788.
Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Nov 14, 2024
`TorrentImpl::isDownloading()` was excessively broad which included unexpected events for the
case here. So use the underlying state directly.

Close qbittorrent#21788.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants