The MacPorts developers suggest that problem may be in the code in make
4.1's main.c...

3365       /* Close the write side, so the read() won't hang.  */
3366       close (job_fds[1]);
3367
3368       while (read (job_fds[0], &token, 1) == 1)
3369         ++tcnt;
3370 #endif
3371
3372       if (tcnt != master_job_slots)
3373         ONN (error, NILF,
3374              "INTERNAL: Exiting with %u jobserver tokens
available; should be %u!",
3375              tcnt, master_job_slots);
3376
3377 #ifdef WINDOWS32
3378       free_jobserver_semaphore ();
3379 #else
3380       close (job_fds[0]);
3381 #endif
3382

where there is no error checking on this read()...

while (read (job_fds[0], &token, 1) == 1)

and if it always fails, could leave tcnt at 1 as we observe. They suggest
this could be failing with EINTR and needs the EINTRLOOP() macro as seen in
the writes (etc).

On Tue, Oct 20, 2015 at 9:03 PM, Jack Howarth <howarth.at.f...@gmail.com>
wrote:

> This is starting to make sense. The code section that I have been
> suspecting in make 4.1 (which is the only place that resets the job_slots
> to 1) is...
>
> #ifndef WINDOWS32
> #ifdef HAVE_FCNTL
> # define FD_OK(_f) ((fcntl ((_f), F_GETFD) != -1) || (errno != EBADF))
> #else
> # define FD_OK(_f) 1
> #endif
>       /* Create a duplicate pipe, that will be closed in the SIGCHLD
>          handler.  If this fails with EBADF, the parent has closed the pipe
>          on us because it didn't think we were a submake.  If so, print a
>          warning then default to -j1.  */
>       else if (!FD_OK (job_fds[0]) || !FD_OK (job_fds[1])
>                || (job_rfd = dup (job_fds[0])) < 0)
>         {
>           if (errno != EBADF)
>             pfatal_with_name (_("dup jobserver"));
>
>           O (error, NILF,
>              _("warning: jobserver unavailable: using -j1.  Add '+' to
> parent make rule."));
>           job_slots = 1;
>           job_fds[0] = job_fds[1] = -1;
>         }
> #endif
>
> whereas the same code section in make 3.82 (which doesn't show this bug)
> is...
>
>       /* Create a duplicate pipe, that will be closed in the SIGCHLD
>          handler.  If this fails with EBADF, the parent has closed the pipe
>          on us because it didn't think we were a submake.  If so, print a
>          warning then default to -j1.  */
>
>       else if ((job_rfd = dup (job_fds[0])) < 0)
>         {
>           if (errno != EBADF)
>             pfatal_with_name (_("dup jobserver"));
>
>           error (NILF,
>                  _("warning: jobserver unavailable: using -j1.  Add `+' to
> parent make rule."));
>           job_slots = 1;
>         }
>
> So only make 4.1 is executing the fnctl() calls via the FD_OK macro.
> Perhaps we can hack around this by causing HAVE_FCNTL to be undefined in
> the fink make 4.1 build?
>
> On Tue, Oct 20, 2015 at 8:20 PM, Jack Howarth <howarth.at.f...@gmail.com>
> wrote:
>
>>     So far my testing on 10.12 suggests that the trigger for the
>> regression in using fink make 4.1 under 10.12 is due to the flock() usage
>> in Services.pm. The most reliable reproducer of this regression on my
>> system has been the InfoTest of libcurl4 which always fails in the
>> compilation of the test suite under make 4.1. Using the following hack...
>>
>> --- Services.pm.orig 2015-10-20 20:06:57.000000000 -0400
>> +++ Services.pm 2015-10-20 20:09:39.000000000 -0400
>> @@ -1756,11 +1756,11 @@
>>   }
>>
>>   my $mode = $exclusive ? LOCK_EX : LOCK_SH;
>> - if (flock $lockfile_FH, $mode | LOCK_NB) {
>> - return wantarray ? ($lockfile_FH, 0) : $lockfile_FH;
>> - } else {
>> +# if (flock $lockfile_FH, $mode | LOCK_NB) {
>> +# return wantarray ? ($lockfile_FH, 0) : $lockfile_FH;
>> +# } else {
>>   # Maybe the system doesn't support locking?
>> - if ($! == EOPNOTSUPP || $! == ENOLCK) {
>> +# if ($! == EOPNOTSUPP || $! == ENOLCK) {
>>   require Fink::Config;
>>   if (!defined $Fink::Config::config ||
>>   !$Fink::Config::config->get_option("LockWarning", 0)) {
>> @@ -1772,7 +1772,7 @@
>>   if defined $Fink::Config::config;
>>   }
>>   return ($lockfile_FH, 0);
>> - }
>> +# }
>>
>>   return (wantarray ? (0, 0) : 0) if $no_block;
>>
>> @@ -1808,7 +1808,7 @@
>>   close $lockfile_FH;
>>   return wantarray ? (0, 0) : 0;
>>   }
>> - }
>> +# }
>>  }
>>
>>  =item dpkg_lockwait
>>
>> to avoid the flock() calls in perl suppresses the failure under make 4.1
>> on 10.12.
>>
>>
>
------------------------------------------------------------------------------
_______________________________________________
Fink-devel mailing list
Fink-devel@lists.sourceforge.net
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to