process 1.0.1.2 → 1.0.1.3
raw patch · 2 files changed
+17/−13 lines, 2 filesdep ~filepath
Dependency ranges changed: filepath
Files
- cbits/runProcess.c +15/−11
- process.cabal +2/−2
cbits/runProcess.c view
@@ -22,16 +22,6 @@ UNIX versions ------------------------------------------------------------------------- */ -static void-disableItimers()-{-#if !defined(USE_TIMER_CREATE)- // we only need to do this if we're using itimers, because- // timer_create timers are not carried across a fork().- stopTimer();-#endif-}- static long max_fd = 0; // Rts internal API, not exposed in a public header file:@@ -52,6 +42,7 @@ int r; struct sigaction dfl; + // Ordering matters here, see below [Note #431]. if (fdStdIn == -1) { r = pipe(fdStdInput); if (r == -1) { @@ -82,10 +73,17 @@ // the signal had been raised. blockUserSignals(); + // See #4074. Sometimes fork() gets interrupted by the timer+ // signal and keeps restarting indefinitely.+ stopTimer();+ switch(pid = fork()) { case -1: unblockUserSignals();+#if __GLASGOW_HASKELL__ > 612+ startTimer();+#endif if (fdStdIn == -1) { close(fdStdInput[0]); close(fdStdInput[1]);@@ -105,7 +103,6 @@ // WARNING! we are now in the child of vfork(), so any memory // we modify below will also be seen in the parent process. - disableItimers(); unblockUserSignals(); if (workingDirectory) {@@ -118,6 +115,12 @@ } } + // [Note #431]: Ordering matters here. If any of the FDs+ // 0,1,2 were initially closed, then our pipes may have used+ // these FDs. So when we dup2 the pipe FDs down to 0,1,2, we+ // must do it in that order, otherwise we could overwrite an+ // FD that we need later.+ if (fdStdIn == -1) { if (fdStdInput[0] != STDIN_FILENO) { dup2 (fdStdInput[0], STDIN_FILENO);@@ -206,6 +209,7 @@ break; } unblockUserSignals();+ startTimer(); return pid; }
process.cabal view
@@ -1,5 +1,5 @@ name: process-version: 1.0.1.2+version: 1.0.1.3 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org@@ -54,7 +54,7 @@ } build-depends: directory >= 1.0 && < 1.1,- filepath >= 1.1 && < 1.2+ filepath >= 1.1 && < 1.3 extensions: CPP }