[repo.or.cz] iwhd.git branch master updated: v0.0-234-gf0c9b98
by Jim Meyering
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via f0c9b98d7c02a01b44e550db62088acb23e5655e (commit)
from 2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/f0c9b98d7c02a01b44e550db62088acb23e5655e
commit f0c9b98d7c02a01b44e550db62088acb23e5655e
Author: Jim Meyering <meyering(a)redhat.com>
Date: Mon Oct 25 20:16:00 2010 +0200
s3_register: correct a diagnostic: s/key/secret/
diff --git a/backend.c b/backend.c
index d3c5aae..173586d 100644
--- a/backend.c
+++ b/backend.c
@@ -416,7 +416,7 @@ s3_register (my_state *ms, const provider_t *prov, const char *next,
if (!api_secret) {
api_secret = (char *)prov->password;
if (!prov->password) {
- error (0, 0, "missing EC2 API key");
+ error (0, 0, "missing EC2 API secret");
goto cleanup;
}
}
-----------------------------------------------------------------------
Summary of changes:
backend.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-233-g2b25f26
by Jim Meyering
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb (commit)
from f74043a7e17d49b1f27e166d88ad8d09e9aafd2a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb
commit 2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb
Author: Jim Meyering <meyering(a)redhat.com>
Date: Mon Oct 25 19:36:13 2010 +0200
add a reminder not to hard-code /tmp/iwtmp.XXXXXX
We should be able to specify some other directory.
Also add a "const".
diff --git a/backend.c b/backend.c
index 6be25b5..d3c5aae 100644
--- a/backend.c
+++ b/backend.c
@@ -319,13 +319,14 @@ s3_bcreate (const provider_t *prov, const char *bucket)
}
static const char *
-s3_init_tmpfile (char *value)
+s3_init_tmpfile (const char *value)
{
char *path;
int fd;
size_t len;
ssize_t written;
+ /* FIXME: do not hard-code /tmp. */
path = strdup("/tmp/iwtmp.XXXXXX");
if (!path) {
return NULL;
-----------------------------------------------------------------------
Summary of changes:
backend.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-232-gf74043a
by zaitcev
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via f74043a7e17d49b1f27e166d88ad8d09e9aafd2a (commit)
via b992b5231f12c76a9c33e9cd777a9e1863489d00 (commit)
from 39c17c133e63a5c9b339da577a09e0a77babcf9b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/f74043a7e17d49b1f27e166d88ad8d09e9aafd2a
commit f74043a7e17d49b1f27e166d88ad8d09e9aafd2a
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Fri Oct 22 15:32:56 2010 -0600
Bump testing timeouts
I have a slow laptop that needs this. Lots of disk activity when testing,
looks like Mongo does not like ext3 much, at least on Fedora 15.
Note that it's preferable for the framework timeout to be greater than
the autostart's own timeout. This way if autostart times out, it kills
mongo that it started, and usually succeeds. But if we let framework
kill things, mongo sometimes escapes.
Also it's weird, but basic usually succeeds quickly enough, so no bump
there - only bump auto and replication tests.
diff --git a/auto.c b/auto.c
index c385521..b428bce 100644
--- a/auto.c
+++ b/auto.c
@@ -183,7 +183,7 @@ auto_wait_mongod(void)
rc = auto_test_mongod();
if (rc == 0)
break;
- if (time(NULL) >= start_time + 5) {
+ if (time(NULL) >= start_time + 20) {
error(0, 0, "failed to verify mongod using port %s",
auto_arg_port);
return -1;
diff --git a/t/auto b/t/auto
index 86efade..dee4c4e 100644
--- a/t/auto
+++ b/t/auto
@@ -22,11 +22,11 @@ iwhd -v -p $port -a &
iwhd_pid=$!
cleanup_() { kill $iwhd_pid; }
-# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo localhost:$m_port < /dev/null' +# Wait for up to 10 seconds for mongod to begin listening.
+wait_for .1 100 'mongo localhost:$m_port < /dev/null' || framework_failure_ mongod failed to start
-# Wait for up to 3 seconds for iwhd to begin listening on $port.
-wait_for .1 30 "curl -s http://localhost:$port" +# Wait for up to 20 seconds for iwhd to begin listening on $port.
+wait_for .1 200 "curl -s http://localhost:$port" || framework_failure_ iwhd failed to start
mongo_pid=$(cat mongo.pid)
diff --git a/t/replication b/t/replication
index fc645b8..74423f2 100644
--- a/t/replication
+++ b/t/replication
@@ -18,8 +18,8 @@ mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1
mongo_pid=$!
cleanup_() { kill -9 $mongo_pid; }
-# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo localhost:$m_port < /dev/null' +# Wait for up to 12 seconds for mongod to begin listening.
+wait_for .1 120 'mongo localhost:$m_port < /dev/null' || framework_failure_ mongod failed to start
cat > iwhd_u.cfg << EOF
http://repo.or.cz/w/iwhd.git/commit/b992b5231f12c76a9c33e9cd777a9e1863489d00
commit b992b5231f12c76a9c33e9cd777a9e1863489d00
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Fri Oct 22 15:32:03 2010 -0600
Lock auto.c to IPv4
As it turned out Mongo manages to listen on IPv4 only even if the
system supports IPv6. The autostart tries to connect over IPv6,
depending which address is returned first, and then fails.
The fix is simply to use IPv4 always, at least for loopback.
diff --git a/auto.c b/auto.c
index 6311f41..c385521 100644
--- a/auto.c
+++ b/auto.c
@@ -21,6 +21,7 @@
#include "iwh.h"
#include "state_defs.h"
+static int auto_db_port;
static char auto_arg_port[10];
static char *auto_arg_mongod[] = {
@@ -132,84 +133,34 @@ auto_spawn (const char *prog, char *argv[])
return pid;
}
-/*
- * The server_node and node_resolve are taken verbatim from wait-for-listen.
- * Is this time to factor?
- */
-#define ADDRSIZE 40
-
-struct server_node {
- unsigned alen;
- union {
- struct sockaddr addr;
- unsigned char x[ADDRSIZE];
- } a;
-};
-
-static int
-node_resolve(struct server_node *sn,
- const char *hostname, const char *portstr)
-{
- struct addrinfo hints;
- struct addrinfo *res, *res0;
- int rc;
-
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
-
- rc = getaddrinfo(hostname, portstr, &hints, &res0);
- if (rc) {
- error(0, 0, "getaddrinfo(%s:%s) failed: %s",
- hostname, portstr, gai_strerror(rc));
- return -1;
- }
-
- for (res = res0; res; res = res->ai_next) {
- if (res->ai_family != AF_INET && res->ai_family != AF_INET6)
- continue;
-
- if (res->ai_addrlen > ADDRSIZE) /* should not happen */
- continue;
-
- memcpy(&sn->a.addr, res->ai_addr, res->ai_addrlen);
- sn->alen = res->ai_addrlen;
-
- freeaddrinfo(res0);
- return 0;
- }
-
- freeaddrinfo(res0);
- return -1;
-}
-
static int
auto_test_mongod(void)
{
- struct server_node snode, *sn = &snode;
+ union {
+ struct sockaddr_in a4;
+ struct sockaddr a;
+ } addr;
int sfd;
int rc;
- memset(sn, 0, sizeof(struct server_node));
- if (node_resolve(sn, AUTO_HOST, auto_arg_port) != 0) {
- /*
- * Most likely nothing else would work anyway. So abend.
- */
- error(0, 0, "unable to resolve host %s port %s",
- AUTO_HOST, auto_arg_port);
- return -1;
- }
+ /*
+ * We hardcode IPv4 because Mongo often listens on IPv4 only.
+ */
+ memset(&addr, 0, sizeof(addr));
+ addr.a4.sin_family = AF_INET;
+ addr.a4.sin_port = htons(auto_db_port);
+ addr.a4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- DPRINTF("trying to connect to mongod (host %s port %s) ...n",
- AUTO_HOST, auto_arg_port);
+ DPRINTF("trying to connect to mongod (host 127.0.0.1 port %u) ...n",
+ auto_db_port);
- sfd = socket(sn->a.addr.sa_family, SOCK_STREAM, 0);
+ sfd = socket(addr.a.sa_family, SOCK_STREAM, 0);
if (sfd < 0) {
error(0, errno, "socket");
return -1;
}
- rc = connect(sfd, &sn->a.addr, sn->alen);
+ rc = connect(sfd, &addr.a, sizeof(addr.a4));
if (rc != 0) {
DPRINTF("connect: %sn", strerror(errno));
close(sfd);
@@ -296,6 +247,7 @@ auto_start (int dbport)
char **earg;
int pid;
+ auto_db_port = dbport;
snprintf(auto_arg_port, sizeof(auto_arg_port), "%u", dbport);
if (auto_prepare_area() < 0)
-----------------------------------------------------------------------
Summary of changes:
auto.c | 84 ++++++++++++--------------------------------------------
t/auto | 8 +++---
t/replication | 4 +-
3 files changed, 24 insertions(+), 72 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-230-g39c17c1
by Jim Meyering
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 39c17c133e63a5c9b339da577a09e0a77babcf9b (commit)
from 0cbc1d76117be554a5d60f22bc1883fe9ee3de37 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/39c17c133e63a5c9b339da577a09e0a77babcf9b
commit 39c17c133e63a5c9b339da577a09e0a77babcf9b
Author: Jim Meyering <meyering(a)redhat.com>
Date: Fri Oct 22 16:11:28 2010 +0200
parser: plug more leaks
* qparser.y (parse): Don't leak each expression tree.
(free_value): Handle v == &invalid.
Omit debug printf -- it would cause test failure, now that
we're using free_value more.
(main) [PARSER_UNIT_TEST]: Free "expr".
diff --git a/qparser.y b/qparser.y
index 1c6530a..8e5445e 100644
--- a/qparser.y
+++ b/qparser.y
@@ -426,14 +426,10 @@ print_value (const value_t *v)
void
free_value (value_t *v)
{
- if (!v) {
+ if (v == NULL || v == &invalid) {
return;
}
- if (v->resolved) {
- printf("freeing resolved string "%s" (%p)n",
- v->resolved, v->resolved);
- }
free((void *)v->resolved);
switch (v->type) {
@@ -471,8 +467,10 @@ parse (const char *text)
if (yylex_init (&scanner))
error (0, errno, "failed to initialize query parser");
YY_BUFFER_STATE buf = yy_scan_string (text, scanner);
- value_t *result;
+ value_t *result = NULL;
value_t *r = yyparse (scanner, &result) == 0 ? result : NULL;
+ if (r == NULL)
+ free_value (result);
yy_delete_buffer (buf, scanner);
yylex_destroy (scanner);
return r;
@@ -689,7 +687,7 @@ main (int argc, char **argv)
{
printf ("could not parse '%s'n", argv[i]);
fail = 1;
- continue;
+ goto next;
}
print_value (expr);
@@ -698,9 +696,12 @@ main (int argc, char **argv)
if (str)
{
printf ("s= %sn", str);
- continue;
+ goto next;
}
printf ("d= %dn", eval (expr, &unit_oget, &unit_sget));
+
+ next:
+ free_value (expr);
}
return fail;
-----------------------------------------------------------------------
Summary of changes:
qparser.y | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-229-g0cbc1d7
by Jeff Darcy
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 0cbc1d76117be554a5d60f22bc1883fe9ee3de37 (commit)
via 2261a70baa183c94dde736e2636c8c00c8f171e8 (commit)
via 56c3693765e0cdedde5a52b13063470836fb7215 (commit)
via 7520862b39704ab36ae8ff478a032c3398ef12f5 (commit)
from e2d933c6e5e1d39edc0664d4c21658148e437125 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/0cbc1d76117be554a5d60f22bc1883fe9ee3de37
commit 0cbc1d76117be554a5d60f22bc1883fe9ee3de37
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 12:41:46 2010 -0400
Change test-file names to be descriptive, avoid dups.
diff --git a/t/basic b/t/basic
index 0d15629..4f979f0 100644
--- a/t/basic
+++ b/t/basic
@@ -2,13 +2,13 @@
# Test basic functionality.
# TEST-FILE USAGE
-# f1 object put/get/delete
-# f2 bucket listing
-# f3 attribute PUT, headless operation
-# f4 attribute POST
-# f5 reserved attr
-# f6 X-redhat-role
-# f7 truncation
+# obj_test object put/get/delete
+# list_test bucket listing
+# attr_put attribute PUT, headless operation
+# attr_post attribute POST
+# rsvd_attr reserved attr
+# role_test X-redhat-role
+# trunc_test truncation
. "${srcdir=.}/init.sh"; path_prepend_ ..
@@ -154,12 +154,12 @@ curl -f -X PUT http://localhost:$port 2> root_put.err
grep ' 404$' root_put.err || fail=1
# Create a file in that bucket.
-echo foo | curl -T - $bucket/f1 || fail=1
+echo foo | curl -T - $bucket/obj_test || fail=1
# Test presence in the FS.
-test -f FS/b1/f1 || fail=1
-test "$(cat FS/b1/f1)" = foo || fail=1
+test -f FS/b1/obj_test || fail=1
+test "$(cat FS/b1/obj_test)" = foo || fail=1
# Test through the API as well.
-curl $bucket/f1 > f1copy
+curl $bucket/obj_test > f1copy
test "$(cat f1copy)" = foo || fail=1
@@ -174,11 +174,11 @@ curl -H 'Accept: */json' http://localhost:$port > root || fail=1
compare root root.json || fail=1
# Delete an object.
-curl -X DELETE $bucket/f1 || fail=1
+curl -X DELETE $bucket/obj_test || fail=1
# Ensure that it's gone from the file system.
-test -f FS/b1/f1 && fail=1
+test -f FS/b1/obj_test && fail=1
# Ensure that it's gone in the API as well.
-curl -f $bucket/f1 > /dev/null 2> del_object.err
+curl -f $bucket/obj_test > /dev/null 2> del_object.err
grep ' 404$' del_object.err || fail=1
# Try to delete a nonexistent object.
@@ -186,7 +186,8 @@ curl -f -X DELETE $bucket/no-such-obj 2> del_nosuch.err
grep ' 404$' del_nosuch.err || fail=1
# Make sure the X-redhat-role header causes failure on a master iwhd.
-echo hello | curl -f -T - -H "X-redhat-role: master" $bucket/f6 2> role.err
+echo hello | curl -f -T - -H "X-redhat-role: master" $bucket/role_test + 2> role.err
grep ' 403$' role.err || fail=1
# ################## Providers
@@ -244,49 +245,49 @@ for i in xml json; do
compare b.exp b || fail=1
# Add an object, list non-empty bucket.
- echo bar | curl -T - $bucket/f2 || fail=1
+ echo bar | curl -T - $bucket/list_test || fail=1
# Ensure that new name appears in the listing.
curl_H $bucket > b || fail=1
- emit_bucket_list $i b1:f2 > b.exp || fail=1
+ emit_bucket_list $i b1:list_test > b.exp || fail=1
compare b.exp b || fail=1
- # Remove b1/f2, to restore state for next iteration of this loop.
- curl -X DELETE $bucket/f2 || fail=1
+ # Remove b1/list_test, to restore state for next iteration of this loop.
+ curl -X DELETE $bucket/list_test || fail=1
done
# Add a single attribute to an object using the PUT method.
bucket=$bucket
-printf nothing | curl -T - $bucket/f3 || fail=1
-printf blue | curl -T - $bucket/f3/color || fail=1
-test "$(curl $bucket/f3/color)" = blue || fail=1
+printf nothing | curl -T - $bucket/attr_put || fail=1
+printf blue | curl -T - $bucket/attr_put/color || fail=1
+test "$(curl $bucket/attr_put/color)" = blue || fail=1
# Add multiple attributes to an object using the POST method.
# NB use a file which doesn't yet exist (yes, this should work too)
-curl -d key=f4 -d shape=round -d size=big $bucket || fail=1
-test "$(curl $bucket/f4/shape)" = round || fail=1
-test "$(curl $bucket/f4/size)" = big || fail=1
+curl -d key=attr_post -d shape=round -d size=big $bucket || fail=1
+test "$(curl $bucket/attr_post/shape)" = round || fail=1
+test "$(curl $bucket/attr_post/size)" = big || fail=1
# Ensure that an attempt to add each reserved attribute fails.
# FIXME: keep this list in sync with the one in rest.c:
# grep '^static.*reserved_attr' rest.c
for attr in bucket key date etag loc; do
- printf whatever | curl -f -T - $bucket/f5/$attr 2> bad_attr.err
+ printf whatever | curl -f -T - $bucket/rsvd_attr/$attr 2> bad_attr.err
grep ' 400$' bad_attr.err || fail=1
done
# Make sure PUTting a file truncates.
-echo hello | curl -f -T - $bucket/f7 || fail=1
-echo bye | curl -f -T - $bucket/f7 || fail=1
-cat FS/b1/f7
-test "$(cat FS/b1/f7)" = bye || fail=1
+echo hello | curl -f -T - $bucket/trunc_test || fail=1
+echo bye | curl -f -T - $bucket/trunc_test || fail=1
+cat FS/b1/trunc_test
+test "$(cat FS/b1/trunc_test)" = bye || fail=1
# Test "headless" operation (no access to metadata DB).
kill -9 $mongo_pid
cleanup_() { kill $iwhd_pid; }
-curl $bucket/f3 > f3copy
+curl $bucket/attr_put > f3copy
test "$(cat f3copy)" = "nothing" || fail=1
# TBD: add attribute-delete tests when that functionality is implemented
diff --git a/t/replication b/t/replication
index 22cebf8..fc645b8 100644
--- a/t/replication
+++ b/t/replication
@@ -2,11 +2,11 @@
# Test replication functionality.
# TEST-FILE USAGE
-# file2 default policy (negative)
-# file3 always-replicate policy (positive)
-# file4 selective positive, delete
-# file5 selective negative
-# file6 attribute change (positive)
+# dflt_test default policy (negative)
+# pos_test always-replicate policy (positive)
+# sel_pos selective positive, delete
+# sel_neg selective negative
+# attr_chg attribute change (positive)
. "${srcdir=.}/init.sh"; path_prepend_ ..
@@ -68,50 +68,50 @@ test -d fs_upstream/rbucket || fail=1
test -d fs_downstream/rbucket || fail=1
# Add a file, make sure it's *not* replicated (default policy).
-echo foo | curl -T - $bkt/file2 || fail=1
+echo foo | curl -T - $bkt/dflt_test || fail=1
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
-test -f fs_upstream/rbucket/file2 || fail=1
-test -f fs_downstream/rbucket/file2 && fail=1
+test -f fs_upstream/rbucket/dflt_test || fail=1
+test -f fs_downstream/rbucket/dflt_test && fail=1
# Set the replication policy to always replicate.
echo -n 1 | curl -T - $bkt/_default/_policy || fail=1
# Add a file, make sure it *is* replicated.
-echo foo | curl -T - $bkt/file3 || fail=1
+echo foo | curl -T - $bkt/pos_test || fail=1
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
-test -f fs_upstream/rbucket/file3 || fail=1
-test -f fs_downstream/rbucket/file3 || fail=1
+test -f fs_upstream/rbucket/pos_test || fail=1
+test -f fs_downstream/rbucket/pos_test || fail=1
# Make sure we can do selective replication based on object/site attributes.
echo -n '$color==#color' | curl -T - $bkt/_default/_policy || fail=1
# Positive test.
# NB this file is also used by the delete test below
-echo -n blue | curl -T - $bkt/file4/color || fail=1
-echo -n foo | curl -T - $bkt/file4 || fail=1
+echo -n blue | curl -T - $bkt/sel_pos/color || fail=1
+echo -n foo | curl -T - $bkt/sel_pos || fail=1
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
-test -f fs_downstream/rbucket/file4 || fail=1
+test -f fs_downstream/rbucket/sel_pos || fail=1
# Negative test.
-echo -n red | curl -T - $bkt/file5/color || fail=1
-echo -n foo | curl -T - $bkt/file5 || fail=1
+echo -n red | curl -T - $bkt/sel_neg/color || fail=1
+echo -n foo | curl -T - $bkt/sel_neg || fail=1
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
-test -f fs_downstream/rbucket/file5 && fail=1
+test -f fs_downstream/rbucket/sel_neg && fail=1
# Test replication of deletes.
-curl -X DELETE $bkt/file4 || fail=1
+curl -X DELETE $bkt/sel_pos || fail=1
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
-test -f fs_upstream/rbucket/file4 && fail=1
-test -f fs_downstream/rbucket/file4 && fail=1
+test -f fs_upstream/rbucket/sel_pos && fail=1
+test -f fs_downstream/rbucket/sel_pos && fail=1
# Test re-replication when we change an attribute.
-echo hello | curl -T - $bkt/file6
-echo -n 'red' | curl -T - $bkt/file6/color
-echo -n '$color=="blue"' | curl -T - $bkt/file6/_policy
-test -f fs_downstream/rbucket/file6 && fail=1
-echo -n 'blue' | curl -T - $bkt/file6/color
+echo hello | curl -T - $bkt/attr_chg
+echo -n 'red' | curl -T - $bkt/attr_chg/color
+echo -n '$color=="blue"' | curl -T - $bkt/attr_chg/_policy
+test -f fs_downstream/rbucket/attr_chg && fail=1
+echo -n 'blue' | curl -T - $bkt/attr_chg/color
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
-test -f fs_downstream/rbucket/file6 || fail=1
+test -f fs_downstream/rbucket/attr_chg || fail=1
# TBD: add op=check result checks
http://repo.or.cz/w/iwhd.git/commit/2261a70baa183c94dde736e2636c8c00c8f171e8
commit 2261a70baa183c94dde736e2636c8c00c8f171e8
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 11:51:06 2010 -0400
Add test for truncation when overwriting an object.
Also added test-file-usage info in t/basic and t/replication.
diff --git a/t/basic b/t/basic
index b62b7cc..0d15629 100644
--- a/t/basic
+++ b/t/basic
@@ -1,6 +1,15 @@
#!/bin/sh
# Test basic functionality.
+# TEST-FILE USAGE
+# f1 object put/get/delete
+# f2 bucket listing
+# f3 attribute PUT, headless operation
+# f4 attribute POST
+# f5 reserved attr
+# f6 X-redhat-role
+# f7 truncation
+
. "${srcdir=.}/init.sh"; path_prepend_ ..
mkdir FS mongod iwhd || framework_failure_ mkdir failed
@@ -180,7 +189,6 @@ grep ' 404$' del_nosuch.err || fail=1
echo hello | curl -f -T - -H "X-redhat-role: master" $bucket/f6 2> role.err
grep ' 403$' role.err || fail=1
-
# ################## Providers
p_name=primary
@@ -269,6 +277,12 @@ for attr in bucket key date etag loc; do
grep ' 400$' bad_attr.err || fail=1
done
+# Make sure PUTting a file truncates.
+echo hello | curl -f -T - $bucket/f7 || fail=1
+echo bye | curl -f -T - $bucket/f7 || fail=1
+cat FS/b1/f7
+test "$(cat FS/b1/f7)" = bye || fail=1
+
# Test "headless" operation (no access to metadata DB).
kill -9 $mongo_pid
cleanup_() { kill $iwhd_pid; }
diff --git a/t/replication b/t/replication
index 5423dc3..22cebf8 100644
--- a/t/replication
+++ b/t/replication
@@ -1,6 +1,13 @@
#!/bin/sh
# Test replication functionality.
+# TEST-FILE USAGE
+# file2 default policy (negative)
+# file3 always-replicate policy (positive)
+# file4 selective positive, delete
+# file5 selective negative
+# file6 attribute change (positive)
+
. "${srcdir=.}/init.sh"; path_prepend_ ..
mkdir mongod fs_upstream fs_downstream || framework_failure_ mkdir failed
http://repo.or.cz/w/iwhd.git/commit/56c3693765e0cdedde5a52b13063470836fb7215
commit 56c3693765e0cdedde5a52b13063470836fb7215
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 11:33:44 2010 -0400
Add test for re-replication when an attribute changes.
diff --git a/t/replication b/t/replication
index 08721ea..5423dc3 100644
--- a/t/replication
+++ b/t/replication
@@ -92,11 +92,20 @@ wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
test -f fs_downstream/rbucket/file5 && fail=1
# Test replication of deletes.
-curl -X DELETE $bkt/file4 || fail=2
+curl -X DELETE $bkt/file4 || fail=1
wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
test -f fs_upstream/rbucket/file4 && fail=1
test -f fs_downstream/rbucket/file4 && fail=1
+# Test re-replication when we change an attribute.
+echo hello | curl -T - $bkt/file6
+echo -n 'red' | curl -T - $bkt/file6/color
+echo -n '$color=="blue"' | curl -T - $bkt/file6/_policy
+test -f fs_downstream/rbucket/file6 && fail=1
+echo -n 'blue' | curl -T - $bkt/file6/color
+wait_for .1 50 "wait_for_repl $api" || fail_ "replication seems stuck"
+test -f fs_downstream/rbucket/file6 || fail=1
+
# TBD: add op=check result checks
Exit $fail
http://repo.or.cz/w/iwhd.git/commit/7520862b39704ab36ae8ff478a032c3398ef12f5
commit 7520862b39704ab36ae8ff478a032c3398ef12f5
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 11:24:20 2010 -0400
Fixed X-redhat-role check.
rest.c: validate_put fails if hdr present on master
t/basic: new test for PUT rejected due to role
t/replication: added missing -m to downstream iwhd
diff --git a/rest.c b/rest.c
index 6bfe1a7..43923d4 100644
--- a/rest.c
+++ b/rest.c
@@ -115,14 +115,25 @@ validate_put (struct MHD_Connection *conn)
{
const char *mhdr;
- if (!master_host) {
- /* We're not a slave, so we don't care. */
- return 1;
- }
-
mhdr = MHD_lookup_connection_value(conn,MHD_HEADER_KIND,
"X-redhat-role");
- return (mhdr && !strcmp(mhdr,"master"));
+ /*
+ * This will fail most obviously in the case where we are not the
+ * master, we know we're not the master, and we don't see this
+ * header (which is set in master-to-slave replication requests).
+ * It will *also* fail, deliberately, if we do see this header when
+ * we think we're the master, as it means there's a mismatch between
+ * their config and ours. This avoids "strange" behavior in such
+ * cases, in favor of a more obvious failure.
+ * TBD: this will be less of a problem if/when we identify the
+ * master and DB via the config file instead of -m/-d.
+ */
+ if (master_host) {
+ return (mhdr && !strcmp(mhdr,"master"));
+ }
+ else {
+ return !mhdr;
+ }
}
static int
diff --git a/t/basic b/t/basic
index 2ea2fcd..b62b7cc 100644
--- a/t/basic
+++ b/t/basic
@@ -16,11 +16,13 @@ wait_for .1 30 'mongo localhost:$m_port < /dev/null' || framework_failure_ mongod failed to start
port=9091
+bucket=http://localhost:$port/b1
+
cat <<EOF > root.xml || framework_failure_
<api service="image_warehouse" version="$VERSION">
<link rel="bucket_factory" href="http://localhost:$port/_new"/>
<link rel="provider_list" href="http://localhost:$port/_providers"/>
- <link rel="bucket" href="http://localhost:$port/b1"/>
+ <link rel="bucket" href="$bucket"/>
</api>
EOF
@@ -39,7 +41,7 @@ cat <<EOF > root.json || framework_failure_
},
{
"rel": "bucket",
- "link": "http://localhost:$port/b1"
+ "link": "$bucket"
}
]
}
@@ -130,13 +132,12 @@ cleanup_() { kill -9 $mongo_pid; kill $iwhd_pid; }
wait_for .1 30 "curl -s http://localhost:$port" || { echo iwhd failed to listen; Exit 1; }
-
# Create an empty bucket.
-curl -X PUT http://localhost:$port/b1 || fail=1
+curl -X PUT $bucket || fail=1
test -d FS/b1 || fail=1
# Try to create a duplicate bucket.
-curl -f -X PUT http://localhost:$port/b1 2> dup_bucket.err
+curl -f -X PUT $bucket 2> dup_bucket.err
grep ' 500$' dup_bucket.err || fail=1
# PUT to root; should fail
@@ -144,12 +145,12 @@ curl -f -X PUT http://localhost:$port 2> root_put.err
grep ' 404$' root_put.err || fail=1
# Create a file in that bucket.
-echo foo | curl -T - http://localhost:$port/b1/f1 || fail=1
+echo foo | curl -T - $bucket/f1 || fail=1
# Test presence in the FS.
test -f FS/b1/f1 || fail=1
test "$(cat FS/b1/f1)" = foo || fail=1
# Test through the API as well.
-curl http://localhost:$port/b1/f1 > f1copy
+curl $bucket/f1 > f1copy
test "$(cat f1copy)" = foo || fail=1
@@ -164,17 +165,21 @@ curl -H 'Accept: */json' http://localhost:$port > root || fail=1
compare root root.json || fail=1
# Delete an object.
-curl -X DELETE http://localhost:$port/b1/f1 || fail=1
+curl -X DELETE $bucket/f1 || fail=1
# Ensure that it's gone from the file system.
test -f FS/b1/f1 && fail=1
# Ensure that it's gone in the API as well.
-curl -f http://localhost:$port/b1/f1 > /dev/null 2> del_object.err
+curl -f $bucket/f1 > /dev/null 2> del_object.err
grep ' 404$' del_object.err || fail=1
# Try to delete a nonexistent object.
-curl -f -X DELETE http://localhost:$port/b1/no-such-obj 2> del_nosuch.err
+curl -f -X DELETE $bucket/no-such-obj 2> del_nosuch.err
grep ' 404$' del_nosuch.err || fail=1
+# Make sure the X-redhat-role header causes failure on a master iwhd.
+echo hello | curl -f -T - -H "X-redhat-role: master" $bucket/f6 2> role.err
+grep ' 403$' role.err || fail=1
+
# ################## Providers
@@ -226,26 +231,26 @@ for i in xml json; do
compare p.exp p || fail=1
# List an empty bucket.
- curl_H http://localhost:$port/b1 > b || fail=1
+ curl_H $bucket > b || fail=1
emit_bucket_list $i > b.exp || fail=1
compare b.exp b || fail=1
# Add an object, list non-empty bucket.
- echo bar | curl -T - http://localhost:$port/b1/f2 || fail=1
+ echo bar | curl -T - $bucket/f2 || fail=1
# Ensure that new name appears in the listing.
- curl_H http://localhost:$port/b1 > b || fail=1
+ curl_H $bucket > b || fail=1
emit_bucket_list $i b1:f2 > b.exp || fail=1
compare b.exp b || fail=1
# Remove b1/f2, to restore state for next iteration of this loop.
- curl -X DELETE http://localhost:$port/b1/f2 || fail=1
+ curl -X DELETE $bucket/f2 || fail=1
done
# Add a single attribute to an object using the PUT method.
-bucket=http://localhost:$port/b1
+bucket=$bucket
printf nothing | curl -T - $bucket/f3 || fail=1
printf blue | curl -T - $bucket/f3/color || fail=1
test "$(curl $bucket/f3/color)" = blue || fail=1
diff --git a/t/replication b/t/replication
index e9a26d5..08721ea 100644
--- a/t/replication
+++ b/t/replication
@@ -37,7 +37,7 @@ cat > iwhd_d.cfg << EOF
EOF
d_port=9093
-iwhd -v -p $d_port -c iwhd_d.cfg -d localhost:$m_port &
+iwhd -v -p $d_port -c iwhd_d.cfg -d localhost:$m_port -m localhost:$port &
iwhd_d_pid=$!
wait_for .1 30 "curl http://localhost:$d_port" || framework_failure_ "iwhd downstream"
-----------------------------------------------------------------------
Summary of changes:
rest.c | 23 ++++++++++++----
t/basic | 76 ++++++++++++++++++++++++++++++++++++---------------------
t/replication | 48 ++++++++++++++++++++++++------------
3 files changed, 97 insertions(+), 50 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-225-ge2d933c
by Jim Meyering
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via e2d933c6e5e1d39edc0664d4c21658148e437125 (commit)
from f4d05852a6185b36660f5feee44cdb82ccba7b32 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/e2d933c6e5e1d39edc0664d4c21658148e437125
commit e2d933c6e5e1d39edc0664d4c21658148e437125
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Oct 21 08:41:59 2010 +0200
plug error path leak
diff --git a/rest.c b/rest.c
index 8f42be3..6bfe1a7 100644
--- a/rest.c
+++ b/rest.c
@@ -910,6 +910,7 @@ proxy_delete (void *cctx, struct MHD_Connection *conn, const char *url,
resp = MHD_create_response_from_data(0,NULL,MHD_NO,MHD_NO);
if (!resp) {
+ free_ms(ms);
return MHD_NO;
}
MHD_queue_response(conn,rc,resp);
-----------------------------------------------------------------------
Summary of changes:
rest.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-224-gf4d0585
by Jim Meyering
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via f4d05852a6185b36660f5feee44cdb82ccba7b32 (commit)
via c98f5c1f712ca5b35cbaef83d2ea47015687e68c (commit)
via e6a29d3e5890a27c8f3afae96b8d5a2cf6cbaed6 (commit)
via 064e3f485714996a9a4c85acd32dd514f4481fd6 (commit)
from 2925ba08e51d0fb17df600da56c70e20627ab8e6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/f4d05852a6185b36660f5feee44cdb82ccba7b32
commit f4d05852a6185b36660f5feee44cdb82ccba7b32
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Oct 21 09:08:39 2010 +0200
reduce scope of global to be file-only
* qparser.y (hacked_links): Declare to be "static const".
diff --git a/qparser.y b/qparser.y
index a23b5a7..1c6530a 100644
--- a/qparser.y
+++ b/qparser.y
@@ -329,7 +329,7 @@ unit_sget_func (void * notused, const char *text)
static const getter_t unit_sget = { unit_sget_func };
/* Fake links from an object/key tuple to an object/key string. */
-struct { char *obj; char *key; char *value; } hacked_links[] = {
+static const struct { char *obj; char *key; char *value; } hacked_links[] = {
{ "templates/the_tmpl", "owner", "users/the_user" },
{ "users/the_user", "name", "Jeff Darcy" },
{ NULL }
http://repo.or.cz/w/iwhd.git/commit/c98f5c1f712ca5b35cbaef83d2ea47015687e68c
commit c98f5c1f712ca5b35cbaef83d2ea47015687e68c
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 21:36:37 2010 +0200
parser: move x*alloc functions into #if-unit-test block where used
* qparser.y (xalloc_die, xmalloc, xmemdup, xstrdup): Move functions...
[#if PARSER_UNIT_TEST]: ... into this #if-block, since now they're
used only there.
diff --git a/qparser.y b/qparser.y
index cb6d36e..a23b5a7 100644
--- a/qparser.y
+++ b/qparser.y
@@ -28,44 +28,6 @@ static value_t invalid = { T_INVALID, {0}, NULL };
#define YY_DECL int yylex(YYSTYPE *, void *scanner);
YY_DECL
-static void
-xalloc_die (void)
-{
- error (EXIT_FAILURE, 0, "%s", "memory exhausted");
-
- /* The `noreturn' cannot be given to error, since it may return if
- its first argument is 0. To help compilers understand the
- xalloc_die does not return, call abort. Also, the abort is a
- safety feature if exit_failure is 0 (which shouldn't happen). */
- abort ();
-}
-
-/* Allocate N bytes of memory dynamically, with error checking. */
-static void *
-xmalloc (size_t n)
-{
- void *p = malloc (n);
- if (!p && n != 0)
- xalloc_die ();
- return p;
-}
-
-/* Clone an object P of size S, with error checking. There's no need
- for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
- need for an arithmetic overflow check. */
-static void *
-xmemdup (void const *p, size_t s)
-{
- return memcpy (xmalloc (s), p, s);
-}
-
-/* Clone STRING. */
-static char *
-xstrdup (char const *string)
-{
- return xmemdup (string, strlen (string) + 1);
-}
-
/* TBD: use separate function to parse dates differently */
static value_t *
make_number (const char *text)
@@ -292,6 +254,45 @@ paren_expr:
%%
#if defined PARSER_UNIT_TEST
+
+static void
+xalloc_die (void)
+{
+ error (EXIT_FAILURE, 0, "%s", "memory exhausted");
+
+ /* The `noreturn' cannot be given to error, since it may return if
+ its first argument is 0. To help compilers understand the
+ xalloc_die does not return, call abort. Also, the abort is a
+ safety feature if exit_failure is 0 (which shouldn't happen). */
+ abort ();
+}
+
+/* Allocate N bytes of memory dynamically, with error checking. */
+static void *
+xmalloc (size_t n)
+{
+ void *p = malloc (n);
+ if (!p && n != 0)
+ xalloc_die ();
+ return p;
+}
+
+/* Clone an object P of size S, with error checking. There's no need
+ for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
+ need for an arithmetic overflow check. */
+static void *
+xmemdup (void const *p, size_t s)
+{
+ return memcpy (xmalloc (s), p, s);
+}
+
+/* Clone STRING. */
+static char *
+xstrdup (char const *string)
+{
+ return xmemdup (string, strlen (string) + 1);
+}
+
static const struct { char *name; char *value; } hacked_obj_fields[] = {
/* Fake object fields for generic unit testing. */
{ "a", "2" }, { "b", "7" }, { "c", "11" },
http://repo.or.cz/w/iwhd.git/commit/e6a29d3e5890a27c8f3afae96b8d5a2cf6cbaed6
commit e6a29d3e5890a27c8f3afae96b8d5a2cf6cbaed6
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 21:34:08 2010 +0200
parser: remove dead code
* qparser.y (xrealloc): Remove if-0'd function.
diff --git a/qparser.y b/qparser.y
index 82b5125..cb6d36e 100644
--- a/qparser.y
+++ b/qparser.y
@@ -50,19 +50,6 @@ xmalloc (size_t n)
return p;
}
-#if 0 // not used
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking. */
-static void *
-xrealloc (void *p, size_t n)
-{
- p = realloc (p, n);
- if (!p && n != 0)
- xalloc_die ();
- return p;
-}
-#endif
-
/* Clone an object P of size S, with error checking. There's no need
for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
need for an arithmetic overflow check. */
http://repo.or.cz/w/iwhd.git/commit/064e3f485714996a9a4c85acd32dd514f4481fd6
commit 064e3f485714996a9a4c85acd32dd514f4481fd6
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 21:33:29 2010 +0200
parser: handle OOM gracefully
Before, a failed malloc or strdup would lead to a NULL dereference.
* qparser.y (invalid): New file-scoped global.
(make_number): Never return NULL. Instead, return &invalid.
(make_string): Likewise.
(make_tree): If an input has type T_INVALID, return it right away.
Upon allocation failure, return &invalid.
(make_comp, make_link): Likewise.
(make_link, make_string): Avoid unnecessary strdup, now that
lexed tokens are malloc'd.
Also, add some per-function comments.
diff --git a/qparser.y b/qparser.y
index 99267c4..82b5125 100644
--- a/qparser.y
+++ b/qparser.y
@@ -21,6 +21,10 @@
#include "iwh.h"
+/* Return a pointer to this when allocation fails in a value_t-returning
+ function. */
+static value_t invalid = { T_INVALID, {0}, NULL };
+
#define YY_DECL int yylex(YYSTYPE *, void *scanner);
YY_DECL
@@ -80,71 +84,79 @@ static value_t *
make_number (const char *text)
{
value_t *tmp = malloc(sizeof(*tmp));
+ if (!tmp)
+ return &invalid;
- if (tmp) {
- tmp->type = T_NUMBER;
- tmp->as_num = strtoll(text,NULL,10);
- tmp->resolved = NULL;
- }
+ tmp->type = T_NUMBER;
+ tmp->as_num = strtoll(text,NULL,10);
+ tmp->resolved = NULL;
free ((void *) text);
return tmp;
}
+/* Return a malloc'd value_t buffer, with its type to T and using TEXT
+ (already malloc'd) as its string. */
static value_t *
make_string (const char *text, type_t t)
{
value_t *tmp = malloc(sizeof(*tmp));
+ if (!tmp)
+ return &invalid;
- if (tmp) {
- tmp->type = t;
- tmp->as_str = xstrdup(text);
- tmp->resolved = NULL;
- }
- free ((void *) text);
+ tmp->type = t;
+ tmp->as_str = (char *) text;
+ tmp->resolved = NULL;
return tmp;
}
+/* Return a malloc'd tree_t, with type T and branches LEFT and RIGHT.
+ LEFT must be non-NULL. RIGHT may be NULL (solely for use in handling
+ a negated expression). */
static value_t *
make_tree (type_t t, const value_t *left, const value_t *right)
{
+ if (left->type == T_INVALID)
+ return (value_t *) left;
+ if (t != T_LINK && right && right->type == T_INVALID)
+ return (value_t *) right;
value_t *tmp = malloc(sizeof(*tmp));
- if (tmp) {
- tmp->type = t;
- tmp->as_tree.left = (value_t *) left;
- tmp->as_tree.right = (value_t *) right;
- tmp->resolved = NULL;
- }
+ if (!tmp)
+ return &invalid;
+
+ tmp->type = t;
+ tmp->as_tree.left = (value_t *) left;
+ tmp->as_tree.right = (value_t *) right;
+ tmp->resolved = NULL;
return tmp;
}
+/* Return a malloc'd comp_t, with type T and branches LEFT and RIGHT.
+ LEFT and RIGHT must both be non-NULL. */
static value_t *
make_comp (comp_t c, const value_t *left, const value_t *right)
{
+ if (left->type == T_INVALID)
+ return (value_t *) left;
+ if (right->type == T_INVALID)
+ return (value_t *) right;
value_t *tmp = make_tree(T_COMP,left,right);
- if (tmp) {
- tmp->as_tree.op = c;
- }
+ if (!tmp)
+ return &invalid;
+
+ tmp->as_tree.op = c;
return tmp;
}
static value_t *
-make_link (value_t *left, const char *right)
+make_link (const value_t *left, const char *right)
{
- char *copy;
-
- copy = xstrdup(right);
- free ((void *) right);
- if (!copy) {
- return NULL;
- }
-
- return make_tree(T_LINK,left,(value_t *)copy);
+ return make_tree(T_LINK,left,(value_t *)right);
}
static void
-----------------------------------------------------------------------
Summary of changes:
qparser.y | 164 ++++++++++++++++++++++++++++++------------------------------
1 files changed, 82 insertions(+), 82 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-220-g2925ba0
by Jeff Darcy
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 2925ba08e51d0fb17df600da56c70e20627ab8e6 (commit)
via 70765c12c21e6f433d00bae5ea64f377f6f28f03 (commit)
from 26af6493b707f493676f3151557a04c25dd69a8e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/2925ba08e51d0fb17df600da56c70e20627ab8e6
commit 2925ba08e51d0fb17df600da56c70e20627ab8e6
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 10:35:51 2010 -0400
Add unlink/O_EXCL in case new file is shorter than what's there.
diff --git a/backend.c b/backend.c
index 07643d1..6be25b5 100644
--- a/backend.c
+++ b/backend.c
@@ -1249,7 +1249,10 @@ fs_put_child (void * ctx)
error(0,0,"path too long in %s",__func__);
return NULL;
}
- fd = open(fixed,O_WRONLY|O_CREAT,0666);
+ if (unlink(fixed) < 0) {
+ error(0,errno,"unlink failed for %s (non-fatal)",fixed);
+ }
+ fd = open(fixed,O_WRONLY|O_CREAT|O_EXCL,0666);
if (fd < 0) {
pipe_cons_siginit(ps, errno);
free(pp);
http://repo.or.cz/w/iwhd.git/commit/70765c12c21e6f433d00bae5ea64f377f6f28f03
commit 70765c12c21e6f433d00bae5ea64f377f6f28f03
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 10:33:02 2010 -0400
Add X-redhat-role header when replicating to ourselves.
diff --git a/backend.c b/backend.c
index 61fa515..07643d1 100644
--- a/backend.c
+++ b/backend.c
@@ -628,15 +628,16 @@ curl_get_child (void * ctx)
static void *
curl_put_child (void * ctx)
{
- pipe_private *pp = ctx;
- pipe_shared *ps = pp->shared;
- my_state *ms = ps->owner;
- provider_t *prov = pp->prov;
- curl_off_t llen;
- char fixed[ADDR_SIZE];
- CURL *curl;
- const char *clen;
- int chars;
+ pipe_private *pp = ctx;
+ pipe_shared *ps = pp->shared;
+ my_state *ms = ps->owner;
+ provider_t *prov = pp->prov;
+ curl_off_t llen;
+ char fixed[ADDR_SIZE];
+ CURL *curl;
+ const char *clen;
+ struct curl_slist *slist = NULL;
+ int chars;
llen = (curl_off_t)MHD_SIZE_UNKNOWN;
if (ms->be_flags & BACKEND_GET_SIZE) {
@@ -650,6 +651,13 @@ curl_put_child (void * ctx)
}
}
+ /*
+ * This is how the iwhd at the other end knows this is a replication
+ * request and not just a PUT from some random user.
+ * TBD: add some auth* for this.
+ */
+ slist = curl_slist_append(slist,"X-redhat-role: master");
+
curl = curl_easy_init();
if (!curl) {
pipe_cons_siginit(ps, -1);
@@ -667,9 +675,11 @@ curl_put_child (void * ctx)
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,llen);
curl_easy_setopt(curl,CURLOPT_READFUNCTION,http_put_cons);
curl_easy_setopt(curl,CURLOPT_READDATA,pp);
+ curl_easy_setopt(curl,CURLOPT_HTTPHEADER,slist);
pipe_cons_siginit(ps, 0);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
+ curl_slist_free_all(slist);
DPRINTF("%s returningn",__func__);
free(pp);
-----------------------------------------------------------------------
Summary of changes:
backend.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-218-g26af649
by Jeff Darcy
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 26af6493b707f493676f3151557a04c25dd69a8e (commit)
via d30160123fa4665414c490461ac55493406c150e (commit)
from 9f30bdb8086d10b45b27ee8d582e81615bf28b22 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/26af6493b707f493676f3151557a04c25dd69a8e
commit 26af6493b707f493676f3151557a04c25dd69a8e
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 10:23:33 2010 -0400
Sprintf/snprintf cleanup.
diff --git a/backend.c b/backend.c
index e695314..61fa515 100644
--- a/backend.c
+++ b/backend.c
@@ -51,9 +51,13 @@ struct hstor_client *hstor;
/***** Generic module stuff, not specific to one back end *****/
-/* Sizes for internal string buffers for CF code. */
-#define ADDR_SIZE 1024
-#define SVC_ACC_SIZE 128
+/*
+ * Sizes for internal string buffers. In general, ADDR_SIZE needs to be
+ * big enough to hold a hostname, a port number, a bucket and key (each
+ * MAX_FIELD_LEN=64) and some punctuation. Header size needs to be big
+ * enough to hold the header name plus a CF token (32 bytes).
+ */
+#define ADDR_SIZE 256
#define HEADER_SIZE 64
#define S3_IMAGE_PATTERN "^IMAGE[[:blank:]]+([^[:space:]]+)"
@@ -79,7 +83,6 @@ backend_init (void)
}
}
-
/***** Stub functions for unimplemented stuff. *****/
static void
@@ -212,9 +215,14 @@ http_put_cons (void *ptr, size_t size, size_t nmemb, void *stream)
static void
s3_init (provider_t *prov)
{
- char svc_acc[128];
+ char svc_acc[128];
+ int chars;
- snprintf(svc_acc,sizeof(svc_acc),"%s:%u",prov->host,prov->port);
+ chars = snprintf(svc_acc,sizeof(svc_acc),"%s:%u",prov->host,prov->port);
+ if (chars >= (int)sizeof(svc_acc)) {
+ error(0,0,"hostname %s too long in %s",prov->host,__func__);
+ return;
+ }
hstor = hstor_new(svc_acc,prov->host,prov->username,prov->password);
if (hstor) {
if (verbose) {
@@ -368,7 +376,7 @@ s3_register (my_state *ms, const provider_t *prov, const char *next,
pid_t pid;
int organ[2];
FILE *fp;
- char buf[1024];
+ char buf[ADDR_SIZE];
char *cval = NULL;
char *kval = NULL;
int rc = MHD_HTTP_BAD_REQUEST;
@@ -578,11 +586,12 @@ curl_init (provider_t *prov)
static void *
curl_get_child (void * ctx)
{
- char fixed[1024];
+ char fixed[ADDR_SIZE];
backend_thunk_t *tp = (backend_thunk_t *)ctx;
my_state *ms = tp->parent;
provider_t *prov = tp->prov;
CURL *curl;
+ int chars;
curl = curl_easy_init();
if (!curl) {
@@ -590,13 +599,17 @@ curl_get_child (void * ctx)
return NULL; /* TBD: flag error somehow */
}
if (ms->from_master) {
- sprintf(fixed,"http://%s:%u%s",
+ chars = snprintf(fixed,sizeof(fixed),"http://%s:%u%s",
master_host, master_port, ms->url);
}
else {
- sprintf(fixed,"http://%s:%u%s",
+ chars = snprintf(fixed,sizeof(fixed),"http://%s:%u%s",
prov->host, prov->port, ms->url);
}
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return NULL;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION, http_get_prod);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ms->pipe);
@@ -620,9 +633,10 @@ curl_put_child (void * ctx)
my_state *ms = ps->owner;
provider_t *prov = pp->prov;
curl_off_t llen;
- char fixed[1024];
+ char fixed[ADDR_SIZE];
CURL *curl;
const char *clen;
+ int chars;
llen = (curl_off_t)MHD_SIZE_UNKNOWN;
if (ms->be_flags & BACKEND_GET_SIZE) {
@@ -642,8 +656,12 @@ curl_put_child (void * ctx)
free(pp);
return THREAD_FAILED;
}
- sprintf(fixed,"http://%s:%u/%s/%s",prov->host,prov->port,
- ms->bucket,ms->key);
+ chars = snprintf(fixed,sizeof(fixed),
+ "http://%s:%u/%s/%s",prov->host,prov->port,ms->bucket,ms->key);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return NULL;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,llen);
@@ -666,10 +684,11 @@ curl_cache_child (void * ctx)
pipe_shared *ps = pp->shared;
my_state *ms = ps->owner;
provider_t *prov = pp->prov;
- char fixed[1024];
+ char fixed[ADDR_SIZE];
CURL *curl;
char *slash;
char *my_url = strdup(ms->url);
+ int chars;
if (!my_url) {
return THREAD_FAILED;
@@ -681,8 +700,12 @@ curl_cache_child (void * ctx)
pipe_cons_siginit(ps,-1);
return THREAD_FAILED;
}
- sprintf(fixed,"http://%s:%u%s",prov->host,prov->port,
- ms->url);
+ chars = snprintf(fixed,sizeof(fixed),
+ "http://%s:%u%s",prov->host,prov->port,ms->url);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return NULL;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,
@@ -707,7 +730,8 @@ curl_delete (const provider_t *prov, const char *bucket, const char *key,
const char *url)
{
CURL *curl;
- char fixed[1024];
+ char fixed[ADDR_SIZE];
+ int chars;
(void)bucket;
(void)key;
@@ -717,7 +741,12 @@ curl_delete (const provider_t *prov, const char *bucket, const char *key,
return MHD_HTTP_INTERNAL_SERVER_ERROR;
}
- sprintf(fixed,"http://%s:%u%s",prov->host,prov->port,url);
+ chars = snprintf(fixed,sizeof(fixed),
+ "http://%s:%u%s",prov->host,prov->port,url);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return MHD_HTTP_INTERNAL_SERVER_ERROR;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_CUSTOMREQUEST,"DELETE");
curl_easy_perform(curl);
@@ -733,9 +762,9 @@ curl_bcreate (const provider_t *prov, const char *bucket)
int chars;
CURL *curl;
- chars = snprintf(addr,ADDR_SIZE,"http://%s:%d/%s",
+ chars = snprintf(addr,sizeof(addr),"http://%s:%d/%s",
prov->host,prov->port,bucket);
- if (chars >= ADDR_SIZE) {
+ if (chars >= (int)sizeof(addr)) {
error(0,0,"path too long in %s",__func__);
return MHD_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -761,12 +790,13 @@ static int
curl_register (my_state *ms, const provider_t *prov, const char *next,
GHashTable *args)
{
- char fixed[1024];
+ char fixed[ADDR_SIZE];
CURL *curl;
struct curl_httppost *first = NULL;
struct curl_httppost *last = NULL;
char *kernel = g_hash_table_lookup(args,"kernel");
char *ramdisk = g_hash_table_lookup(args,"ramdisk");
+ int chars;
if (!next) {
DPRINTF("CURL register with next==NULLn");
@@ -780,8 +810,12 @@ curl_register (my_state *ms, const provider_t *prov, const char *next,
if (!curl) {
return MHD_HTTP_INTERNAL_SERVER_ERROR;
}
- sprintf(fixed,"http://%s:%d/%s/%s",
+ chars = snprintf(fixed,sizeof(fixed),"http://%s:%d/%s/%s",
prov->host,prov->port, ms->bucket, ms->key);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return MHD_HTTP_INTERNAL_SERVER_ERROR;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_formadd(&first,&last,
CURLFORM_COPYNAME, "op",
@@ -873,9 +907,9 @@ cf_add_token (struct curl_slist *in_slist, const char *token)
return in_slist;
}
- chars = snprintf(auth_hdr,HEADER_SIZE,"X-Auth-Token: %s",token);
- if (chars >= HEADER_SIZE) {
- error(0,0,"auth_token too long");
+ chars = snprintf(auth_hdr,sizeof(auth_hdr),"X-Auth-Token: %s",token);
+ if (chars >= (int)sizeof(auth_hdr)) {
+ error(0,0,"auth_hdr too long");
return in_slist;
}
@@ -896,23 +930,23 @@ cf_init (provider_t *prov)
return;
}
- chars = snprintf(addr,ADDR_SIZE,"https://%s:%u/v1.0",
+ chars = snprintf(addr,sizeof(addr),"https://%s:%u/v1.0",
prov->host, prov->port);
- if (chars >= ADDR_SIZE) {
+ if (chars >= (int)sizeof(addr)) {
error(0,0,"API URL too long in %s",__func__);
return;
}
- chars = snprintf(auth_user,HEADER_SIZE,"X-Auth-User: %s",
+ chars = snprintf(auth_user,sizeof(auth_user),"X-Auth-User: %s",
prov->username);
- if (chars >= HEADER_SIZE) {
+ if (chars >= (int)sizeof(auth_user)) {
error(0,0,"auth_user too long in %s",__func__);
return;
}
- chars = snprintf(auth_key,HEADER_SIZE,"X-Auth-Key: %s",
+ chars = snprintf(auth_key,sizeof(auth_key),"X-Auth-Key: %s",
prov->password);
- if (chars >= HEADER_SIZE) {
+ if (chars >= (int)sizeof(auth_key)) {
error(0,0,"auth_key too long in %s",__func__);
return;
}
@@ -936,12 +970,13 @@ cf_init (provider_t *prov)
static void *
cf_get_child (void * ctx)
{
- char fixed[1024];
+ char fixed[ADDR_SIZE];
backend_thunk_t *tp = (backend_thunk_t *)ctx;
my_state *ms = tp->parent;
provider_t *prov = tp->prov;
CURL *curl;
struct curl_slist *slist = NULL;
+ int chars;
slist = cf_add_token(slist,prov->token);
if (!slist) {
@@ -960,7 +995,11 @@ cf_get_child (void * ctx)
curl_slist_free_all(slist);
return NULL; /* TBD: flag error somehow */
}
- sprintf(fixed,"%s%s", prov->host, ms->url);
+ chars = snprintf(fixed,sizeof(fixed),"%s%s", prov->host, ms->url);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return NULL;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION, http_get_prod);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ms->pipe);
@@ -986,10 +1025,11 @@ cf_put_child (void * ctx)
my_state *ms = ps->owner;
provider_t *prov = pp->prov;
curl_off_t llen;
- char fixed[1024];
+ char fixed[ADDR_SIZE];
CURL *curl;
const char *clen;
struct curl_slist *slist = NULL;
+ int chars;
slist = cf_add_token(slist,prov->token);
if (!slist) {
@@ -1015,7 +1055,12 @@ cf_put_child (void * ctx)
curl_slist_free_all(slist);
return THREAD_FAILED;
}
- sprintf(fixed,"%s/%s/%s",prov->host,ms->bucket,ms->key);
+ chars = snprintf(fixed,sizeof(fixed),
+ "%s/%s/%s",prov->host,ms->bucket,ms->key);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return NULL;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,llen);
@@ -1041,9 +1086,10 @@ cf_delete (const provider_t *prov,
const char *url)
{
CURL *curl;
- char fixed[1024];
+ char fixed[ADDR_SIZE];
long rc;
struct curl_slist *slist = NULL;
+ int chars;
slist = cf_add_token(slist,prov->token);
if (!slist) {
@@ -1056,7 +1102,11 @@ cf_delete (const provider_t *prov,
return MHD_HTTP_INTERNAL_SERVER_ERROR;
}
- sprintf(fixed,"%s%s",prov->host,url);
+ chars = snprintf(fixed,sizeof(fixed),"%s%s",prov->host,url);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return MHD_HTTP_INTERNAL_SERVER_ERROR;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_CUSTOMREQUEST,"DELETE");
curl_easy_setopt(curl,CURLOPT_HTTPHEADER,slist);
@@ -1083,10 +1133,11 @@ cf_null_reader (void *ptr ATTRIBUTE_UNUSED,
static int
cf_bcreate (const provider_t *prov, const char *bucket)
{
- char fixed[1024];
+ char fixed[ADDR_SIZE];
CURL *curl;
long rc;
struct curl_slist *slist = NULL;
+ int chars;
slist = cf_add_token(slist,prov->token);
if (!slist) {
@@ -1098,7 +1149,11 @@ cf_bcreate (const provider_t *prov, const char *bucket)
curl_slist_free_all(slist);
return MHD_HTTP_INTERNAL_SERVER_ERROR;
}
- sprintf(fixed,"%s/%s",prov->host,bucket);
+ chars = snprintf(fixed,sizeof(fixed),"%s/%s",prov->host,bucket);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return MHD_HTTP_INTERNAL_SERVER_ERROR;
+ }
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,
@@ -1176,9 +1231,14 @@ fs_put_child (void * ctx)
int fd;
ssize_t bytes;
size_t offset;
- char fixed[1024];
+ char fixed[ADDR_SIZE];
+ int chars;
- sprintf(fixed,"%s/%s",ms->bucket,ms->key);
+ chars = snprintf(fixed,sizeof(fixed),"%s/%s",ms->bucket,ms->key);
+ if (chars >= (int)sizeof(fixed)) {
+ error(0,0,"path too long in %s",__func__);
+ return NULL;
+ }
fd = open(fixed,O_WRONLY|O_CREAT,0666);
if (fd < 0) {
pipe_cons_siginit(ps, errno);
http://repo.or.cz/w/iwhd.git/commit/d30160123fa4665414c490461ac55493406c150e
commit d30160123fa4665414c490461ac55493406c150e
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Wed Oct 20 15:22:04 2010 -0400
Fix re-replication on attribute change.
Problem #1 was that the back-end code sometimes used ms->url instead of
ms->bucket and ms->key, causing the other end to see the URL for the
attribute that was changed instead of the URL for the file being
re-replicated. Problem #2 was a memory leak when we re-use ms->pipe
in the replica module.
backend.c: fix functional error #1
rest.c fix leak #2 by freeing ms->pipe.data_ptr in proxy_put_attr
diff --git a/backend.c b/backend.c
index 6795ef9..e695314 100644
--- a/backend.c
+++ b/backend.c
@@ -642,8 +642,8 @@ curl_put_child (void * ctx)
free(pp);
return THREAD_FAILED;
}
- sprintf(fixed,"http://%s:%u%s",prov->host,prov->port,
- ms->url);
+ sprintf(fixed,"http://%s:%u/%s/%s",prov->host,prov->port,
+ ms->bucket,ms->key);
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,llen);
@@ -1015,7 +1015,7 @@ cf_put_child (void * ctx)
curl_slist_free_all(slist);
return THREAD_FAILED;
}
- sprintf(fixed,"%s%s",prov->host,ms->url);
+ sprintf(fixed,"%s/%s/%s",prov->host,ms->bucket,ms->key);
curl_easy_setopt(curl,CURLOPT_URL,fixed);
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,llen);
@@ -1176,9 +1176,10 @@ fs_put_child (void * ctx)
int fd;
ssize_t bytes;
size_t offset;
- char *file = ms->url+1;
+ char fixed[1024];
- fd = open(file,O_WRONLY|O_CREAT,0666);
+ sprintf(fixed,"%s/%s",ms->bucket,ms->key);
+ fd = open(fixed,O_WRONLY|O_CREAT,0666);
if (fd < 0) {
pipe_cons_siginit(ps, errno);
free(pp);
@@ -1194,7 +1195,7 @@ fs_put_child (void * ctx)
if (bytes <= 0) {
if (bytes < 0) {
error (0, errno, "%s: write failed",
- file);
+ fixed);
pipe_cons_signal(pp, errno);
}
else {
diff --git a/rest.c b/rest.c
index 28bc401..8f42be3 100644
--- a/rest.c
+++ b/rest.c
@@ -647,6 +647,11 @@ proxy_put_attr (void *cctx, struct MHD_Connection *conn, const char *url,
return MHD_YES;
}
meta_set_value(ms->bucket,ms->key,ms->attr,ms->pipe.data_ptr);
+ /* This might get stomped by replication. */
+ if (ms->cleanup & CLEANUP_BUF_PTR) {
+ free(ms->pipe.data_ptr);
+ ms->cleanup &= ~CLEANUP_BUF_PTR;
+ }
/*
* We should always re-replicate, because the replication
* policy might refer to this attr.
-----------------------------------------------------------------------
Summary of changes:
backend.c | 145 +++++++++++++++++++++++++++++++++++++++++++------------------
rest.c | 5 ++
2 files changed, 108 insertions(+), 42 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months
[repo.or.cz] iwhd.git branch master updated: v0.0-216-g9f30bdb
by Jim Meyering
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 9f30bdb8086d10b45b27ee8d582e81615bf28b22 (commit)
via c7748e96024d9a845f8f7fbd0305a72a1f8bc077 (commit)
via b9c444677501e24e5aa1b2d10d58b8a99faf41fd (commit)
via cd22b27d3fc97df06f7e5917f958d3a5660627fe (commit)
via 406cc793d1241acbc0c4dcb6bd070209b4289507 (commit)
via ded3c1df9c18a30ce4794b12ab7d82297a9e6d2e (commit)
via 3c5b2840f6ef9d562ef12299f1cd6d7442a3f1a0 (commit)
via 0c4fa8c07b57aa79f89a371231d98b01162d3e12 (commit)
via 398c516c99ae513d259767af4b6e91701aeec2ad (commit)
from 3a8570e05e1e906435c97f456150ec8683b35c91 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/9f30bdb8086d10b45b27ee8d582e81615bf28b22
commit 9f30bdb8086d10b45b27ee8d582e81615bf28b22
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 12:03:30 2010 +0200
query parser: avoid 25 reduce/reduce conflicts
* qparser.y (T_SPACE): Remove token and all related rules.
* qlexer.l: Ignore white space rather than returning T_SPACE.
* t/parser-test: Adjust sole failing test: "$ a" was rejected before,
due to ignored white space; now it's interpreted as "$a".
Add one more: "$.a" that does still fail.
diff --git a/qlexer.l b/qlexer.l
index 59c6fb1..976939b 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -35,7 +35,7 @@
! { return T_NOT; }
&& { return T_AND; }
|| { return T_OR; }
-[ tnr]+ { return T_SPACE; }
+[ tnr]+ { }
. { return T_INVALID; }
<<EOF>> { yyterminate (); /* aka return 0; */ }
diff --git a/qparser.y b/qparser.y
index 4369036..99267c4 100644
--- a/qparser.y
+++ b/qparser.y
@@ -162,7 +162,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
%parse-param { value_t **result }
%token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
-%token T_EQ T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_EQ T_NE T_NOT T_AND T_OR T_INVALID
%token T_LT T_GT T_LE T_GE
%type <val> atom bbool_expr comp_expr field
@@ -189,11 +189,6 @@ bbool_expr:
bbool_expr T_OR ubool_expr {
// printf("found OR expressionn");
$$ = make_tree(T_OR,$1,$3);
- }|
- bbool_expr T_SPACE {
- $$ = $1;
- }| T_SPACE bbool_expr {
- $$ = $2;
};
ubool_expr:
@@ -204,11 +199,6 @@ ubool_expr:
T_NOT comp_expr {
// printf("found NOT expressionn");
$$ = make_tree(T_NOT,$2,NULL);
- }|
- ubool_expr T_SPACE {
- $$ = $1;
- }| T_SPACE ubool_expr {
- $$ = $2;
};
@@ -240,11 +230,6 @@ comp_expr:
atom T_GT atom {
// printf("found GREATER THAN expressionn");
$$ = make_comp(C_GREATERTHAN,$1,$3);
- }|
- comp_expr T_SPACE {
- $$ = $1;
- }| T_SPACE comp_expr {
- $$ = $2;
};
atom:
@@ -259,11 +244,6 @@ atom:
paren_expr {
// printf("promoting paren_expr to atomn");
$$ = $1;
- }|
- atom T_SPACE {
- $$ = $1;
- }| T_SPACE atom {
- $$ = $2;
};
link_field:
diff --git a/t/parser-test b/t/parser-test
index cf006c6..0daead1 100755
--- a/t/parser-test
+++ b/t/parser-test
@@ -27,8 +27,12 @@ parser '#a == "fubar" && ! ( $b.c.d < 3)' > white-space 2> err || fail=1
compare white-space f.exp || fail=1
compare /dev/null err || fail=1
-parser '$ a' > e1.out 2>&1; test $? = 1 || fail=1
-printf "could not parse '$ a'n" > e1.exp
+parser '$ a' > a.out 2>&1 || fail=1
+printf "OBJECT FIELD a (2)ns= 2n" > a.exp
+compare a.out a.exp || fail=1
+
+parser '$.a' > e1.out 2>&1; test $? = 1 || fail=1
+printf "could not parse '$.a'n" > e1.exp
compare e1.exp e1.out || fail=1
parser '1 = = 1' > e2.out 2>&1; test $? = 1 || fail=1
http://repo.or.cz/w/iwhd.git/commit/c7748e96024d9a845f8f7fbd0305a72a1f8bc077
commit c7748e96024d9a845f8f7fbd0305a72a1f8bc077
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 11:37:18 2010 +0200
simplify parser: <, >, >=, <=
diff --git a/qlexer.l b/qlexer.l
index 6bb82f4..59c6fb1 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -25,7 +25,11 @@
return yylval_param->str ? T_NUMBER : T_INVALID; }
[a-z_]+ { yylval_param->str = strdup(yytext);
return yylval_param->str ? T_ID : T_INVALID; }
-[=$#()<>.] { return yytext[0]; }
+[$#().] { return yytext[0]; }
+[<] { return T_LT; }
+[<]= { return T_LE; }
+> { return T_GT; }
+>= { return T_GE; }
== { return T_EQ; }
!= { return T_NE; }
! { return T_NOT; }
diff --git a/qparser.y b/qparser.y
index 7516ab7..4369036 100644
--- a/qparser.y
+++ b/qparser.y
@@ -163,6 +163,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
%token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
%token T_EQ T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_LT T_GT T_LE T_GE
%type <val> atom bbool_expr comp_expr field
%type <val> link_field literal paren_expr ubool_expr
@@ -216,13 +217,13 @@ comp_expr:
// printf("promoting atom to comp_exprn");
$$ = $1;
}|
- atom '<' atom {
+ atom T_LT atom {
// printf("found LESS THAN expressionn");
$$ = make_comp(C_LESSTHAN,$1,$3);
}|
- atom '<' '=' atom {
+ atom T_LE atom {
// printf("found LESS OR EQUAL expressionn");
- $$ = make_comp(C_LESSOREQ,$1,$4);
+ $$ = make_comp(C_LESSOREQ,$1,$3);
}|
atom T_EQ atom {
// printf("found EQUAL expressionn");
@@ -232,11 +233,11 @@ comp_expr:
// printf("found NOT EQUAL expressionn");
$$ = make_comp(C_DIFFERENT,$1,$3);
}|
- atom '>' '=' atom {
+ atom T_GE atom {
// printf("found GREATER OR EQUAL expressionn");
- $$ = make_comp(C_GREATEROREQ,$1,$4);
+ $$ = make_comp(C_GREATEROREQ,$1,$3);
}|
- atom '>' atom {
+ atom T_GT atom {
// printf("found GREATER THAN expressionn");
$$ = make_comp(C_GREATERTHAN,$1,$3);
}|
http://repo.or.cz/w/iwhd.git/commit/b9c444677501e24e5aa1b2d10d58b8a99faf41fd
commit b9c444677501e24e5aa1b2d10d58b8a99faf41fd
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 11:34:00 2010 +0200
simplify parser: T_EQ
diff --git a/qlexer.l b/qlexer.l
index 5d0e488..6bb82f4 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -26,6 +26,7 @@
[a-z_]+ { yylval_param->str = strdup(yytext);
return yylval_param->str ? T_ID : T_INVALID; }
[=$#()<>.] { return yytext[0]; }
+== { return T_EQ; }
!= { return T_NE; }
! { return T_NOT; }
&& { return T_AND; }
diff --git a/qparser.y b/qparser.y
index 17f4100..7516ab7 100644
--- a/qparser.y
+++ b/qparser.y
@@ -162,7 +162,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
%parse-param { value_t **result }
%token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
-%token T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_EQ T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
%type <val> atom bbool_expr comp_expr field
%type <val> link_field literal paren_expr ubool_expr
@@ -224,9 +224,9 @@ comp_expr:
// printf("found LESS OR EQUAL expressionn");
$$ = make_comp(C_LESSOREQ,$1,$4);
}|
- atom '=' '=' atom {
+ atom T_EQ atom {
// printf("found EQUAL expressionn");
- $$ = make_comp(C_EQUAL,$1,$4);
+ $$ = make_comp(C_EQUAL,$1,$3);
}|
atom T_NE atom {
// printf("found NOT EQUAL expressionn");
http://repo.or.cz/w/iwhd.git/commit/cd22b27d3fc97df06f7e5917f958d3a5660627fe
commit cd22b27d3fc97df06f7e5917f958d3a5660627fe
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 11:32:59 2010 +0200
simplify parser: T_NE
diff --git a/qlexer.l b/qlexer.l
index 5f354df..5d0e488 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -26,6 +26,7 @@
[a-z_]+ { yylval_param->str = strdup(yytext);
return yylval_param->str ? T_ID : T_INVALID; }
[=$#()<>.] { return yytext[0]; }
+!= { return T_NE; }
! { return T_NOT; }
&& { return T_AND; }
|| { return T_OR; }
diff --git a/qparser.y b/qparser.y
index a881b64..17f4100 100644
--- a/qparser.y
+++ b/qparser.y
@@ -162,7 +162,7 @@ yyerror (void *scanner ATTRIBUTE_UNUSED,
%parse-param { value_t **result }
%token <str> T_STRING T_COMP T_DATE T_ID T_LINK T_NUMBER T_OFIELD T_SFIELD
-%token T_NOT T_AND T_OR T_SPACE T_INVALID
+%token T_NE T_NOT T_AND T_OR T_SPACE T_INVALID
%type <val> atom bbool_expr comp_expr field
%type <val> link_field literal paren_expr ubool_expr
@@ -228,9 +228,9 @@ comp_expr:
// printf("found EQUAL expressionn");
$$ = make_comp(C_EQUAL,$1,$4);
}|
- atom T_NOT '=' atom {
+ atom T_NE atom {
// printf("found NOT EQUAL expressionn");
- $$ = make_comp(C_DIFFERENT,$1,$4);
+ $$ = make_comp(C_DIFFERENT,$1,$3);
}|
atom '>' '=' atom {
// printf("found GREATER OR EQUAL expressionn");
http://repo.or.cz/w/iwhd.git/commit/406cc793d1241acbc0c4dcb6bd070209b4289507
commit 406cc793d1241acbc0c4dcb6bd070209b4289507
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 11:14:53 2010 +0200
mark more unused parameters
diff --git a/qparser.y b/qparser.y
index 94416fb..a881b64 100644
--- a/qparser.y
+++ b/qparser.y
@@ -148,8 +148,11 @@ make_link (value_t *left, const char *right)
}
static void
-yyerror (void *scanner, value_t **result, const char *msg)
+yyerror (void *scanner ATTRIBUTE_UNUSED,
+ value_t **result ATTRIBUTE_UNUSED,
+ const char *msg ATTRIBUTE_UNUSED)
{
+ /* empty */
}
%}
http://repo.or.cz/w/iwhd.git/commit/ded3c1df9c18a30ce4794b12ab7d82297a9e6d2e
commit ded3c1df9c18a30ce4794b12ab7d82297a9e6d2e
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 09:43:03 2010 +0200
remove final "static" state variable from the parser
* qparser.y: Remove "syntax_error" decl.
(yyerror): Adjust. Make this function static, too.
<policy>: Adjust the sole rule that used it.
diff --git a/qparser.y b/qparser.y
index e5bd1ad..94416fb 100644
--- a/qparser.y
+++ b/qparser.y
@@ -19,6 +19,8 @@
#include <string.h>
#include <ctype.h>
+#include "iwh.h"
+
#define YY_DECL int yylex(YYSTYPE *, void *scanner);
YY_DECL
@@ -145,22 +147,9 @@ make_link (value_t *left, const char *right)
return make_tree(T_LINK,left,(value_t *)copy);
}
-/*
- * IMO it's wrong for us to get into the bbool_expr=policy rule when there's
- * a syntax error, but we do. The good news is that it's easy to free the
- * erroneous tree properly this way. The bad news is that we need to wait
- * until yyparse is done, then check this flag (which we have to maintain
- * ourselves) to figure out whether we got a valid tree or not.
- * No, yynerrs doesn't seem to give the right answer.
- */
-static int syntax_error = 0;
-
-void
+static void
yyerror (void *scanner, value_t **result, const char *msg)
{
- // error (0, 0, "parse error: %sn", msg);
- // FIXME do this via param, not file-global
- syntax_error = 1;
}
%}
@@ -181,12 +170,7 @@ yyerror (void *scanner, value_t **result, const char *msg)
policy:
bbool_expr {
- if (syntax_error) {
- printf("bad policy!n");
- }
- else {
- *result = $1;
- }
+ *result = $1;
};
bbool_expr:
http://repo.or.cz/w/iwhd.git/commit/3c5b2840f6ef9d562ef12299f1cd6d7442a3f1a0
commit 3c5b2840f6ef9d562ef12299f1cd6d7442a3f1a0
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 10:20:33 2010 +0200
mark unused parameters as such
diff --git a/backend.c b/backend.c
index 8d3547c..6795ef9 100644
--- a/backend.c
+++ b/backend.c
@@ -1035,13 +1035,13 @@ cf_put_child (void * ctx)
}
static int
-cf_delete (const provider_t *prov, const char *bucket, const char *key,
- const char *url)
+cf_delete (const provider_t *prov,
+ const char *bucket ATTRIBUTE_UNUSED,
+ const char *key ATTRIBUTE_UNUSED,
+ const char *url)
{
CURL *curl;
char fixed[1024];
- int chars;
- char auth_hdr[HEADER_SIZE];
long rc;
struct curl_slist *slist = NULL;
@@ -1072,7 +1072,10 @@ cf_delete (const provider_t *prov, const char *bucket, const char *key,
}
static size_t
-cf_null_reader (void *ptr, size_t size, size_t nmemb, void *stream)
+cf_null_reader (void *ptr ATTRIBUTE_UNUSED,
+ size_t size ATTRIBUTE_UNUSED,
+ size_t nmemb ATTRIBUTE_UNUSED,
+ void *stream ATTRIBUTE_UNUSED)
{
return 0;
}
http://repo.or.cz/w/iwhd.git/commit/0c4fa8c07b57aa79f89a371231d98b01162d3e12
commit 0c4fa8c07b57aa79f89a371231d98b01162d3e12
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 09:25:33 2010 +0200
remove decls of unused variables
diff --git a/backend.c b/backend.c
index 502ce14..8d3547c 100644
--- a/backend.c
+++ b/backend.c
@@ -868,7 +868,6 @@ cf_add_token (struct curl_slist *in_slist, const char *token)
{
int chars;
char auth_hdr[HEADER_SIZE];
- struct curl_slist *out_slist;
if (!token) {
return in_slist;
@@ -887,10 +886,9 @@ static void
cf_init (provider_t *prov)
{
CURL *curl;
- char addr[ADDR_SIZE];
- char auth_user[HEADER_SIZE];
- char auth_key[HEADER_SIZE];
- char *token;
+ char addr[ADDR_SIZE];
+ char auth_user[HEADER_SIZE];
+ char auth_key[HEADER_SIZE];
struct curl_slist *slist;
int chars;
@@ -1084,8 +1082,6 @@ cf_bcreate (const provider_t *prov, const char *bucket)
{
char fixed[1024];
CURL *curl;
- int chars;
- char auth_hdr[HEADER_SIZE];
long rc;
struct curl_slist *slist = NULL;
diff --git a/meta.cpp b/meta.cpp
index de9dfa2..d467c1e 100644
--- a/meta.cpp
+++ b/meta.cpp
@@ -644,10 +644,7 @@ RepoMeta::GetAttrList (const char *bucket, const char *key)
{
auto_ptr<DBClientCursor> curs;
Query q;
- AttrList * poc;
BSONObj bo;
- const char * name;
- const char * value;
q = QUERY("bucket"<<bucket<<"key"<<key);
curs = GetCursor(q);
diff --git a/replica.c b/replica.c
index 4376d0a..9487c33 100644
--- a/replica.c
+++ b/replica.c
@@ -93,7 +93,6 @@ proxy_repl_cons (void *ctx)
repl_item *item = ctx;
my_state *ms = item->ms;
pipe_private *pp;
- void *rc;
pp = pipe_init_private(&ms->pipe);
if (!pp) {
http://repo.or.cz/w/iwhd.git/commit/398c516c99ae513d259767af4b6e91701aeec2ad
commit 398c516c99ae513d259767af4b6e91701aeec2ad
Author: Jim Meyering <meyering(a)redhat.com>
Date: Tue Oct 19 18:27:52 2010 +0200
automatically generate man page
* configure.ac (AC_CONFIG_FILES): Add man/Makefile.
Check for help2man.
* Makefile.am (SUBDIRS): Add "." and man.
* man/Makefile.am: New file.
* .gitignore: Ignore new artifacts and anchor patterns.
* iwhd.spec.in (%files): Add man page file name.
diff --git a/.gitignore b/.gitignore
index e85dc40..6fbf252 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,25 +2,26 @@
*~
.#*
.deps
+/aclocal.m4
+/autom4te.cache/
+/build-aux
+/config.h
+/config.hin
+/config.log
+/config.status
+/configure
+/iwhd
+/iwhd-*.tar.gz
+/iwhd-qparser.c
+/iwhd-qparser.h
+/iwhd.spec
+/man/iwhd.8
+/qlexer.c
+/stamp-h1
+/t/*.log
+/t/parser
+/t/parser.c
ChangeLog
Makefile
Makefile.in
#*#
-aclocal.m4
-autom4te.cache/
-build-aux
-config.h
-config.hin
-config.log
-config.status
-configure
-iwhd
-iwhd-*.tar.gz
-iwhd-qparser.c
-iwhd-qparser.h
-iwhd.spec
-qlexer.c
-stamp-h1
-t/*.log
-t/parser
-t/parser.c
diff --git a/Makefile.am b/Makefile.am
index 5510cf1..44ff506 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ AM_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
iwhd_YFLAGS = -d
-SUBDIRS = t
+SUBDIRS = . t man
ACLOCAL_AMFLAGS = -I ax
# iwhd is short for Image WareHouse Daemon.
diff --git a/configure.ac b/configure.ac
index afbe4c3..78eb70b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
AC_PROG_LEX
+AM_MISSING_PROG([HELP2MAN], [help2man])
AC_CHECK_LIB([curl], [curl_easy_init],
[CURL_LIB=-lcurl],
@@ -88,5 +89,9 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([gettimeofday memmove memset strcasecmp strdup strndup strtoul])
-AC_CONFIG_FILES([Makefile t/Makefile])
+AC_CONFIG_FILES([
+Makefile
+t/Makefile
+man/Makefile
+])
AC_OUTPUT
diff --git a/iwhd.spec.in b/iwhd.spec.in
index 282370e..2b28b53 100644
--- a/iwhd.spec.in
+++ b/iwhd.spec.in
@@ -57,6 +57,7 @@ rm -rf %{buildroot}
%defattr(-,root,root,-)
%doc AUTHORS COPYING README NEWS
%{_bindir}/iwhd
+%{_mandir}/man8/iwhd.8*
%changelog
* Wed Oct 7 2010 Jim Meyering <meyering(a)redhat.com> - 0.90-1
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..a5f6051
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,26 @@
+# Automakefile for GNU diffutils man pages
+
+# Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+dist_man8_MANS = iwhd.8
+MAINTAINERCLEANFILES = $(dist_man8_MANS)
+
+# Depend on configure.ac to get version number changes.
+iwhd.8: $(top_srcdir)/configure.ac $(top_srcdir)/rest.c
+ $(AM_V_GEN) + (echo '[NAME]' && sed 's@/* *@@; s/-/\-/; q' $(top_srcdir)/rest.c)|+ $(HELP2MAN) -i - -S '$(PACKAGE) $(VERSION)' ../iwhd | + sed 's/^.B info .*/.B info FIXME/' > $@-t && mv $@-t $@
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 37 ++++++++++++++-------------
Makefile.am | 2 +-
backend.c | 23 ++++++++---------
configure.ac | 7 ++++-
iwhd.spec.in | 1 +
man/Makefile.am | 26 ++++++++++++++++++++
meta.cpp | 3 --
qlexer.l | 10 ++++++-
qparser.y | 72 +++++++++++++++---------------------------------------
replica.c | 1 -
t/parser-test | 8 ++++-
11 files changed, 98 insertions(+), 92 deletions(-)
create mode 100644 man/Makefile.am
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")
13 years, 6 months