Subject: Re: pkg/30308: conflicting local errno in lang/perl5.8
To: None <gnats-bugs@netbsd.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: pkgsrc-bugs
Date: 06/08/2005 07:43:14
On Sun, May 22, 2005 at 03:51:00PM +0000, joerg@leaf.dragonflybsd.org wrote:
> 
> >Description:
> The Perl 5.8 source defines errno locally, which conflicts with the definition in errno.h.
> >How-To-Repeat:
> build in DragonFly HEAD
> >Fix:
> Add the following patch:
> 
> --- ext/SDBM_File/sdbm/sdbm.c.orig      2003-08-27 12:30:22.000000000 +0200
> +++ ext/SDBM_File/sdbm/sdbm.c   2005-05-03 10:18:19.000000000 +0200
> @@ -36,9 +36,11 @@
>   */
>  #ifndef WIN32
>  #ifndef sun
> +#ifndef __STDC__
>  extern int errno;
>  #endif
>  #endif
> +#endif

I took a closer look at this.  I think the best thing to do in this
case is to use the same test that's in perl.h, which does:

	#include <errno.h>
	#ifndef errno
	extern int errno;
	#endif

While this may not be necessarily correct either, at least it would
consistent within the Perl sources, and we can wait for something
better to appear in future Perl versions.  The Configure script implies
that the Perl maintainers are aware of this problem, and will fix it
in the future.

From looking at the CVS logs for src/sys/sys/errno.h for DragonFly,
it appears that the "errno" is always defined if <errno.h> is included,
so this test will also work on DragonFly (actually, I notice that your
commit of revision 1.6 of that file shows awareness of this issue).

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>