Accepting request 1157146 from home:alarrosa:branches:multimedia:libs

- Replace the quick fix for boo#1221150 with the version submitted
  to upstream at
  https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6322:
  * 0001-Canonicalize-the-library-path-returned-by-dladdr.patch
- Remove previous version of the fix for boo#1221150:
  * force-find-gst-plugin-scanner.patch
- Fix sed command to set the gst-plugin-scanner suffix correctly
- Add preventive checks for the sed commands that set the binary
  suffix so that they don't silently fail anymore.

- Add patch from upstream to not install ptp-helper test executable
  * 0001-ptp-Dont-install-test-executable.patch

OBS-URL: https://build.opensuse.org/request/show/1157146
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/gstreamer?expand=0&rev=218
This commit is contained in:
Takashi Iwai 2024-03-12 10:36:45 +00:00 committed by Git OBS Bridge
parent 97335be138
commit ffc78b5361
5 changed files with 159 additions and 80 deletions

View File

@ -0,0 +1,102 @@
From 8d17e447da1bb2b55186b24d6aa217551e2ea9a4 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <alarrosa@suse.com>
Date: Mon, 11 Mar 2024 15:10:25 +0100
Subject: [PATCH] Canonicalize the library path returned by dladdr
On systems using UsrMerge (like openSUSE or Fedora), /lib64 is
a symlink to /usr/lib64. So dladdr is returning the path to
the gstreamer library in /lib64 in priv_gst_get_relocated_libgstreamer.
Later gst_plugin_loader_spawn tries to build the path to the
gst-plugin-scanner helper from /lib64 and ends up trying to use
/lib64/../libexec/gstreamer-1.0/gst-plugin-scanner which doesn't exist.
By canonicalizing the path with a call to realpath, gst-plugin-scanner
is found correctly under
/usr/lib64/../libexec/gstreamer-1.0/gst-plugin-scanner
Similar change applied to gstreamer/libs/gst/net/gstptpclock.c
---
subprojects/gstreamer/gst/gstregistry.c | 21 ++++++++++++++++++-
.../gstreamer/libs/gst/net/gstptpclock.c | 20 +++++++++++++++++-
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/gst/gstregistry.c b/gst/gstregistry.c
index c84de1d7f62..191d101e5ea 100644
--- a/gst/gstregistry.c
+++ b/gst/gstregistry.c
@@ -1599,6 +1599,8 @@ priv_gst_get_relocated_libgstreamer (void)
#elif defined(HAVE_DLADDR)
{
Dl_info info;
+ char *real_fname = NULL;
+ long path_max = 0;
GST_DEBUG ("attempting to retrieve libgstreamer-1.0 location using "
"dladdr()");
@@ -1610,7 +1612,24 @@ priv_gst_get_relocated_libgstreamer (void)
return NULL;
}
- dir = g_path_get_dirname (info.dli_fname);
+#ifdef PATH_MAX
+ path_max = PATH_MAX;
+#else
+ path_max = pathconf (info.dli_fname, _PC_PATH_MAX);
+ if (path_max <= 0)
+ path_max = 4096;
+#endif
+
+ real_fname = g_malloc (path_max);
+ if (realpath (info.dli_fname, real_fname)) {
+ dir = g_path_get_dirname (real_fname);
+ GST_DEBUG ("real directory location: %s", dir);
+ } else {
+ GST_ERROR ("could not canonicalize path %s: %s", info.dli_fname, g_strerror (errno));
+ dir = g_path_get_dirname (info.dli_fname);
+ }
+ g_free (real_fname);
+
} else {
GST_LOG ("dladdr() failed");
return NULL;
diff --git a/libs/gst/net/gstptpclock.c b/libs/gst/net/gstptpclock.c
index 0b69eb61cf2..c43b5d1e8a6 100644
--- a/libs/gst/net/gstptpclock.c
+++ b/libs/gst/net/gstptpclock.c
@@ -2569,6 +2569,8 @@ get_relocated_libgstnet (void)
#elif defined(HAVE_DLADDR)
{
Dl_info info;
+ char * real_fname = NULL;
+ long path_max = 0;
GST_DEBUG ("attempting to retrieve libgstnet-1.0 location using "
"dladdr()");
@@ -2580,7 +2582,23 @@ get_relocated_libgstnet (void)
return NULL;
}
- dir = g_path_get_dirname (info.dli_fname);
+#ifdef PATH_MAX
+ path_max = PATH_MAX;
+#else
+ path_max = pathconf (info.dli_fname, _PC_PATH_MAX);
+ if (path_max <= 0)
+ path_max = 4096;
+#endif
+ real_fname = g_malloc (path_max);
+ if (realpath (info.dli_fname, real_fname)) {
+ dir = g_path_get_dirname (real_fname);
+ GST_DEBUG ("real directory location: %s", dir);
+ } else {
+ GST_ERROR ("could not canonicalize path %s: %s", info.dli_fname, g_strerror (errno));
+ dir = g_path_get_dirname (info.dli_fname);
+ }
+ g_free (real_fname);
+
} else {
GST_LOG ("dladdr() failed");
return NULL;
--
GitLab

View File

@ -0,0 +1,30 @@
From 8859f257c2e4468875665d8782812b83f8ca741f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
Date: Tue, 5 Mar 2024 15:10:45 +0200
Subject: [PATCH] ptp: Don't install test executable
And handle it like all our other test executables.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6262>
---
subprojects/gstreamer/libs/gst/helpers/ptp/meson.build | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libs/gst/helpers/ptp/meson.build b/subprojects/gstreamer/libs/gst/helpers/ptp/meson.build
index 55f1c6a106e..e12ca3fe73d 100644
--- a/libs/gst/helpers/ptp/meson.build
+++ b/libs/gst/helpers/ptp/meson.build
@@ -112,9 +112,7 @@ exe_test = executable('gst-ptp-helper-test', 'main.rs',
override_options : ['rust_std=2018'],
rust_args : ['--test', rust_args],
dependencies : [cap_dep],
- link_with : conf,
- install_dir : helpers_install_dir,
- install : true)
+ link_with : conf)
test('gst-ptp-helper-test', exe_test, protocol : 'rust')
--
GitLab

View File

@ -1,76 +0,0 @@
From: Antonio Larrosa <alarrosa@suse.com>
Subject: Force using GST_PLUGIN_SCANNER_INSTALLED
The check for a relocated libgstreamer thinks libgstreamer is in
/lib64/libgstreamer-1.0.so which uses the /lib64 symlink to the
install location at /usr/lib64/libgstreamer-1.0.so so it thinks
the library was relocated and thus tries to construct the path to
gst-plugin-scanner-x86_64 from /lib64 which doesn't work.
This patch removes the failing test for a relocated libgstreamer
and just uses the standard installed location which is set at
build time to /usr/libexec/gstreamer-1.0/gst-plugin-scanner-x86_64.
If needed, this path can be overriden as usual with the
GST_PLUGIN_SCANNER environment variable.
Index: gstreamer-1.24.0/gst/gstpluginloader.c
===================================================================
--- gstreamer-1.24.0.orig/gst/gstpluginloader.c
+++ gstreamer-1.24.0/gst/gstpluginloader.c
@@ -472,46 +472,12 @@ gst_plugin_loader_spawn (GstPluginLoader
res = gst_plugin_loader_try_helper (loader, helper_bin);
g_free (helper_bin);
} else {
- char *relocated_libgstreamer;
-
/* use the installed version */
GST_LOG ("Trying installed plugin scanner");
#define MAX_PATH_DEPTH 64
- relocated_libgstreamer = priv_gst_get_relocated_libgstreamer ();
- if (relocated_libgstreamer) {
- int plugin_subdir_depth = priv_gst_count_directories (GST_PLUGIN_SUBDIR);
-
- GST_DEBUG ("found libgstreamer-" GST_API_VERSION " library "
- "at %s", relocated_libgstreamer);
-
- if (plugin_subdir_depth < MAX_PATH_DEPTH) {
- const char *filenamev[MAX_PATH_DEPTH + 5];
- int i = 0, j;
-
- filenamev[i++] = relocated_libgstreamer;
- for (j = 0; j < plugin_subdir_depth; j++)
- filenamev[i++] = "..";
- filenamev[i++] = GST_PLUGIN_SCANNER_SUBDIR;
- filenamev[i++] = "gstreamer-" GST_API_VERSION;
- filenamev[i++] = "gst-plugin-scanner";
- filenamev[i++] = NULL;
- g_assert (i <= MAX_PATH_DEPTH + 5);
-
- GST_DEBUG ("constructing path to system plugin scanner using "
- "plugin dir: \'%s\', plugin scanner dir: \'%s\'",
- GST_PLUGIN_SUBDIR, GST_PLUGIN_SCANNER_SUBDIR);
-
- helper_bin = g_build_filenamev ((char **) filenamev);
- } else {
- GST_WARNING ("GST_PLUGIN_SUBDIR: \'%s\' has too many path segments",
- GST_PLUGIN_SUBDIR);
- helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED);
- }
- } else {
- helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED);
- }
+ helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED);
#undef MAX_PATH_DEPTH
@@ -519,7 +485,6 @@ gst_plugin_loader_spawn (GstPluginLoader
res = gst_plugin_loader_try_helper (loader, helper_bin);
g_free (helper_bin);
- g_free (relocated_libgstreamer);
}
if (!res) {

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Tue Mar 12 09:16:23 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>
- Replace the quick fix for boo#1221150 with the version submitted
to upstream at
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6322:
* 0001-Canonicalize-the-library-path-returned-by-dladdr.patch
- Remove previous version of the fix for boo#1221150:
* force-find-gst-plugin-scanner.patch
- Fix sed command to set the gst-plugin-scanner suffix correctly
- Add preventive checks for the sed commands that set the binary
suffix so that they don't silently fail anymore.
-------------------------------------------------------------------
Mon Mar 11 13:55:53 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>
- Add patch from upstream to not install ptp-helper test executable
* 0001-ptp-Dont-install-test-executable.patch
-------------------------------------------------------------------
Mon Mar 11 07:55:04 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -34,8 +34,10 @@ Source99: baselibs.conf
Patch1: gstreamer-rpm-prov.patch
# PATCH-FIX-OPENSUSE gstreamer-pie.patch mgorse@suse.com -- create position-independent executables.
Patch2: gstreamer-pie.patch
# PATCH-FIX-OPENSUSE force-find-gst-plugin-scanner.patch alarrosa@suse.com -- Part of the fix for boo#1221150
Patch3: force-find-gst-plugin-scanner.patch
# PATCH-FIX-UPSTREAM 0001-Canonicalize-the-library-path-returned-by-dladdr.patch alarrosa@suse.com -- (boo#1221150) https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6322
Patch3: 0001-Canonicalize-the-library-path-returned-by-dladdr.patch
# PATCH-FIX-UPSTREAM
Patch4: 0001-ptp-Dont-install-test-executable.patch
BuildRequires: bison >= 2.4
@ -142,8 +144,11 @@ sed -i -e '1{s,^#!/usr/bin/env python3,#!%{_bindir}/python3,}' docs/gst-plugins-
%build
export PYTHON=%{_bindir}/python3
sed -i "s/'gst-plugin-scanner': /'gst-plugin-scanner-%{_target_cpu}': /" libs/gst/helpers/meson.build
grep "'gst-plugin-scanner-%{_target_cpu}': " libs/gst/helpers/meson.build || (echo "Couldn't set executable suffix in libs/gst/helpers/meson.build" ; exit 1)
sed -i "s/'gst-plugin-scanner'/'gst-plugin-scanner-%{_target_cpu}'/" meson.build
sed -i 's/^#define EXESUFFIX$/#define EXESUFFIX "-%{_target_cpu}"/' gst/gstpluginloader.c
grep "'gst-plugin-scanner-%{_target_cpu}'" meson.build || (echo "Couldn't set executable suffix in meson.build" ; exit 1)
sed -i 's/"gst-plugin-scanner"/"gst-plugin-scanner-%{_target_cpu}"/' gst/gstpluginloader.c
grep '"gst-plugin-scanner-%{_target_cpu}"' gst/gstpluginloader.c || (echo "Couldn't set executable suffix in gst/gstpluginloader.c" ; exit 1)
# TODO: enable dbghelp
%meson \
-Dptp-helper-permissions=capabilities \
@ -232,7 +237,6 @@ install -m755 -D %{SOURCE2} %{buildroot}%{_rpmconfigdir}/gstreamer-provides
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_libexecdir}/gstreamer-%{gst_branch}/gst-plugins-doc-cache-generator
%{_libexecdir}/gstreamer-%{gst_branch}/gst-ptp-helper-test
%{_rpmconfigdir}/gstreamer-provides
%{_fileattrsdir}/gstreamer.attr
%{_datadir}/gir-1.0/*.gir