krb4 library major version bump

Jacques A. Vidrine nectar at celabo.org
Fri Feb 7 08:07:33 EST 2003


On Fri, Feb 07, 2003 at 02:46:07AM -0500, Tom Yu wrote:
> >>>>> "raeburn" == Ken Raeburn <raeburn at MIT.EDU> writes:
> 
> raeburn> Currently, aklog is crashing for me while printing an error message.
> raeburn> It's getting the error message by indexing into krb_err_txt.  In
> raeburn> previous releases, this was a char*[256] array.  Now it's a char**.
> raeburn> That's another incompatible change.  Tom checked it in in December as
> raeburn> part of merging some of the Mac code.  Is this change required?
> 
> Hm.  It used to be
> 
> const char *const krb_err_txt [256];
> 
> which is an array of const pointers to const char, and now it's
> 
> const char * const * const krb_err_txt;
> 
> which is a const pointer to const pointer to const char.
> 
> I think the only significant differences have to do with the
> qualifiers, since an array type should be equivalent to a const
> pointer to its member type.  I'm still puzzled as to why that would
> cause a problem.
> 
> The reason the change is needed is that we're doing a gross hack to
> get krb_err_txt from the generated krb_err.c.  Is there an actual ABI
> difference between (const char * const []) and (const char * const * const)?
> That would seem rather broken.

I'm not sure to what code this is in reference, but you cannot define
a symbol as an array in one file and declare it as a pointer in
another.  e.g. 

   krb.c: const char *const krb_err_txt [256];
   krb.h: const char * const * const krb_err_txt;

will cause undefined behavior because the pointer arithmetic will be
wrong in consumers of <krb.h>.

Cheers,
-- 
Jacques A. Vidrine <nectar at celabo.org>          http://www.celabo.org/
NTT/Verio SME          .     FreeBSD UNIX     .       Heimdal Kerberos
jvidrine at verio.net     .  nectar at FreeBSD.org  .          nectar at kth.se


More information about the krbdev mailing list