rpms/libmowgli/F-13 libmowgli-0.7.0-20100604.patch, NONE, 1.1 libmowgli.spec, 1.7, 1.8
Michael Schwendt
mschwendt at fedoraproject.org
Wed Jun 9 09:16:59 UTC 2010
Author: mschwendt
Update of /cvs/pkgs/rpms/libmowgli/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv9298/F-13
Modified Files:
libmowgli.spec
Added Files:
libmowgli-0.7.0-20100604.patch
Log Message:
* Wed Jun 9 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 0.7.0-4
- Add mowgli_patricia corruption fix for keys starting with \1
plus a few minor changes up to 2010-06-04. Special-case '\1' not
handled yet.
libmowgli-0.7.0-20100604.patch:
examples/listsort/listsort.c | 4 ++--
examples/patriciatest/patriciatest.c | 30 ++++++++++++++++++++++++++----
libmowgli/mowgli_argstack.c | 2 +-
libmowgli/mowgli_object.c | 3 ++-
libmowgli/mowgli_patricia.c | 2 +-
5 files changed, 32 insertions(+), 9 deletions(-)
--- NEW FILE libmowgli-0.7.0-20100604.patch ---
diff -Nur libmowgli-0.7.0-orig/src/examples/listsort/listsort.c libmowgli-0.7.0/src/examples/listsort/listsort.c
--- libmowgli-0.7.0-orig/src/examples/listsort/listsort.c 2008-07-06 15:48:26.000000000 +0200
+++ libmowgli-0.7.0/src/examples/listsort/listsort.c 2010-06-09 10:39:03.000000000 +0200
@@ -43,7 +43,7 @@
void test_strings(void)
{
- mowgli_list_t l = {};
+ mowgli_list_t l = { NULL, NULL, 0 };
mowgli_node_t *n, *tn;
mowgli_node_add("foo", mowgli_node_create(), &l);
@@ -84,7 +84,7 @@
void test_integers(void)
{
- mowgli_list_t l = {};
+ mowgli_list_t l = { NULL, NULL, 0 };
mowgli_node_t *n, *tn;
mowgli_node_add((void *) 3, mowgli_node_create(), &l);
diff -Nur libmowgli-0.7.0-orig/src/examples/patriciatest/patriciatest.c libmowgli-0.7.0/src/examples/patriciatest/patriciatest.c
--- libmowgli-0.7.0-orig/src/examples/patriciatest/patriciatest.c 2008-07-06 15:48:26.000000000 +0200
+++ libmowgli-0.7.0/src/examples/patriciatest/patriciatest.c 2010-06-09 10:39:03.000000000 +0200
@@ -33,6 +33,8 @@
#include <mowgli.h>
+int errors = 0;
+
void str_canon(char *key)
{
return;
@@ -48,6 +50,7 @@
{
mowgli_patricia_iteration_state_t state;
void *elem, *elem2;
+ unsigned int n1 = 0, n2;
printf("Checking consistency...");
fflush(stdout);
@@ -55,12 +58,28 @@
{
elem2 = mowgli_patricia_retrieve(dtree, (const char *)elem);
if (elem2 == NULL)
- printf("failed to find element %s\n", elem);
+ {
+ errors++;
+ printf("failed to find element %s\n",
+ (const char *)elem);
+ }
else if (strcmp(elem2, elem))
- printf("element %s != %s\n", elem, elem2);
+ {
+ printf("element %s != %s\n",
+ (const char *)elem,
+ (const char *)elem2);
+ errors++;
+ }
else
printf(".");
fflush(stdout);
+ n1++;
+ }
+ n2 = mowgli_patricia_size(dtree);
+ if (n1 != n2)
+ {
+ errors++;
+ printf("number of iterated elements %u != size %u\n", n1, n2);
}
printf("\n");
}
@@ -73,6 +92,7 @@
dtree = mowgli_patricia_create(str_canon);
#define ADD(x) mowgli_patricia_add(dtree, x, x); check_all_retrievable(dtree)
+ ADD("\1\1");
ADD("alias");
ADD("foo");
ADD("bar");
@@ -99,14 +119,14 @@
check_all_retrievable(dtree);
-#define TESTRETRIEVE(x) elem = mowgli_patricia_retrieve(dtree, x); printf("element %s: %s\n", x, elem ? "YES" : "NO")
+#define TESTRETRIEVE(x) elem = mowgli_patricia_retrieve(dtree, x); printf("element %s: %s\n", x, elem ? (errors++, "YES") : "NO")
TESTRETRIEVE("meows");
TESTRETRIEVE("meo");
TESTRETRIEVE("deletes");
TESTRETRIEVE("z");
TESTRETRIEVE("0");
-#define TESTDELETE(x) mowgli_patricia_delete(dtree, x); elem = mowgli_patricia_retrieve(dtree, x); printf("deleting %s: %s\n", x, elem ? "STILL PRESENT" : "GONE"); check_all_retrievable(dtree)
+#define TESTDELETE(x) mowgli_patricia_delete(dtree, x); elem = mowgli_patricia_retrieve(dtree, x); printf("deleting %s: %s\n", x, elem ? (errors++, "STILL PRESENT") : "GONE"); check_all_retrievable(dtree)
TESTDELETE("YYY");
TESTDELETE("foo");
TESTDELETE("splork");
@@ -125,4 +145,6 @@
mowgli_init();
test_patricia();
+
+ return errors == 0 ? 0 : 1;
}
diff -Nur libmowgli-0.7.0-orig/src/libmowgli/mowgli_argstack.c libmowgli-0.7.0/src/libmowgli/mowgli_argstack.c
--- libmowgli-0.7.0-orig/src/libmowgli/mowgli_argstack.c 2008-07-06 15:48:26.000000000 +0200
+++ libmowgli-0.7.0/src/libmowgli/mowgli_argstack.c 2010-06-09 10:39:03.000000000 +0200
@@ -72,9 +72,9 @@
*/
mowgli_argstack_t *mowgli_argstack_create_from_va_list(const char *descstr, va_list va)
{
+ const char *cp = descstr;
mowgli_argstack_t *out = mowgli_alloc(sizeof(mowgli_argstack_t));
mowgli_object_init(mowgli_object(out), descstr, &klass, NULL);
- const char *cp = descstr;
if (descstr == NULL)
mowgli_throw_exception_val(mowgli.argstack.invalid_description, NULL);
diff -Nur libmowgli-0.7.0-orig/src/libmowgli/mowgli_object.c libmowgli-0.7.0/src/libmowgli/mowgli_object.c
--- libmowgli-0.7.0-orig/src/libmowgli/mowgli_object.c 2008-07-06 15:48:27.000000000 +0200
+++ libmowgli-0.7.0/src/libmowgli/mowgli_object.c 2010-06-09 10:39:03.000000000 +0200
@@ -133,9 +133,10 @@
*/
void mowgli_object_unref(void *object)
{
- return_if_fail(object != NULL);
mowgli_object_t *obj = mowgli_object(object);
+ return_if_fail(object != NULL);
+
obj->refcount--;
if (obj->refcount <= 0)
diff -Nur libmowgli-0.7.0-orig/src/libmowgli/mowgli_patricia.c libmowgli-0.7.0/src/libmowgli/mowgli_patricia.c
--- libmowgli-0.7.0-orig/src/libmowgli/mowgli_patricia.c 2008-07-06 15:48:27.000000000 +0200
+++ libmowgli-0.7.0/src/libmowgli/mowgli_patricia.c 2010-06-09 10:39:03.000000000 +0200
@@ -508,7 +508,7 @@
/* Avoid bit 0 as it's already used by the magic root node,
* but may still be distinct. A special case for "\1" is
* needed. */
- if (delem == dict->root && ckey[0] == '\1')
+ if (delem == dict->root && !strcmp(ckey, "\1"))
i = 1;
else
for (i = 1; !((ckey[i / 8] ^ place->key[i / 8]) & (1 << (i & 7))); i++)
Index: libmowgli.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libmowgli/F-13/libmowgli.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- libmowgli.spec 18 Nov 2009 22:30:58 -0000 1.7
+++ libmowgli.spec 9 Jun 2010 09:16:58 -0000 1.8
@@ -2,7 +2,7 @@
Name: libmowgli
Version: 0.7.0
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Library of many utility functions and classes
Group: System Environment/Libraries
@@ -13,6 +13,7 @@ License: MIT
URL: http://atheme.org
Source0: http://distfiles.atheme.org/libmowgli-%{version}.tgz
+Patch0: libmowgli-0.7.0-20100604.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
@@ -36,6 +37,7 @@ software that uses libmowgli.
%prep
%setup -q
+%patch0 -p1 -b .20100604
# Make the build system more verbose
sed -i '\,^.SILENT:,d' buildsys.mk.in
@@ -88,6 +90,11 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/libmowgli.pc
%changelog
+* Wed Jun 9 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 0.7.0-4
+- Add mowgli_patricia corruption fix for keys starting with \1
+ plus a few minor changes up to 2010-06-04. Special-case '\1' not
+ handled yet.
+
* Wed Nov 18 2009 Michael Schwendt <mschwendt at fedoraproject.org> - 0.7.0-3
- Compile examples and execute them for some testing.
More information about the scm-commits
mailing list