On Thu, 4 Sep 2008, Patrick R. Michaud wrote:

> On Thu, Sep 04, 2008 at 04:52:34PM -0700, James Keenan via RT wrote:
> > I applied the patch attached, aio.in.revised.patch.txt, in r30771.  I
> > set the 'sleep' to 4 seconds.  All the tests have been reactivated.
> 
> Thanks.
> 
> > This is a patch in the sense of "bandaid".  What is it about the letter
> > 'K' that means that this probe gives sloppy results on Kubuntu when on
> > Ubuntu it has built cleanly for me every day since I started building
> > Parrot?  
> 
> The problem only appeared for me in Kubuntu a few weeks ago, and 
> then only intermittently until a week or so ago.  Prior to the 
> beginning of August Parrot had been building cleanly for me on 
> Kubuntu without any difficulty.
> 
> As one of the earlier messages suggested, I think it may just be a
> race condition in the signal handling.

It's a wacky test in many respects.  For one thing, it tests using 
signal number '35' without any regard for what that signal might 
acutally mean.  On Solaris, for example, 35 is 'SIGFREEZE', which is
almost certainly not what was intended.

I suspect that on someone's Linux system, SIGRTMIN got reported as 34,
and so the test just hard-coded '35'.  It's quite possible that signal
35 means something different on recent versions of Kubuntu.

This patch takes the following small steps:

First, I replaced the 
        retval =  *(int*)i->si_ptr;
line by
        retval =  *(int*)i->si_value.sival_ptr;
I've never fiddled with this stuff before, but it looks like the si_ptr
#define is not necessarily very portable.  I replaced it by the si_value
and sival_ptr fields, which I hope are slightly more portable.

Second, it moves the small step of moving the logic of finding 
SIGRTMIN + 1 into the C program, where it's trivial.

Next, it adds in an else branch for the case where the program builds
but does not run successfully.  

Finally,  made sure the 'aio' and 'HAS_AIO' entries are always set to
some value.

I haven't looked for race conditions at all, but with this patch, I'll at 
least be more confident that it's trying to do what we think it's trying 
to do.

diff -r -u parrot-current/config/auto/aio/aio.in 
parrot-andy/config/auto/aio/aio.in
--- parrot-current/config/auto/aio/aio.in       2008-09-05 08:13:19.000000000 
-0400
+++ parrot-andy/config/auto/aio/aio.in  2008-09-05 13:04:03.000000000 -0400
@@ -23,7 +23,7 @@
 {
     if (s == my_sig) {
        flag = s;
-       retval =  *(int*)i->si_ptr;
+       retval =  *(int*)i->si_value.sival_ptr;
     }
 }
 
@@ -36,7 +36,13 @@
     int i = 42;
     int cnt = 4;
 
-    my_sig = atoi(argv[1]);
+    /* For internal use, we usually use
+          SIGRTMIN + argv[1].  
+       Usually, that's set to
+          SIGRTMIN + 1
+       by the calling program.
+    */
+    my_sig = SIGRTMIN + atoi(argv[1]);
     printf("SIGRTMIN=%d SIGRTMAX=%d\n", SIGRTMIN, SIGRTMAX);
 
     fd = open("MANIFEST", O_RDONLY);
diff -r -u parrot-current/config/auto/aio.pm parrot-andy/config/auto/aio.pm
--- parrot-current/config/auto/aio.pm   2008-08-31 12:15:34.000000000 -0400
+++ parrot-andy/config/auto/aio.pm      2008-09-05 12:08:23.000000000 -0400
@@ -49,10 +49,11 @@
 
     my $errormsg = _first_probe_for_aio($conf);
     if ( ! $errormsg ) {
-        my $test = $conf->cc_run(35);
+        my $test = $conf->cc_run(1);  # Use signal RTMIN + 1
 
         # if the test is failing with sigaction err
         # we should repeat it with a different signal number
+        # This is currently not implemented.
         if (
             $test =~ /SIGRTMIN=(\d+)\sSIGRTMAX=(\d+)\n
                 INFO=42\n
@@ -69,6 +70,9 @@
                 D_SIGRTMAX => $2,
             );
         }
+        else {
+            $self->_handle_error_case($conf, $libs, $verbose);
+        }
     }
     else {
         $self->_handle_error_case($conf, $libs, $verbose);
@@ -88,7 +92,11 @@
 
 sub _handle_error_case {
     my ($self, $conf, $libs, $verbose) = @_;
-    $conf->data->set( libs => $libs );
+    $conf->data->set(
+        aio        => undef,
+        HAS_AIO    => 0,
+    );
+    $conf->data->set( libs => $libs );  # Restore old values
     print " (no) " if $verbose;
     $self->set_result('no');
 }
-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to