Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Mar 2015 09:06:45 -0700] rev 24286
lazymanifest: don't depend on printf's 'hh' format to work
Where we convert a 20-byte binary to a 40-byte hex string in
lazymanifest_setitem(), we use sprintf("%02hhx", hash[i]). As Matt
Harbison found out, 'hh' seems to be ignored on some platforms (Visual
Studio?). If char is signed on such platforms, the value gets
sign-extended as it gets promoted into an int when passed into the
variadic sprintf(). The resulting integer value will then be printed
with leading f's (14 of them on 64-bit systems), since the '2' in the
format string indicates only minimum number of characters. This is
both incorrect and runs the risk of writing outside of allocated
memory (as Matt reported).
To fix, let's cast the value to unsigned char before passing it to
sprintf(). Also drop the poorly supported 'hh' formatting that now
becomes unnecessary.
Pierre-Yves David <pierre-yves.david@fb.com> [Wed, 11 Mar 2015 17:53:50 -0700] rev 24285
bundle2: test hooking using the new transaction-level hook
There is no strong reason to keep a bundle2-level hook as we can use the
transaction-level hook.
Pierre-Yves David <pierre-yves.david@fb.com> [Mon, 09 Mar 2015 22:50:49 -0700] rev 24284
hook: add a generic hook right before we commit a transaction
We are adding a 'txnclose' hook that will be run right before a transaction is
closed. Hooks running at that time will have access to the full transaction
content through both 'hookargs' content and on-disk reading. They will be able
to abort the transaction.
Pierre-Yves David <pierre-yves.david@fb.com> [Mon, 09 Mar 2015 22:43:36 -0700] rev 24283
transaction: add a validation stage
The 'transaction' object can now be fed a 'validator' function. This function
will be run right before the transaction is closed to validate its content. The
target usage is hooks. The validation function is expected to raise an exception
when it wants to abort the transaction.
This only introduce the idea with a default no-op validator. Actual usage is in
the next changeset.
Pierre-Yves David <pierre-yves.david@fb.com> [Mon, 09 Mar 2015 22:36:56 -0700] rev 24282
hook: add a generic hook after transaction has been closed
We are adding generic hooking for all transactions. We may have useful
information about what happened during the transaction, user of the transaction
should have filled the 'hookargs' dictionnary of the transaction. This hook is
simple because it has no power to rollback the transaction.
Pierre-Yves David <pierre-yves.david@fb.com> [Wed, 10 Dec 2014 18:19:49 -0800] rev 24281
hook: have a generic hook for transaction opening
We are adding generic hooking for all transactions. We do not really have any
useful information to include when opening the transaction but this is a
useful time to allow a hook anyway. We better let people abort transaction before
they happen than after multiple seconds/minutes of processing.