<pre style='margin:0'>
Mohamed Akram (mohd-akram) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/fd9e82cb56afcc86a42b66f4b6ac9c273f8a562b">https://github.com/macports/macports-ports/commit/fd9e82cb56afcc86a42b66f4b6ac9c273f8a562b</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new fd9e82cb56a pulseaudio: fix daemon crash
</span>fd9e82cb56a is described below
<span style='display:block; white-space:pre;color:#808000;'>commit fd9e82cb56afcc86a42b66f4b6ac9c273f8a562b
</span>Author: Mohamed Akram <makr@macports.org>
AuthorDate: Sat May 4 03:24:09 2024 +0400
<span style='display:block; white-space:pre;color:#404040;'> pulseaudio: fix daemon crash
</span>---
audio/pulseaudio/Portfile | 5 +-
.../files/patch-fix-coreaudio-crash.diff | 70 ++++++++++++++++++++++
2 files changed, 73 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/audio/pulseaudio/Portfile b/audio/pulseaudio/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 228662d413e..fb79972c665 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/audio/pulseaudio/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/audio/pulseaudio/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -11,7 +11,7 @@ PortGroup perl5 1.0
</span>
name pulseaudio
version 17.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 2
</span> license {BSD LGPL-2.1+ MIT}
categories audio
maintainers {ionic @Ionic} openmaintainer
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -76,7 +76,8 @@ platform darwin {
</span> patchfiles-append patch-src_modules_macosx_module_coreaudio_device.c-respect-PA_NAME_MAX.diff \
patch-src_daemon_default.pa.in-skip-consolekit-and-systemdlogin.diff \
patch-src_pulsecore_shm.c_Static_assert.diff \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- patch-fix-modules.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patch-fix-modules.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patch-fix-coreaudio-crash.diff
</span>
platform darwin 8 {
patchfiles-append patch-src_modules_macosx_module_coreaudio_device.c-tiger-compat.diff
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/audio/pulseaudio/files/patch-fix-coreaudio-crash.diff b/audio/pulseaudio/files/patch-fix-coreaudio-crash.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..1cda99b717d
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/audio/pulseaudio/files/patch-fix-coreaudio-crash.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,70 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+commit a340404b01c6661c8b0cf0e80f4695aef402c345
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Author: Mohamed Akram <mohd.akram@outlook.com>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Sat May 4 02:59:50 2024 +0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ daemon: fix crash when CoreAudio is enabled
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macOS frameworks cannot be used safely after forking without an exec.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/353
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/819>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git src/daemon/main.c src/daemon/main.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 924a4d4aa..499685921 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/daemon/main.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/daemon/main.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -524,6 +524,9 @@ int main(int argc, char *argv[]) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef HAVE_FORK
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int daemon_pipe[2] = { -1, -1 };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int daemon_pipe2[2] = { -1, -1 };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifdef HAVE_COREAUDIO
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char **args;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int autospawn_fd = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool autospawn_locked = false;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -828,6 +831,16 @@ int main(int argc, char *argv[]) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ goto finish;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(HAVE_FORK) && defined(HAVE_COREAUDIO)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ((e = getenv("PULSE_DAEMON_FD"))) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int32_t fd;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (pa_atoi(e, &fd) < 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ goto finish;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ daemon_pipe2[1] = fd;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (conf->cmd == PA_CMD_START) autospawn_locked = true;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (conf->cmd == PA_CMD_START && (configured_address = check_configured_address())) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* There is an server address in our config, but where did it come from?
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * By default a standard X11 login will load module-x11-publish which will
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -904,7 +917,7 @@ int main(int argc, char *argv[]) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ goto finish;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if ((pa_autospawn_lock_acquire(true) < 0)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!autospawn_locked && pa_autospawn_lock_acquire(true) < 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pa_log("Failed to acquire autospawn lock");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ goto finish;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1050,6 +1063,18 @@ int main(int argc, char *argv[]) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pa_nullify_stdfds();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(HAVE_FORK) && defined(HAVE_COREAUDIO)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* CoreAudio crashes if we don't exec after forking */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!(args = malloc((argc + 2) * sizeof *args)))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ goto finish;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memcpy(args, argv, argc * sizeof *argv);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ args[argc] = "--daemonize=no";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ args[argc+1] = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ s = pa_sprintf_malloc("%d", daemon_pipe2[1]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ pa_set_env("PULSE_DAEMON_FD", s);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ execv(PA_BINARY, args);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pa_set_env_and_record("PULSE_INTERNAL", "1");
</span></pre><pre style='margin:0'>
</pre>