Login | Register
My pages Projects Community openCollabNet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Catacomb] Bug(s) in the catacomb software

Detlev Penza wrote:

I have discovered some bugs in the catacomb software:

The first one is that collection names are not processed correctly if the first letters are identical. If you have a collection named foo and one named foo1 the listing of foo shows the members of foo AND of foo1. The same thing happens if you copy foo.
I tracked the bug down to the SELECT commands in file ?dbms.c?
In function dbms_copy_resource the bug is in the line:
"WHERE URI=? or URI like ? '%'");
in the function dbms_get_collection_resource it is this line
From dasl_resource Where URI like ? '%'

I replaced '%' by '/%'. In the other functions like the remove function it is done correcty. For me this solution worked well, but I am not sure if the change has any side effects.
Good catch!

Another problem is that the URIs are stored with upper and lower case letters but the comparison is done case insensitive. If you upload a file foo and then a file Foo, foo is overwritten by Foo but the name stays foo.

# echo foo > foo
# echo Foo > Foo
# cadaver
dav:/repos/> put foo
Uploading foo to `/repos/foo':
Progress: [=============================>] 100.0% of 302 bytes succeeded.
dav:/repos/> ls
Listing collection `/repos/': succeeded.
foo                                    4  Jun  3 00:36
dav:/repos/> cat foo
Displaying `/repos/foo':
dav:/repos/> put Foo
Uploading Foo to `/repos/Foo':
Progress: [=============================>] 100.0% of 4 bytes succeeded.
dav:/repos/> ls
Listing collection `/repos/': succeeded.
foo                                    4  Jun  3 00:36
dav:/repos/> cat foo
Displaying `/repos/foo':

I solved the problem by changing the type of URI in every table where it is used from text to blob. Doing this the comparison is done case insensitive.
Hmm, interesting, and another good catch.

I hope this will help

Would you like me to make these fixes in the main distribution?

Detlev Penza


I like the stream_dbms branch in the CVS. A year ago I tried to store large files in a database using PHP. The memory usage of PHP exploded and MySql 3 was not able to accept more than 16MB. This limitation is gone with version 4 but I have learned the lesson. Keeping large files and the database separate is the best solution. You can make a full backup of the (relatively small) database and an incremental backup of the data.
Great! Seem to be working for you? If you find it has no major issues, I'd like to push for merging it into the trunk of CVS.

I would prefer a more flexible naming scheme building directory names. Using the Ids might be useful in some cases but I changed it to store the files in directory names build from the URI. People using ReiserFS might prefer to store them in a flat files system because this might be faster than your approach.

I would just pass more parameters to the function that creates the filenames so that everyone can do there what he likes best.

More parameters is a good idea...I'd be a bit careful, though, of including URI or other non-key information as currently Catacomb doesn't handle making sure changes in URI's make it into the filesystem. That could be fixed fairly easily, though...Perhaps I'll modify the move function to see if the filename has changed or not and if it has, move the flat file as well.