Discussion:
Bug with searching for files by TTH
Edward J. Sheldrake
2006-10-14 13:38:29 UTC
Permalink
While trying to add support for ADCGet and TTHF to dclib/valknut 0.3.7,
I have discovered a serious bug which causes files to not be found when
searched for by their TTH.

I have confirmed the bug occurrs when you rename a file that has
already been hashed and is in your share, but there may be other cases
which trigger the bug.

When a file is searched for by TTH, but not found as it should be, I
have discovered that the following happens:

CSearchIndex::SearchHash is called
CSearchIndex::FindHash is then called, and finds a value
CSearchIndex::HashBaseIndexFromHashIndex converts this value into
another (often the same)
CSearchIndex::BaseIndexFromHashBaseIndex then fails

But I'm thinking the problem lies in the code for adding the values to
the various indexes (*.bin files in ~/.dc/).

So far, I have only managed to add extra debugging statements to dclib,
I haven't been able to make any progress in fixing this problem.
A patch for the extra debugging output is available here:
http://www.dcs.warwick.ac.uk/~csucda/extra-debug-dclib.diff

We need to fix this bug because DC++ >= 0.696 will require support for
ADCGet and TTHF, so we need to fix this bug for valknut to have any
future.

--

Edward Sheldrake (ejs1920 on the valknut forums)

Send instant messages to your online friends http://uk.messenger.yahoo.com
Henning Noren
2006-10-14 14:15:36 UTC
Permalink
Post by Edward J. Sheldrake
While trying to add support for ADCGet and TTHF to dclib/valknut 0.3.7,
I have discovered a serious bug which causes files to not be found when
searched for by their TTH.
Do you have the fix for the known problem in csearchindex applied?
http://dcgui.berlios.de/forum/viewtopic.php?t=2934

I'm not saying it will work, but it might help.


Sincerely
Henning
Edward J. Sheldrake
2006-10-14 19:17:46 UTC
Permalink
OK, I think I have finally found and fixed the problem:

diff -Naur dclib-0.3.7.orig/dclib/csearchindex.cpp
dclib-0.3.7.new/dclib/csearchindex.cpp
--- dclib-0.3.7.orig/dclib/csearchindex.cpp 2006-10-14
16:51:43.000000000 +0100
+++ dclib-0.3.7.new/dclib/csearchindex.cpp 2006-10-14
20:09:23.000000000 +0100
@@ -164,7 +164,7 @@
sl->Add( *ps, ps );
}
}
- hi++;
+ hi+=TIGERSIZE;
}

return sl;

Sorry to have bothered you, but this bug has been driving me nuts for a
few days now!


Send instant messages to your online friends http://uk.messenger.yahoo.com
Loading...