Check for missing files using .sfv file

Bug #316427 reported by scorch
2
Affects Status Importance Assigned to Milestone
DC++
Confirmed
Wishlist
Unassigned

Bug Description

Feature request.

When hashing data, DC++ notifies if CRC32 values from .sfv files doesn't match the actual files themselves. It would be nice if DC++ could also notify about missing files. I.e. files specified in the .sfv file that doesn't exists in that directory.

eMTee (realprogger)
Changed in dcplusplus:
importance: Undecided → Wishlist
Revision history for this message
scorch (scorch3) wrote :

Patch that should work. I haven't tried it yet though.

The patch adds an if clause in dcpp/HashManager.cpp on line 769, right before the CRC32 inconsistency check. It tries to open the file; if it can, close the handle and continue, otherwise write to the log that it couldn't find the file (will also say so if the permissions are wrong, but then it wouldn't be shared anyway...).

Code follows:

FILE* fp = NULL;
fp = fopen(fname, "rb");
if(fp == NULL) {
 LogManager::getInstance()->message(str(F_("%1% not found but found in SFV file.") % fname));
} else {
 fclose(fp);
}

Revision history for this message
Pseudonym (404emailnotfound) wrote :

Instead of using the functions from <cstdio>, you should use the File class already in DC++ (which strangely doesn't seem to have a static exists() function... adding that might be a good precursor patch to this one). Additionally, it's a good idea to generate the patch from within bzr instead of using diff manually.

Revision history for this message
eMTee (realprogger) wrote :

In DC++ File::getSize() is used for checking the existence of a file...

Revision history for this message
Jacek Sieka (arnetheduck) wrote :

the patch reports after each file so if a sfv contains 10 files it'll show 9 files missing when 1 has downloaded and the rest is in the queue...
probably, the way to go about this is to check the queue and disk when the .sfv has downloaded and then report missing files

Changed in dcplusplus:
status: New → Confirmed
Revision history for this message
scorch (scorch3) wrote :

What about this then? I don't know if this is the correct function to use. How much would this slow down sfv-checking?

if(dcpp::File::getSize(path) == -1 && QueueManager::FileQueue::find(fname) == NULL) {
 LogManager::getInstance()->message(str(F_("%1% not found but found in SFV file.") % fname));
}

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.