Updating libchop to 0.5.1
svn path=/nixpkgs/trunk/; revision=30444
This commit is contained in:
parent
692efb76e4
commit
1ff3207641
@ -1,103 +0,0 @@
|
||||
From cb343e4e0421ba89651c884939238eec74e826f6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
|
||||
Date: Mon, 14 Nov 2011 17:28:53 +0100
|
||||
Subject: [PATCH 1/2] tests: Simplify `deserialize.c'.
|
||||
|
||||
* tests/interfaces/deserialize.c (pair)[serial_size]: Remove field.
|
||||
(ascii_serials): Adjust accordingly.
|
||||
(check_serial_deserial): Use `strlen (pair->serial)' instead of
|
||||
`pair->serial_size'.
|
||||
---
|
||||
tests/interfaces/deserialize.c | 20 +++++++++-----------
|
||||
1 files changed, 9 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/tests/interfaces/deserialize.c b/tests/interfaces/deserialize.c
|
||||
index 80c610d..6e9b765 100644
|
||||
--- a/tests/interfaces/deserialize.c
|
||||
+++ b/tests/interfaces/deserialize.c
|
||||
@@ -24,12 +24,12 @@
|
||||
|
||||
#include <testsuite.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
|
||||
struct pair
|
||||
{
|
||||
const char *const class_name;
|
||||
const char *const serial;
|
||||
- size_t serial_size;
|
||||
};
|
||||
|
||||
static const struct pair ascii_serials[] =
|
||||
@@ -37,16 +37,14 @@ static const struct pair ascii_serials[] =
|
||||
{
|
||||
"chk_index_handle",
|
||||
"zqoimseyv5r4cpj3ab64o6y2j6cbatkz5picnvidsyafwnvtrvbq====,grqqeqcihncuevm7xnmnkfp3ukkruk2e/4a",
|
||||
- 92
|
||||
},
|
||||
|
||||
{
|
||||
"hash_index_handle",
|
||||
"3q2hrigwtmsmvqi64cy2yw7szh66drvf/122",
|
||||
- 36
|
||||
},
|
||||
|
||||
- { NULL, NULL, 0 }
|
||||
+ { NULL, NULL }
|
||||
};
|
||||
|
||||
/* Check whether we can serialize/deserialize PAIR. */
|
||||
@@ -59,7 +57,7 @@ check_serial_deserial (const struct pair *pair)
|
||||
chop_object_t *object;
|
||||
const chop_class_t *klass;
|
||||
chop_buffer_t buffer;
|
||||
- char with_trailing_junk[pair->serial_size + sizeof junk + 1];
|
||||
+ char with_trailing_junk[strlen (pair->serial) + sizeof junk + 1];
|
||||
size_t read;
|
||||
|
||||
test_stage ("instance of `%s'", pair->class_name);
|
||||
@@ -73,17 +71,17 @@ check_serial_deserial (const struct pair *pair)
|
||||
test_stage_intermediate ("with trailing NUL");
|
||||
err = chop_object_deserialize (object, klass,
|
||||
CHOP_SERIAL_ASCII,
|
||||
- pair->serial, pair->serial_size,
|
||||
+ pair->serial, strlen (pair->serial),
|
||||
&read);
|
||||
|
||||
test_check_errcode (err, "deserializing");
|
||||
- test_assert (read == pair->serial_size);
|
||||
+ test_assert (read == strlen (pair->serial));
|
||||
|
||||
err = chop_object_serialize (object, CHOP_SERIAL_ASCII, &buffer);
|
||||
test_check_errcode (err, "serializing");
|
||||
|
||||
test_assert (!strncmp (chop_buffer_content (&buffer), pair->serial,
|
||||
- pair->serial_size));
|
||||
+ strlen (pair->serial)));
|
||||
|
||||
chop_object_destroy (object);
|
||||
chop_buffer_clear (&buffer);
|
||||
@@ -96,17 +94,17 @@ check_serial_deserial (const struct pair *pair)
|
||||
|
||||
err = chop_object_deserialize (object, klass,
|
||||
CHOP_SERIAL_ASCII,
|
||||
- with_trailing_junk, pair->serial_size,
|
||||
+ with_trailing_junk, strlen (pair->serial),
|
||||
&read);
|
||||
|
||||
test_check_errcode (err, "deserializing with trailing junk");
|
||||
- test_assert (read == pair->serial_size);
|
||||
+ test_assert (read == strlen (pair->serial));
|
||||
|
||||
err = chop_object_serialize (object, CHOP_SERIAL_ASCII, &buffer);
|
||||
test_check_errcode (err, "serializing (trailing junk)");
|
||||
|
||||
test_assert (!strncmp (chop_buffer_content (&buffer), pair->serial,
|
||||
- pair->serial_size));
|
||||
+ strlen (pair->serial)));
|
||||
|
||||
test_stage_result (1);
|
||||
}
|
||||
--
|
||||
1.7.6
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 8b2d0b3792e4c0535ff7241cf3770232618cdefc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
|
||||
Date: Mon, 14 Nov 2011 17:34:10 +0100
|
||||
Subject: [PATCH 2/2] block-indexer-hash: Fix off-by-n in ASCII
|
||||
deserialization of the block indexer.
|
||||
|
||||
* src/block-indexer-hash.c (hbi_deserialize): Don't read beyond SIZE.
|
||||
|
||||
* tests/interfaces/deserialize.c (ascii_serials): Add a
|
||||
`hash_block_indexer' example.
|
||||
---
|
||||
src/block-indexer-hash.c | 2 +-
|
||||
tests/interfaces/deserialize.c | 5 +++++
|
||||
2 files changed, 6 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/block-indexer-hash.c b/src/block-indexer-hash.c
|
||||
index 858ddd7..db7d6b4 100644
|
||||
--- a/src/block-indexer-hash.c
|
||||
+++ b/src/block-indexer-hash.c
|
||||
@@ -638,7 +638,7 @@ hbi_deserialize (const char *buffer, size_t size, chop_serial_method_t method,
|
||||
size_t name_len = 0;
|
||||
const char *end = buffer;
|
||||
|
||||
- while (isalnum (*end))
|
||||
+ while (isalnum (*end) && end - buffer < size)
|
||||
{
|
||||
if (name_len >= sizeof (name))
|
||||
return CHOP_DESERIAL_CORRUPT_INPUT;
|
||||
diff --git a/tests/interfaces/deserialize.c b/tests/interfaces/deserialize.c
|
||||
index 6e9b765..af7015e 100644
|
||||
--- a/tests/interfaces/deserialize.c
|
||||
+++ b/tests/interfaces/deserialize.c
|
||||
@@ -44,6 +44,11 @@ static const struct pair ascii_serials[] =
|
||||
"3q2hrigwtmsmvqi64cy2yw7szh66drvf/122",
|
||||
},
|
||||
|
||||
+ {
|
||||
+ "hash_block_indexer",
|
||||
+ "SHA1"
|
||||
+ },
|
||||
+
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
--
|
||||
1.7.6
|
||||
|
@ -1,19 +0,0 @@
|
||||
commit c1d42668b6fa0777df99c349a9b3826c186f3b9d
|
||||
Author: Ludovic Courtès <ludo@gnu.org>
|
||||
Date: Sat Nov 5 00:03:00 2011 +0100
|
||||
|
||||
Define $GUILE_LOAD_COMPILED_PATH when running tests.
|
||||
|
||||
* tests/Makefile.am (TESTS_ENVIRONMENT): Define
|
||||
$GUILE_LOAD_COMPILED_PATH.
|
||||
|
||||
diff -ubB --show-c-function /tmp/nix-build-bzqif52j6ypbhrkyg13ikc1wzscg2h7s-libchop-0.5.drv-0/libchop-0.5/tests/Makefile.in.orig /tmp/nix-build-bzqif52j6ypbhrkyg13ikc1wzscg2h7s-libchop-0.5.drv-0/libchop-0.5/tests/Makefile.in
|
||||
--- libchop-0.5/tests/Makefile.in 2011-11-14 17:42:14.000000000 +0100
|
||||
+++ libchop-0.5/tests/Makefile.in 2011-11-14 17:42:17.000000000 +0100
|
||||
@@ -1048,6 +1048,7 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPT
|
||||
TESTS_ENVIRONMENT = \
|
||||
PATH="$(top_builddir)/utils:$$PATH" \
|
||||
GUILE_LOAD_PATH="$(abs_top_srcdir)/guile2:$(abs_top_builddir)/guile2:$$GUILE_LOAD_PATH" \
|
||||
+ GUILE_LOAD_COMPILED_PATH="$(abs_top_builddir)/guile2:$$GUILE_LOAD_COMPILED_PATH" \
|
||||
libchop_libdir="$(abs_top_builddir)/src" \
|
||||
top_srcdir="$(abs_top_srcdir)" srcdir="$(abs_srcdir)/utils"
|
@ -1,25 +0,0 @@
|
||||
From 55effc94ec10100673edc1400bc8cb086fd8dc3b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
|
||||
Date: Mon, 14 Nov 2011 17:56:46 +0100
|
||||
Subject: [PATCH] tests: Export $XDG_CACHE_HOME in `utils/backup'.
|
||||
|
||||
* tests/utils/backup (XDG_CACHE_HOME): Export.
|
||||
---
|
||||
tests/utils/backup | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/tests/utils/backup b/tests/utils/backup
|
||||
index d8db141..171060f 100755
|
||||
--- a/tests/utils/backup
|
||||
+++ b/tests/utils/backup
|
||||
@@ -21,6 +21,7 @@ source "${srcdir:-$PWD}/lib.sh"
|
||||
DB_FILE=",,backup.db"
|
||||
TMP_FILE=",,backup.tmp"
|
||||
XDG_CACHE_HOME="$PWD/backup-cache"
|
||||
+export XDG_CACHE_HOME
|
||||
|
||||
chop_CLEANUP_HOOK='rm -rf "$XDG_CACHE_HOME" "$DB_FILE" "$TMP_FILE"'
|
||||
|
||||
--
|
||||
1.7.6
|
||||
|
@ -2,20 +2,13 @@
|
||||
, libuuid, lzo, pkgconfig, guile }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "libchop-0.5";
|
||||
name = "libchop-0.5.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://savannah/libchop/${name}.tar.gz";
|
||||
sha256 = "0i7gl0c99pf6794bbwm3iha6a0bciqq969mgwwv6gm9phiiy5s8b";
|
||||
sha256 = "1sfq4ibzc9fjmq7ga96k05lr77cyizxnipa3bzm5d22jwal1x3ib";
|
||||
};
|
||||
|
||||
patches =
|
||||
[ ./0001-tests-Simplify-deserialize.c.patch
|
||||
./0002-block-indexer-hash-Fix-off-by-n-in-ASCII-deserializa.patch
|
||||
./0003-fix-test-makefile.patch
|
||||
./0004-tests-Export-XDG_CACHE_HOME-in-utils-backup.patch
|
||||
];
|
||||
|
||||
buildNativeInputs = [ pkgconfig gperf ];
|
||||
buildInputs =
|
||||
[ zlib bzip2 lzo
|
||||
|
Loading…
Reference in New Issue
Block a user