[issue854] Some bdiff tests fail on AIX

Jim Hague mercurial-bugs at selenic.com
Tue Dec 4 06:55:32 CST 2007


New submission from Jim Hague <jim.hague at acm.org>:

Some of the bdiff tests cause calloc() (in bdiff.c) to be called with the first
parameter, the number of elements to allocate, 0.

Under these circumstances, glibc returns a valid heap pointer. The C library on
AIX returns NULL. Either is valid behaviour according to the standards I have
consulted (C99, Unix98).

The code in bdiff.c treats a return of NULL as an allocation failure. The
attached patch is a work-around - always allocate at least 1 element - that gets
the tests passing.

(I posted the explanation and patch to the mailing list some weeks back. It has
yet to appear in the main repo or crew, so I'm filing this bug to ensure the
issue doesn't get lost).

----------
files: bdiff-calloc-size0.patch
messages: 4467
nosy: bearcave
priority: bug
status: unread
title: Some bdiff tests fail on AIX

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue854>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bdiff-calloc-size0.patch
Type: text/x-patch
Size: 1109 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20071204/6dcdd556/attachment.bin 


More information about the Mercurial-devel mailing list