diff options
Diffstat (limited to 'audio/yabridge')
-rw-r--r-- | audio/yabridge/fix-libdbus-connection.patch | 48 | ||||
-rw-r--r-- | audio/yabridge/fix_change_path.diff | 14 | ||||
-rw-r--r-- | audio/yabridge/load_posix_spawn_addclosefrom_np.diff | 123 | ||||
-rw-r--r-- | audio/yabridge/yabridge.SlackBuild | 61 | ||||
-rw-r--r-- | audio/yabridge/yabridge.info | 12 |
5 files changed, 172 insertions, 86 deletions
diff --git a/audio/yabridge/fix-libdbus-connection.patch b/audio/yabridge/fix-libdbus-connection.patch deleted file mode 100644 index 4acbee2927..0000000000 --- a/audio/yabridge/fix-libdbus-connection.patch +++ /dev/null @@ -1,48 +0,0 @@ -commit 8d508dc2fefe9745ffa9cb14e1d7519a7852aa95 -Author: Robbert van der Helm <mail@robbertvanderhelm.nl> -Date: Sun Apr 7 22:49:00 2024 +0200 - - Fix segfault destroying libdbus connection - -diff --git a/CHANGELOG.md b/CHANGELOG.md -index a1739b3d..429880a6 100644 ---- a/CHANGELOG.md -+++ b/CHANGELOG.md -@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - and this project adheres to [Semantic - Versioning](https://semver.org/spec/v2.0.0.html). - -+## [Unreleased] -+ -+### Fixed -+ -+- Fixed a potential segfault when unloading yabridge. -+ - ## [5.1.0] - 2023-12-23 - - ### Added -diff --git a/src/common/notifications.cpp b/src/common/notifications.cpp -index 403103bf..654b6c83 100644 ---- a/src/common/notifications.cpp -+++ b/src/common/notifications.cpp -@@ -57,9 +57,19 @@ std::mutex libdbus_mutex; - LIBDBUS_FUNCTIONS - #undef X - -+/** -+ * The deleter used for `libdbus_connection`. `libdbus_connection` can't -+ * directly reference `libdbus_connection_unref` directly because it will not -+ * yet have been initialized until just before `libdbus_connection` gets -+ * initialized. -+ */ -+static void close_dbus_connection(DBusConnection* connection) { -+ libdbus_connection_unref(connection); -+} -+ - std::unique_ptr<DBusConnection, void (*)(DBusConnection*)> libdbus_connection( - nullptr, -- libdbus_connection_unref); -+ close_dbus_connection); - - /** - * Try to set up D-Bus. Returns `false` if a function could not be resolved or diff --git a/audio/yabridge/fix_change_path.diff b/audio/yabridge/fix_change_path.diff new file mode 100644 index 0000000000..0b0575deb1 --- /dev/null +++ b/audio/yabridge/fix_change_path.diff @@ -0,0 +1,14 @@ +diff --git a/tools/yabridgectl/src/main.rs b/tools/yabridgectl/src/main.rs +index e66ef0da..6897260e 100644 +--- a/tools/yabridgectl/src/main.rs ++++ b/tools/yabridgectl/src/main.rs +@@ -148,7 +148,8 @@ fn main() -> Result<()> { + "Automatically locate yabridge's files. This can be used after \ + manually setting a path with the '--path' option to revert back to \ + the default auto detection behaviour.", +- ), ++ ) ++ .action(ArgAction::SetTrue), + ) + .arg( + Arg::new("vst2_location") diff --git a/audio/yabridge/load_posix_spawn_addclosefrom_np.diff b/audio/yabridge/load_posix_spawn_addclosefrom_np.diff new file mode 100644 index 0000000000..9c10fafbb2 --- /dev/null +++ b/audio/yabridge/load_posix_spawn_addclosefrom_np.diff @@ -0,0 +1,123 @@ +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 4af4cb1a..987a23fe 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -6,7 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), + and this project adheres to [Semantic + Versioning](https://semver.org/spec/v2.0.0.html). + +-## [5.1.1] - 2024-11-04 ++## [Unreleased] ++ ++### Fixed ++ ++- Worked around an interaction between **Ubuntu 24.10** and certain hosts like ++ **Ardour** that would cause yabridge to hang and eventually crash the host by ++ consuming too much memory. This only affected the prebuilt binaries from the ++ releases page. ++ ++## [5.1.1] - 2024-12-23 + + ### Fixed + +diff --git a/src/common/process.cpp b/src/common/process.cpp +index d9f407d1..5408abed 100644 +--- a/src/common/process.cpp ++++ b/src/common/process.cpp +@@ -19,6 +19,7 @@ + #include <cassert> + #include <iostream> + ++#include <dlfcn.h> + #include <spawn.h> + #include <sys/wait.h> + +@@ -323,6 +324,48 @@ Process::StatusResult Process::spawn_get_status() const { + } + } + ++/** ++ * Add file handle close actions to a `posix_spawn_file_actions_t` that close ++ * all non-stdio file descriptors. ++ * ++ * If the Wine process outlives the host, then it may cause issues if our ++ * process is still keeping the host's file descriptors alive that. This can ++ * prevent Ardour from restarting after an unexpected shutdown. Because of this ++ * we won't use `vfork()`, but instead we'll just manually close all non-STDIO ++ * file descriptors. ++ */ ++static void close_non_stdio_file_descriptions( ++ posix_spawn_file_actions_t& actions) { ++#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) ++ posix_spawn_file_actions_addclosefrom_np(&actions, STDERR_FILENO + 1); ++#else ++ // NOTE: As of writing, yabridge is compiled on Ubuntu 20.04, where ++ // `posix_spawn_file_actions_addclosefrom_np()` is not yet available. ++ // For whatever reason that may be, on Ubuntu 24.10 closing all file ++ // handles manually becomes very slow and starts to leak memory when ++ // running yabridge under Ardour. We could bump the minimum Ubuntu ++ // version supported by the binaries and always use this function, but ++ // loading the function at runtime should be fine and gives us better ++ // compatibility even if yabridge is compiled on an older distro. ++ // ++ // https://github.com/robbert-vdh/yabridge/issues/377 ++ int (*posix_spawn_file_actions_addclosefrom_np)(posix_spawn_file_actions_t*, ++ int); ++ posix_spawn_file_actions_addclosefrom_np = ++ reinterpret_cast<decltype(posix_spawn_file_actions_addclosefrom_np)>( ++ dlsym(nullptr, "posix_spawn_file_actions_addclosefrom_np")); ++ ++ if (posix_spawn_file_actions_addclosefrom_np) { ++ posix_spawn_file_actions_addclosefrom_np(&actions, STDERR_FILENO + 1); ++ } else { ++ const int max_fds = static_cast<int>(sysconf(_SC_OPEN_MAX)); ++ for (int fd = STDERR_FILENO + 1; fd < max_fds; fd++) { ++ posix_spawn_file_actions_addclose(&actions, fd); ++ } ++ } ++#endif ++} ++ + #ifndef WITHOUT_ASIO + Process::HandleResult Process::spawn_child_piped( + // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) +@@ -348,20 +391,7 @@ Process::HandleResult Process::spawn_child_piped( + posix_spawn_file_actions_adddup2(&actions, stderr_pipe_fds[1], + STDERR_FILENO); + // We'll close the four pipe fds along with the rest of the file descriptors +- +-// NOTE: If the Wine process outlives the host, then it may cause issues if +-// our process is still keeping the host's file descriptors alive +-// that. This can prevent Ardour from restarting after an unexpected +-// shutdown. Because of this we won't use `vfork()`, but instead we'll +-// just manually close all non-STDIO file descriptors. +-#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) +- posix_spawn_file_actions_addclosefrom_np(&actions, STDERR_FILENO + 1); +-#else +- const int max_fds = static_cast<int>(sysconf(_SC_OPEN_MAX)); +- for (int fd = STDERR_FILENO + 1; fd < max_fds; fd++) { +- posix_spawn_file_actions_addclose(&actions, fd); +- } +-#endif ++ close_non_stdio_file_descriptions(actions); + + pid_t child_pid = 0; + const auto result = posix_spawnp(&child_pid, command_.c_str(), &actions, +@@ -407,16 +437,7 @@ Process::HandleResult Process::spawn_child_redirected( + O_WRONLY | O_CREAT | O_APPEND, 0640); + posix_spawn_file_actions_addopen(&actions, STDERR_FILENO, filename.c_str(), + O_WRONLY | O_CREAT | O_APPEND, 0640); +- +- // See the note in the other function +-#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) +- posix_spawn_file_actions_addclosefrom_np(&actions, STDERR_FILENO + 1); +-#else +- const int max_fds = static_cast<int>(sysconf(_SC_OPEN_MAX)); +- for (int fd = STDERR_FILENO + 1; fd < max_fds; fd++) { +- posix_spawn_file_actions_addclose(&actions, fd); +- } +-#endif ++ close_non_stdio_file_descriptions(actions); + + pid_t child_pid = 0; + const auto result = posix_spawnp(&child_pid, command_.c_str(), &actions, diff --git a/audio/yabridge/yabridge.SlackBuild b/audio/yabridge/yabridge.SlackBuild index 0bde50812e..d30c5f574f 100644 --- a/audio/yabridge/yabridge.SlackBuild +++ b/audio/yabridge/yabridge.SlackBuild @@ -22,17 +22,17 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -cd $(dirname $0) || exit 1 ; CWD=$(pwd) +cd "$(dirname "$0")" || exit 1 ; CWD=$(pwd) PRGNAM=yabridge -VERSION=${VERSION:-5.1.0} -BUILD=${BUILD:-3} +VERSION=${VERSION:-5.1.1} +BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} ARG_CLAP=${ARG_CLAP:-NO} ARG_VST3=${ARG_VST3:-YES} ARG_WINEDBG=${ARG_WINEDBG:-NO} -#false/true + if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; @@ -64,12 +64,12 @@ fi # If the variable PRINT_PACKAGE_NAME is set, then this script will report what # the name of the created package would be, and then exit. This information # could be useful to other scripts. -if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then +if [ -n "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi -if [ $ARCH = "arm" ]; then +if [ "$ARCH" = "arm" ]; then echo "This script only supports x86 for now but Slackware ARM and ARM64 is happening FIXME" exit 1 fi @@ -81,13 +81,13 @@ WINE64_IN_PATH=$? if [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]; then LIBDIRSUFFIX="" - if (($WINE_IN_PATH)); then + if ((WINE_IN_PATH)); then echo "This script look for wine in PATH and needs it for compiling and using yabridge on i586" exit 1 fi -elif [ $ARCH = "x86_64" ]; then +elif [ "$ARCH" = "x86_64" ]; then LIBDIRSUFFIX="64" - if (($WINE_IN_PATH)) || (($WINE64_IN_PATH)); then + if ((WINE_IN_PATH)) || ((WINE64_IN_PATH)); then echo "This script look for wine and wine64 in PATH and needs them both for compiling and using yabridge on x86_64" exit 1 fi @@ -106,14 +106,14 @@ OUTPUT=${OUTPUT:-/tmp} set -e -rm -rf $PKG -mkdir -p $TMP $PKG $OUTPUT -cd $TMP -rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz -cd $PRGNAM-$VERSION +rm -rf "$PKG" +mkdir -p "$TMP" "$PKG" "$OUTPUT" +cd "$TMP" +rm -rf "$PRGNAM-$VERSION" +tar xvf "$CWD/$PRGNAM-$VERSION.tar.gz" +cd "$PRGNAM-$VERSION" echo -e "\Unpacking documentation, cargo dependencies and vstsdk meson.build" -tar xvf $CWD/yabridge-html-docs-plus-build-files-$VERSION.tar.gz +tar xvf "$CWD/yabridge-docs-plus-build-$VERSION.tar.gz" chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -121,15 +121,14 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -patch -p1 < $CWD/fix-libdbus-connection.patch +patch -p1 < "$CWD/load_posix_spawn_addclosefrom_np.diff" +patch -p1 < "$CWD/fix_change_path.diff" #Build only capitalized sed -i "s|bitsery_dep = dependency('bitsery', version : '>=5.2.0')|bitsery_dep = dependency('Bitsery', version : '>=5.2.0')|g" meson.build sed -i "s|bitsery_dep = dependency('bitsery', 'Bitsery', version : '>=5.2.0')|bitsery_dep = dependency('Bitsery', version : '>=5.2.0')|g" meson.build -mkdir subprojects/vst3 -tar xvzf $CWD/vst3sdk-3.7.7.tar.gz --strip-components=1 -C subprojects/vst3 -cp yabridge-html-docs-plus-build-files-$VERSION/meson.build subprojects/vst3 +mv yabridge-docs-plus-build/vst3sdk subprojects/vst3 if [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]; then meson setup \ @@ -180,7 +179,7 @@ cd ./tools/yabridgectl # This makes cargo target the locale identical copy of reflink in vendor source directory sed -i 's|{ git = "https://github.com/nicokoch/reflink", rev = "e8d93b465f5d9ad340cd052b64bbc77b8ee107e2" }|"0.1.3"|g' Cargo.toml sed -i 's|git+https://github.com/nicokoch/reflink?rev=e8d93b465f5d9ad340cd052b64bbc77b8ee107e2#e8d93b465f5d9ad340cd052b64bbc77b8ee107e2|registry+https://github.com/rust-lang/crates.io-index|g' Cargo.lock -CARGO_HOME=../../yabridge-html-docs-plus-build-files-$VERSION/cargo/CARGO_HOME cargo build --release --locked --all-features --offline --target-dir=target +CARGO_HOME=../../yabridge-docs-plus-build/cargo/CARGO_HOME cargo build --release --locked --all-features --offline --target-dir=target cd ../../build @@ -218,22 +217,22 @@ install ../tools/yabridgectl/target/release/yabridgectl "$PKG/usr/bin" cd .. -find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ +find "$PKG" -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p "$PKG/usr/doc/$PRGNAM-$VERSION" cp -a \ README.md \ docs/architecture.md \ COPYING \ CHANGELOG.md \ - $PKG/usr/doc/$PRGNAM-$VERSION -cp tools/yabridgectl/README.md $PKG/usr/doc/$PRGNAM-$VERSION/README-yabridgectl.md -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild -cp -a yabridge-html-docs-plus-build-files-$VERSION/html/* $PKG/usr/doc/$PRGNAM-$VERSION + "$PKG/usr/doc/$PRGNAM-$VERSION" +cp tools/yabridgectl/README.md "$PKG/usr/doc/$PRGNAM-$VERSION/README-yabridgectl.md" +cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild" +cp -a yabridge-docs-plus-build/html/* "$PKG/usr/doc/$PRGNAM-$VERSION" -mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +mkdir -p "$PKG/install" +cat "$CWD/slack-desc" > "$PKG/install/slack-desc" -cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE +cd "$PKG" +/sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" diff --git a/audio/yabridge/yabridge.info b/audio/yabridge/yabridge.info index f449cb7d4a..8fcf797f28 100644 --- a/audio/yabridge/yabridge.info +++ b/audio/yabridge/yabridge.info @@ -1,12 +1,10 @@ PRGNAM="yabridge" -VERSION="5.1.0" +VERSION="5.1.1" HOMEPAGE="https://github.com/robbert-vdh/yabridge" -DOWNLOAD="https://github.com/robbert-vdh/yabridge/archive/5.1.0/yabridge-5.1.0.tar.gz \ - https://github.com/noisecode3/vst3sdk/archive/3.7.7/vst3sdk-3.7.7.tar.gz \ - https://github.com/noisecode3/yabridge-html-docs-plus-build-files/archive/v5.1.0/yabridge-html-docs-plus-build-files-5.1.0.tar.gz" -MD5SUM="2383d67c9089a4fda8ae311baaa8fe3b \ - f9e2185ea8cdfbdc4d99c4a5f5e4d426 \ - a58876a05ac16ada09f750a4b8564443" +DOWNLOAD="https://github.com/robbert-vdh/yabridge/archive/5.1.1/yabridge-5.1.1.tar.gz \ + https://github.com/noisecode3/yabridge-docs-plus-build/releases/download/v5.1.1/yabridge-docs-plus-build-5.1.1.tar.gz" +MD5SUM="94c80f969690c138a1e9f85552f24ce7 \ + ad022ccdfad9b7e58e1ab55da1ef7a30" DOWNLOAD_x86_64="UNSUPPORTED" MD5SUM_x86_64="" REQUIRES="wine-staging asio bitsery function2 ghc_filesystem tomlplusplus rust-opt" |