summaryrefslogtreecommitdiffstats
path: root/vlc/build/vlc-1.1.6_kdefix.patch
blob: a653ab1da374398e4ea60af23eb7246c41d8f59c (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
From 521f96820b0b03407daf837d206eaf3760ce35a1 Mon Sep 17 00:00:00 2001
From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sun, 30 Jan 2011 14:21:54 +0200
Subject: [PATCH] Revert "Work around QProcess bug (KDE bug #260719)"

This reverts commit ac11f9c0e27905087afdfb46180ece227a4d76e7.
---
 NEWS      |    3 ---
 bin/vlc.c |   46 ++++++++++++++++++++--------------------------
 2 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/NEWS b/NEWS
index 44165f1..a88327c 100644
--- a/NEWS
+++ b/NEWS
@@ -6,9 +6,6 @@ Changes between 1.1.6 and 1.1.7-git:
 Changes between 1.1.6 and 1.1.6.1:
 ----------------------------------
 
-Interfaces:
- * KDE: work around file dialog freeze due to KMimeTypeRepository and QProcess
-
 Source:
  * Fix libnotify, lirc, pulse building and packaging for Unix/Linux
 
diff --git a/bin/vlc.c b/bin/vlc.c
index 104d6ab..51633b2 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -63,11 +63,12 @@ static void dummy_handler (int signum)
 int main( int i_argc, const char *ppsz_argv[] )
 {
     /* The so-called POSIX-compliant MacOS X reportedly processes SIGPIPE even
-     * if it is blocked in all thread.
+     * if it is blocked in all thread. Also some libraries want SIGPIPE blocked
+     * as they have no clue about signal masks.
      * Note: this is NOT an excuse for not protecting against SIGPIPE. If
      * LibVLC runs outside of VLC, we cannot rely on this code snippet. */
     signal (SIGPIPE, SIG_IGN);
-    /* Restore SIGCHLD in case our parent process ignores it. */
+    /* Restore default for SIGCHLD in case parent ignores it. */
     signal (SIGCHLD, SIG_DFL);
 
 #ifdef HAVE_SETENV
@@ -104,38 +105,31 @@ int main( int i_argc, const char *ppsz_argv[] )
              libvlc_get_version(), libvlc_get_changeset() );
 #endif
 
-    /* VLC uses sigwait() to dequeue interesting signals.
-     * For this to work, those signals must be blocked in all threads,
-     * including the thread calling sigwait() (see the man page for details).
+    /* Synchronously intercepted POSIX signals.
      *
-     * There are two advantages to sigwait() over traditional signal handlers:
-     *  - delivery is synchronous: no need to worry about async-safety,
-     *  - EINTR is not generated: other threads need not handle that error.
-     * That being said, some LibVLC programs do not use sigwait(). Therefore
-     * EINTR must still be handled cleanly, notably from poll() calls.
+     * In a threaded program such as VLC, the only sane way to handle signals
+     * is to block them in all threads but one - this is the only way to
+     * predict which thread will receive them. If any piece of code depends
+     * on delivery of one of this signal it is intrinsically not thread-safe
+     * and MUST NOT be used in VLC, whether we like it or not.
+     * There is only one exception: if the signal is raised with
+     * pthread_kill() - we do not use this in LibVLC but some pthread
+     * implementations use them internally. You should really use conditions
+     * for thread synchronization anyway.
      *
-     * Signals that request a clean shutdown, and force an unclean shutdown
+     * Signal that request a clean shutdown, and force an unclean shutdown
      * if they are triggered again 2+ seconds later.
      * We have to handle SIGTERM cleanly because of daemon mode.
      * Note that we set the signals after the vlc_create call. */
     static const int sigs[] = {
         SIGINT, SIGHUP, SIGQUIT, SIGTERM,
-    /* SIGPIPE can happen and would crash the process. On modern systems,
-     * the MSG_NOSIGNAL flag protects socket write operations against SIGPIPE.
-     * But we still need to block SIGPIPE when:
-     *  - writing to pipes,
-     *  - using write() instead of send() for code not specific to sockets.
-     * LibVLC code assumes that SIGPIPE is blocked. Other LibVLC applications
-     * shall block it (or handle it somehow) too.
+    /* Signals that cause a no-op:
+     * - SIGPIPE might happen with sockets and would crash VLC. It MUST be
+     *   blocked by any LibVLC-dependent application, not just VLC.
+     * - SIGCHLD comes after exec*() (such as httpd CGI support) and must
+     *   be dequeued to cleanup zombie processes.
      */
-        SIGPIPE,
-    /* SIGCHLD must be dequeued to clean up zombie child processes.
-     * Furthermore the handler must not be set to SIG_IGN (see above). */
-    /* Unfortunately, the QProcess class from Qt4 has a bug. It installs a
-     * custom signal handlers and gets stuck if it is not called. So we cannot
-     * use sigwait() for SIGCHLD:
-     * http://bugs.kde.org/show_bug.cgi?id=260719 */
-        //SIGCHLD,
+        SIGPIPE, SIGCHLD
     };
 
     sigset_t set;

From 79f476d62e7219e3ffc9a167c9399d4298edf5a4 Mon Sep 17 00:00:00 2001
From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sun, 30 Jan 2011 14:40:02 +0200
Subject: [PATCH] Do not load KDE Qt plugins until KDE gets a clue

(cherry picked from commit 96c7f9c26940828357655380470a930cbb09497e)
---
 bin/override.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/bin/override.c b/bin/override.c
index 498b060..3c54ab0 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -238,8 +238,26 @@ error:
 #endif
 
 
-/*** Locales ***
- * setlocale() is not thread-safe and has a tendency to crash other threads as
+/*** Dynaminc linker ***/
+
+void *dlopen (const char *path, int flags)
+{
+    if (override && path != NULL)
+    {
+        /* Work around the KDE SIGCHLD and KDE D-Bus exit handler bugs */
+        if (strstr (path, "libkde") != NULL)
+        {
+            LOG("Blocked", "\"%s\", %d", path, flags);
+            return NULL;
+        }
+    }
+    return CALL(dlopen, path, flags);
+}
+
+
+/*** Locales ***/
+
+/* setlocale() is not thread-safe and has a tendency to crash other threads as
  * quite many libc and libintl calls depend on the locale.
  * Use uselocale() instead for thread-safety.
  */


From 1b29a1317752f01486def947bcf2e58146b82805 Mon Sep 17 00:00:00 2001
From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sun, 30 Jan 2011 14:41:52 +0200
Subject: [PATCH] Fix compilation

---
 bin/override.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/bin/override.c b/bin/override.c
index 3c54ab0..21c7673 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -33,6 +33,7 @@ void vlc_enable_override (void);
 
 #include <stdarg.h>
 #include <stdio.h>
+#include <string.h>
 #include <stdlib.h>
 #include <dlfcn.h>
 #include <pthread.h>