develooper Front page | perl.perl5.porters | Postings from November 2000

Re: connect and $!{EINPROGRESS} pb (was [ID 20001030.010] [PATCH] io_multihomed.t failing)

Thread Previous | Thread Next
From:
Pixel
Date:
November 5, 2000 12:51
Subject:
Re: connect and $!{EINPROGRESS} pb (was [ID 20001030.010] [PATCH] io_multihomed.t failing)
Message ID:
ly8zqygn4x.fsf@leia.mandrakesoft.com
Tom Hughes <tom@compton.nu> writes:

[...]

> > Is it perhaps $!{EINPROGRESS} that is buggy on your system?

[...]

> The problem is that it assumes that it can run 'cc -E' over a
> file that includes errno.h and then pick out the #line directives
> from the output to find all the files that contain error codes
> but either gcc or the systems headers with RH7 have changed such
> that one of the include files contains nothing but #defines and
> as the file generates no lines in the cc output gcc doesn't bother
> to generate a #line directive for it.

the pb comes from the change in glibc:

pixel@leia:~>rpm -q glibc
glibc-2.1.3-16mdk
pixel@leia:~>gcc -E /usr/include/errno.h | grep asm
# 1 "/usr/include/asm/errno.h" 1 3
pixel@leia:~>

pixel@no:~>rpm -q glibc
glibc-2.1.95-3mdk
pixel@no:~>gcc -E /usr/include/errno.h | grep asm
pixel@no:~>


RedHat's solution is to use 

"gcc -E -dM /usr/include/errno.h"

where -dM is

       -dM    Tell the preprocessor to output only a list of  the
              macro  definitions that are in effect at the end of
              preprocessing.  Used with the `-E' option.


Here is a patch that does so:

--------------------------------------------------------------------------------
--- perl-5.6.0/ext/Errno/Errno_pm.PL.pix	Sat Mar  4 05:26:54 2000
+++ perl-5.6.0/ext/Errno/Errno_pm.PL	Sun Nov  5 21:41:49 2000
@@ -29,6 +29,13 @@
             warn "Cannot open '$file'";
             return;
 	}     
+    } elsif ($^O eq 'linux') {
+	# With the -dM option option, gcc outputs every #define's it finds
+	my $cpp = default_cpp();
+	unless(open(FH, "$cpp -dM < $file |")) {
+            warn "Cannot open '$file'";
+            return;
+	}
     } else {
 	unless(open(FH,"< $file")) {
 	    # This file could be a temporary file created by cppstdin
@@ -79,6 +86,8 @@
     } elsif ($^O eq 'vmesa') {
 	# OS/390 C compiler doesn't generate #file or #line directives
 	$file{'../../vmesa/errno.h'} = 1;
+    } elsif ($^O eq 'linux') {
+	$file{'/usr/include/errno.h'} = 1;
     } else {
 	open(CPPI,"> errno.c") or
 	    die "Cannot open errno.c";
--------------------------------------------------------------------------------

caution: i assume that under linux, the $Config{cppstdin} is using gcc...


cu Pixel.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About