On Sat, Oct 17, 2015 at 8:01 PM, Jack Howarth <howarth.at.f...@gmail.com>
wrote:

> Looking a bit more at the failures of make 4.x under fink, I noticed that
> fink uses the perl system() call and MacPorts uses tcl's system() call as
> well. However the perl documentation has the following comment...
>
> Since system does a fork and wait it may affect a SIGCHLD handler. See
> perlipc for details.
>
> This may be critical to the bug as the diff of main.c in make 3.8.2 to 4.1
> shows following additional code...
>
> +#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
>
> So far, I am not seeing the make failures when using the older fink make
> 3.82 packaging on 10.11. Also, note that the errors we are seeing with make
> 4.1 are of the form..
>
> make: INTERNAL: Exiting with 1 jobserver tokens available; should be 8!
>
> ...where the jobs are being lowered expectedly from 8 to 1 exactly as the
> comment in main.c states. As far as I can tell, the code section above is
> the only place in make 4.1 where job_slots is reset to 1.
>             Jack
> ps The MacPorts developers pointed that their system() isn't actually the
> stock tcl one but a custom version...
>
> http://trac.macports.org/browser/trunk/base/src/pextlib1.0/system.c
>
> which uses fork().
>

FYI, MacPorts have been using there own system() call for 12 years or more.
The first version with the system call placed in its own file (before all
the sandbox support was added) is about 6 years old.

http://trac.macports.org/browser/trunk/base/src/pextlib1.0/system.c?rev=53831

and might be a good starting point for a c-version of system() which would
work under perl.
------------------------------------------------------------------------------
_______________________________________________
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