Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] SDBM_File fails to build on some platforms due to use of 'extern int errno' (was: Re: patches for lang/perl5.8 dfport override) #7925

Closed
p5pRT opened this issue May 22, 2005 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented May 22, 2005

Migrated from rt.perl.org#35938 (status was 'resolved')

Searchable as RT35938$

@p5pRT
Copy link
Author

p5pRT commented May 22, 2005

From cpressey@catseye.mine.nu

On Tue, 17 May 2005 08​:08​:53 +0200
Joerg Sonnenberger <joerg@​britannica.bec.de> wrote​:

On Mon, May 16, 2005 at 05​:24​:59PM -0700, Chris Pressey wrote​:

Patches so that Perl5.8 can build. I built it by putting these
patches into ports/lang/perl5.8/files. The proper way to do it
would be to make a dfport override, but since no-one seems to know
why my previous attempt at making one of those doesn't work, this
activity is left as an exercise for the reader. :)

[already in pkgsrc, I said I would move my work there :)]

Can you check whether the patch to util.c is really needed?

Hm, I guess it isn't.

It's not build here. Also query the freebsd maintainer, it's a simple
non-intrusive patch :)

OK, tobez@​FreeBSD.org and perlbug@​perl.com cc'ed.

To re-iterate​: the problem is that SDBM_File (part of Perl 5.8.6) fails
to build on some platforms (such as DragonFlyBSD) due to the obsolete
way it declares errno, as 'extern int errno'. Errno is not guaranteed
to be defined this way under POSIX; '#include <errno.h>' is the
preferred way of obtaining an errno declaration.

The attached patch makes the appropriate substitution in the SDBM_File
source.

I'm not aware of any platforms on which '#include <errno.h>' is
insufficient; if there are such, the correct solution would be to probe
for this during the configure phase and conditionalize the compilation,
something like​:

  #ifdef HAS_ERRNO_H
  #include <errno.h>
  #else
  extern int errno;
  #endif

Thanks,
-Chris

@p5pRT
Copy link
Author

p5pRT commented May 22, 2005

From cpressey@catseye.mine.nu

Inline Patch
--- ext/SDBM_File/sdbm/sdbm.c.orig	2005-05-16 16:26:17.000000000 -0700
+++ ext/SDBM_File/sdbm/sdbm.c	2005-05-16 16:26:53.000000000 -0700
@@ -31,14 +31,7 @@
 # include <strings.h>
 #endif
 
-/*
- * externals
- */
-#ifndef WIN32
-#ifndef sun
-extern int errno;
-#endif
-#endif
+#include <errno.h>
 
 extern Malloc_t malloc proto((MEM_SIZE));
 extern Free_t free proto((Malloc_t));

@p5pRT
Copy link
Author

p5pRT commented May 23, 2005

From @doughera88

On Sun, 22 May 2005, Chris Pressey wrote​:

OK, tobez@​FreeBSD.org and perlbug@​perl.com cc'ed.

To re-iterate​: the problem is that SDBM_File (part of Perl 5.8.6) fails
to build on some platforms (such as DragonFlyBSD) due to the obsolete
way it declares errno, as 'extern int errno'. Errno is not guaranteed
to be defined this way under POSIX; '#include <errno.h>' is the
preferred way of obtaining an errno declaration.

The attached patch makes the appropriate substitution in the SDBM_File
source.

Here's what I'd suggest for the main perl sources. Though this patch is
against bleadperl, I think it's appropriate to apply to 5.8.x as well,
though it may be too late for 5.8.7.

Inline Patch
diff -r -u perl-current/ext/SDBM_File/sdbm/sdbm.c perl-andy/ext/SDBM_File/sdbm/sdbm.c
--- perl-current/ext/SDBM_File/sdbm/sdbm.c	Thu Apr 21 12:05:30 2005
+++ perl-andy/ext/SDBM_File/sdbm/sdbm.c	Mon May 23 11:31:35 2005
@@ -34,11 +34,9 @@
 /*
  * externals
  */
-#ifndef WIN32
-#ifndef sun
-extern int errno;
-#endif
-#endif
+
+#include <errno.h> /* See notes in perl.h about avoiding
+			extern int errno; */
 
 extern Malloc_t malloc proto((MEM_SIZE));
 extern Free_t free proto((Malloc_t));


-- 

  Andy Dougherty doughera@​lafayette.edu
  Dept. of Physics
  Lafayette College, Easton PA 18042

@p5pRT
Copy link
Author

p5pRT commented May 23, 2005

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 23, 2005

From @Tux

On Mon, 23 May 2005 11​:48​:08 -0400 (EDT), Andrew Dougherty
<doughera@​lafayette.edu> wrote​:

On Sun, 22 May 2005, Chris Pressey wrote​:

OK, tobez@​FreeBSD.org and perlbug@​perl.com cc'ed.

To re-iterate​: the problem is that SDBM_File (part of Perl 5.8.6) fails
to build on some platforms (such as DragonFlyBSD) due to the obsolete
way it declares errno, as 'extern int errno'. Errno is not guaranteed
to be defined this way under POSIX; '#include <errno.h>' is the
preferred way of obtaining an errno declaration.

The attached patch makes the appropriate substitution in the SDBM_File
source.

Here's what I'd suggest for the main perl sources. Though this patch is
against bleadperl, I think it's appropriate to apply to 5.8.x as well,
though it may be too late for 5.8.7.

Thanks, applied to blead with change #24554

diff -r -u perl-current/ext/SDBM_File/sdbm/sdbm.c perl-andy/ext/SDBM_File/
sdbm/sdbm.c --- perl-current/ext/SDBM_File/sdbm/sdbm.c Thu Apr 21
12​:05​:30 2005 +++ perl-andy/ext/SDBM_File/sdbm/sdbm.c Mon May 23
11​:31​:35 2005 @​@​ -34,11 +34,9 @​@​
/*
* externals
*/
-#ifndef WIN32
-#ifndef sun
-extern int errno;
-#endif
-#endif
+
+#include <errno.h> /* See notes in perl.h about avoiding
+ extern int errno; */

extern Malloc_t malloc proto((MEM_SIZE));
extern Free_t free proto((Malloc_t));

--
Andy Dougherty doughera@​lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042

--
H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2 on HP-UX 10.20, 11.00 & 11.11,
AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http​://www.cmve.net/~merijn
Smoking perl​: http​://www.test-smoke.org, perl QA​: http​://qa.perl.org
reports to​: smokers-reports@​perl.org, perl-qa@​perl.org

@p5pRT p5pRT closed this as completed May 24, 2005
@p5pRT
Copy link
Author

p5pRT commented May 24, 2005

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant