summaryrefslogtreecommitdiff
path: root/debian/patches/99_hppa_bug561203_decrease_failure_rate.diff
blob: 3017c935f061c83795ba29f4d4be22423fe13272 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Description: decrease failure rate of QProcess (#561203) on hppa ~100+ times
 The patch adds a usleep() of 1000 before fork() in QProcess on hppa. This hack
 seems to bring down likelihood of failure caused by #561203 from ~ 1/6 to
~1/1000 when run in a row. Hopefully, this will make failures rare enough
 not to cause FTBFSes.
 Degradation in performance should not be very significant and is acceptable.
Author: Modestas Vainius <modax@debian.org>
Author: Fathi Boudra <fabo@debian.org>
Forwarded: not-needed
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561203
Origin: vendor
Last-Update: 2011-12-26

---
 src/corelib/io/qprocess_unix.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -532,6 +532,13 @@ static char **_q_dupEnvironment(const QP
     return envp;
 }
 
+inline void debbug_561203()
+{
+#if defined(__linux__) && defined(__hppa__)
+        usleep(1000);
+#endif
+}
+
 #ifdef Q_OS_MAC
 Q_GLOBAL_STATIC(QMutex, cfbundleMutex);
 #endif
@@ -660,6 +667,7 @@ void QProcessPrivate::startProcess()
 #if defined(Q_OS_QNX)
     pid_t childPid = spawnChild(workingDirPtr, argv, envp);
 #else
+    debbug_561203();
     pid_t childPid = fork();
     int lastForkErrno = errno;
 #endif
@@ -1357,6 +1365,7 @@ bool QProcessPrivate::startDetached(cons
         return false;
     }
 
+    debbug_561203();
     pid_t childPid = fork();
     if (childPid == 0) {
         struct sigaction noaction;
@@ -1369,6 +1378,7 @@ bool QProcessPrivate::startDetached(cons
         qt_safe_close(startedPipe[0]);
         qt_safe_close(pidPipe[0]);
 
+        debbug_561203();
         pid_t doubleForkPid = fork();
         if (doubleForkPid == 0) {
             qt_safe_close(pidPipe[1]);