[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow
From: |
Timothy Brownawell |
Subject: |
[Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash) |
Date: |
Sun, 23 Aug 2009 20:29:28 -0500 |
On Thu, 2009-08-20 at 19:37 -0500, Timothy Brownawell wrote:
> On Fri, 2009-08-14 at 05:04 +0000, Timothy Brownawell wrote:
> > I think branch net.venge.monotone.keys-by-hash is ready now.
> >
> > The central change is that certs contain a key hash instead of a key
> > name, to get rid of the problem with key collisions.
>
> > This does require a netsync flag day, because certs on the wire contain
> > a key hash instead of a key name now (just like certs in the db).
>
> This is merged now.
...and it looks like I forgot to make the migration code fix the cert
hashes (which AFAICT are only used for netsync, so possible wierdness if
people 'db migrate' with out-of-sync db's and then try to sync the
migrated certs).
I'm getting make errors[1] when I try to build even a clean checkout
right now, so could someone try this patch and check that the
lua-testsuite.lua change makes the testsuite fail, and the other changes
make it pass again?
[1] Makefile:897: *** Recursive variable `V_bcxx_' references itself
(eventually). Stop.
$ mtn diff
#
# old_revision [aebb88e9030d0e5616d1974a1ed9755cf176ffea]
#
# patch "cert.cc"
# from [9217fc9e7d471997b0761e4928bbf5eed0e220e0]
# to [0ea75effef93704ece9fba001901ee62ed13e249]
#
# patch "lua-testsuite.lua"
# from [e28a4e630a460bcca1a2d9023a2a898c1e77670a]
# to [69fbf7b5f0a6bd3899efec21a992c841595109c8]
#
# patch "migrate_schema.cc"
# from [aea2f5b02394463bb93f868724173d10f9b865a3]
# to [0f663641b253e0b87e1422f39491662a1d4cb642]
#
============================================================
--- cert.cc 9217fc9e7d471997b0761e4928bbf5eed0e220e0
+++ cert.cc 0ea75effef93704ece9fba001901ee62ed13e249
@@ -126,23 +126,23 @@ cert::hash_code(id & out) const
void
cert::hash_code(id & out) const
{
- base64<rsa_sha1_signature> sig_encoded(encode_base64(this->sig));
- base64<cert_value> val_encoded(encode_base64(this->value));
- string ident_encoded(encode_hexenc(this->ident.inner()(),
- this->ident.inner().made_from));
+ //base64<rsa_sha1_signature> sig_encoded(encode_base64(this->sig));
+ //base64<cert_value> val_encoded(encode_base64(this->value));
+ //string ident_encoded(encode_hexenc(this->ident.inner()(),
+ // this->ident.inner().made_from));
string tmp;
- tmp.reserve(4 + ident_encoded.size()
- + this->name().size() + val_encoded().size()
- + this->key.inner()().size() + sig_encoded().size());
- tmp.append(ident_encoded);
+ tmp.reserve(4 + ident.inner()().size()
+ + this->name().size() + value().size()
+ + this->key.inner()().size() + sig().size());
+ tmp.append(ident.inner()());
tmp += ':';
tmp.append(this->name());
tmp += ':';
- append_without_ws(tmp, val_encoded());
+ append_without_ws(tmp, value());
tmp += ':';
tmp.append(this->key.inner()());
tmp += ':';
- append_without_ws(tmp, sig_encoded());
+ append_without_ws(tmp, sig());
data tdat(tmp, origin::internal);
calculate_ident(tdat, out);
============================================================
--- lua-testsuite.lua e28a4e630a460bcca1a2d9023a2a898c1e77670a
+++ lua-testsuite.lua 69fbf7b5f0a6bd3899efec21a992c841595109c8
@@ -272,7 +272,10 @@ function check_same_db_contents(db1, db2
file = trim(file)
check_same_stdout(mtn("--db", db1, "automate", "get_file", file),
mtn("--db", db2, "automate", "get_file", file))
- end
+ end
+
+ check_same_stdout(mtn("--db", db1, "db", "execute", "select hex(hash) from
revision_certs"),
+ mtn("--db", db2, "db", "execute", "select hex(hash) from
revision_certs"))
end
-- maybe these should go in tester.lua?
============================================================
--- migrate_schema.cc aea2f5b02394463bb93f868724173d10f9b865a3
+++ migrate_schema.cc 0f663641b253e0b87e1422f39491662a1d4cb642
@@ -728,7 +728,8 @@ char const migrate_certs_to_key_hash[] =
"CREATE INDEX revision_certs__revision_id ON revision_certs (revision_id);\n"
"INSERT INTO revision_certs(hash, revision_id, name, value, keypair_id,
signature)\n"
- "SELECT a.hash, a.id, a.name, a.value, b.id, a.signature\n"
+ "SELECT sha1(':', a.id, a.name, a.value, b.id, a.signature), "
+ " a.id, a.name, a.value, b.id, a.signature\n"
"FROM revision_certs_tmp a JOIN public_keys b\n"
"ON a.keypair = b.name;\n"
- Re: [Monotone-devel] Merging branch to allow duplicate key names, have certs use key hash, (continued)
Re: [Monotone-devel] Merging branch to allow duplicate key names, have certs use key hash, Timothy Brownawell, 2009/08/20
[Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash),
Timothy Brownawell <=
- Re: [Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash), Stephen Leake, 2009/08/23
- Re: [Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash), Zack Weinberg, 2009/08/23
- Re: [Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash), Stephen Leake, 2009/08/24
- Re: [Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash), Zack Weinberg, 2009/08/24
Re: [Monotone-devel] [PATCH] Broken migration code? (Merging branch to allow duplicate key names, have certs use key hash), Stephen Leake, 2009/08/24