[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] PATCH: note_netsync_revision_received apparently missin
From: |
Bruce Stephens |
Subject: |
[Monotone-devel] PATCH: note_netsync_revision_received apparently missing author cert |
Date: |
Tue, 13 Mar 2007 11:33:51 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux) |
Someone on #monotone noted that their hook didn't seem to notice the
author cert. They had a loop using ipairs rather than pairs, which
seems reasonable...
Except that tables in Lua count from 1, not 0. I don't know
why---seems an odd choice to me. (And IIUC, it's by convention of the
various functions like ipairs, etc., not something more fundamental.)
I haven't checked the other hooks, but this isn't the first time it's
happened, so I suggest using pairs rather than ipairs, or at least
trying that. I suspect other hooks receiving tables will receive
0-indexed things, and if you use ipairs, you'll miss one.
So my (untested) guess is there's a bug in lua_hooks.cc:
#
# old_revision [fce69d16cb214674c459f66465ce6b62a272ff23]
#
# patch "lua_hooks.cc"
# from [9f844c1bf6692f8bb488e5a596caa2f622f8a454]
# to [6359909e6058a18614b49e0a02967d5725fdb10e]
#
============================================================
--- lua_hooks.cc 9f844c1bf6692f8bb488e5a596caa2f622f8a454
+++ lua_hooks.cc 6359909e6058a18614b49e0a02967d5725fdb10e
@@ -841,7 +841,7 @@ lua_hooks::hook_note_netsync_revision_re
int n=0;
for (cdat::const_iterator i = certs.begin(); i != certs.end(); ++i)
{
- ll.push_int(n++);
+ ll.push_int(++n);
ll.push_table();
ll.push_str("key");
ll.push_str(i->first());