[QUICK] talloc bugs

Stefan (metze) Metzmacher metze at samba.org
Wed Jul 1 19:08:15 GMT 2009

Jeremy Allison schrieb:
> On Wed, Jul 01, 2009 at 08:27:38AM -0400, simo wrote:
>> On Wed, 2009-07-01 at 22:12 +1000, tridge at samba.org wrote:
>>> Hi Simo,
>>>  > In any case I'd like to stress we need to maintain ABI compatibility, so
>>>  > whatever the decision I think we need still quite some work on what was
>>>  > currently committed (possibly with a revert first).
>>> To justify that please point me at a valid use of talloc that was in
>>> our tree that the change broke. 
>>> The change affected code that was already ambiguous. Ambiguous code is
>>> something we always want to avoid, and we should not be preserving
>>> ambiguous APIs.
>>> Regarding the ABI, yes I broke that as talloc_free was a function and
>>> is now a macro.
> I don't think we can do this. We need to keep the ABI stable
> for external users just like we do with libsmbclient.

I agree to this!

If all we need is to keep the external symbols intact, then maybe this
is all we need:

diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index e68b653..0109123 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1865,3 +1865,17 @@ int talloc_is_parent(const void *context, const
void *ptr)
        return 0;
+#undef talloc_free
+int talloc_free(void *ptr)
+       return _talloc_free(ptr, __location__": compat talloc_free()");
+#undef talloc_reference
+void *talloc_reference(const void *context, const void *ptr)
+       return _talloc_reference(context, ptr,
+                    __location__": compat talloc_reference()");

But this would only allow application build against an old version
to work with the new version at runtime, but not the other way arround
because the old library is missing the new _talloc_free() and
_talloc_reference() symbols.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20090701/fb048069/signature.bin

More information about the samba-technical mailing list