From 1e0bcdcdf3da478113490bc0b8e302936e5e9c9d Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Mon, 2 Nov 2020 13:35:50 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/libvirt.git#7eef88add4af32ea98ecdd40e5aa8f9634868185 --- ...x-lstat-mock-initialization-on-macOS.patch | 30 +++ ...-introduce-stat-lstat-mocks-on-macOS.patch | 61 ++++++ ...fix-stat-mocking-with-Fedora-rawhide.patch | 191 ++++++++++++++++++ libvirt.spec | 67 +++--- 4 files changed, 323 insertions(+), 26 deletions(-) create mode 100644 0002-tests-Fix-lstat-mock-initialization-on-macOS.patch create mode 100644 0003-tests-Re-introduce-stat-lstat-mocks-on-macOS.patch create mode 100644 0004-tests-fix-stat-mocking-with-Fedora-rawhide.patch diff --git a/0002-tests-Fix-lstat-mock-initialization-on-macOS.patch b/0002-tests-Fix-lstat-mock-initialization-on-macOS.patch new file mode 100644 index 0000000..3c14f30 --- /dev/null +++ b/0002-tests-Fix-lstat-mock-initialization-on-macOS.patch @@ -0,0 +1,30 @@ +From 2c51432376f0ff3743633fd655756260b88313ff Mon Sep 17 00:00:00 2001 +From: Roman Bolshakov +Date: Sun, 18 Oct 2020 18:30:56 +0300 +Subject: [PATCH 1/3] tests: Fix lstat() mock initialization on macOS + +There is a typo that prevents initialization of real_lstat. + +Fixes: d6b17edd5163 ("tests: Lookup extended stat/lstat in mocks") +Signed-off-by: Roman Bolshakov +Reviewed-by: Michal Privoznik +--- + tests/virmockstathelpers.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c +index 1a58025a0a..90b9ceedb6 100644 +--- a/tests/virmockstathelpers.c ++++ b/tests/virmockstathelpers.c +@@ -153,7 +153,7 @@ static void virMockStatInit(void) + #endif + #ifdef MOCK_LSTAT + # ifdef __APPLE__ +- VIR_MOCK_REAL_INIT_ALIASED(stat, "lstat$INODE64"); ++ VIR_MOCK_REAL_INIT_ALIASED(lstat, "lstat$INODE64"); + # else + VIR_MOCK_REAL_INIT(lstat); + # endif +-- +2.28.0 + diff --git a/0003-tests-Re-introduce-stat-lstat-mocks-on-macOS.patch b/0003-tests-Re-introduce-stat-lstat-mocks-on-macOS.patch new file mode 100644 index 0000000..33f0b1a --- /dev/null +++ b/0003-tests-Re-introduce-stat-lstat-mocks-on-macOS.patch @@ -0,0 +1,61 @@ +From c46299170bd318bc1ffc95da1774515634fd03d9 Mon Sep 17 00:00:00 2001 +From: Roman Bolshakov +Date: Sun, 18 Oct 2020 18:30:57 +0300 +Subject: [PATCH 2/3] tests: Re-introduce stat/lstat mocks on macOS + +Commit d6b17edd5163 ("tests: Lookup extended stat/lstat in mocks") +adds support for mocking of stat() and lstat() on macOS. + +The change was broken because virmockstathelpers.c only follows glibc +logic and MOCK_STAT and MOCK_LSTAT are not getting defined on macOS. + +Signed-off-by: Roman Bolshakov +Reviewed-by: Michal Privoznik +--- + tests/virmockstathelpers.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c +index 90b9ceedb6..5a71de24e9 100644 +--- a/tests/virmockstathelpers.c ++++ b/tests/virmockstathelpers.c +@@ -55,6 +55,10 @@ + * Unfortunately, because we are trying to mock replace the C library, + * we need to know about this internal impl detail. + * ++ * On macOS stat() and lstat() are resolved to _stat$INODE64 and ++ * _lstat$INODE64, respectively. stat(2) man page also declares that ++ * stat64(), lstat64() and fstat64() are deprecated. ++ * + * With all this in mind the list of functions we have to mock will depend + * on several factors + * +@@ -68,8 +72,10 @@ + + + +-#if defined(WITH_STAT) && !defined(WITH___XSTAT) && !defined(WITH_STAT64) +-# define MOCK_STAT ++#if defined(WITH_STAT) ++# if !defined(WITH___XSTAT) && !defined(WITH_STAT64) || defined(__APPLE__) ++# define MOCK_STAT ++# endif + #endif + #if defined(WITH_STAT64) && !defined(WITH___XSTAT64) + # define MOCK_STAT64 +@@ -80,8 +86,10 @@ + #if defined(WITH___XSTAT64) + # define MOCK___XSTAT64 + #endif +-#if defined(WITH_LSTAT) && !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64) +-# define MOCK_LSTAT ++#if defined(WITH_LSTAT) ++# if !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64) || defined(__APPLE__) ++# define MOCK_LSTAT ++# endif + #endif + #if defined(WITH_LSTAT64) && !defined(WITH___LXSTAT64) + # define MOCK_LSTAT64 +-- +2.28.0 + diff --git a/0004-tests-fix-stat-mocking-with-Fedora-rawhide.patch b/0004-tests-fix-stat-mocking-with-Fedora-rawhide.patch new file mode 100644 index 0000000..8491165 --- /dev/null +++ b/0004-tests-fix-stat-mocking-with-Fedora-rawhide.patch @@ -0,0 +1,191 @@ +From 2b93bcc7e84dfae34b16fd687b8c3d35fa0c54be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Thu, 29 Oct 2020 17:25:07 +0000 +Subject: [PATCH 3/3] tests: fix stat mocking with Fedora rawhide +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GLibC has a really complicated way of dealing with the 'stat' function +historically, which means our mocks in turn have to look at four +different possible functions to replace, stat, stat64, __xstat, +__xstat64. + +In Fedora 33 and earlier: + + - libvirt.so links to __xstat64 + - libc.so library exports stat, stat64, __xstat, __xstat64 + - sys/stat.h header exposes stat and __xstat + +In Fedora 34 rawhide: + + - libvirt.so links to stat64 + - libc.so library exports stat, stat64, __xstat, __xstat64 + - sys/stat.h header exposes stat + +Historically we only looked at the exported symbols from libc.so to +decide which to mock. + +In F34 though we must not consider __xstat / __xstat64 though because +they only existance for binary compatibility. Newly built binaries +won't reference them. + +Thus we must introduce a header file check into our logic for deciding +which symbol to mock. We must ignore the __xstat / __xstat64 symbols +if they don't appear in the sys/stat.h header, even if they appear +in libc.so + +Signed-off-by: Daniel P. Berrangé +Reviewed-by: Michal Privoznik +--- + meson.build | 28 ++++++++++++----- + tests/virmockstathelpers.c | 62 ++++++++++++++++++++++---------------- + 2 files changed, 56 insertions(+), 34 deletions(-) + +diff --git a/meson.build b/meson.build +index 2e57a435df..87b4aaf9aa 100644 +--- a/meson.build ++++ b/meson.build +@@ -636,10 +636,6 @@ libvirt_export_dynamic = cc.first_supported_link_argument([ + # check availability of various common functions (non-fatal if missing) + + functions = [ +- '__lxstat', +- '__lxstat64', +- '__xstat', +- '__xstat64', + 'elf_aux_info', + 'fallocate', + 'getauxval', +@@ -653,8 +649,6 @@ functions = [ + 'getuid', + 'getutxid', + 'if_indextoname', +- 'lstat', +- 'lstat64', + 'mmap', + 'newlocale', + 'pipe2', +@@ -666,12 +660,23 @@ functions = [ + 'setgroups', + 'setns', + 'setrlimit', +- 'stat', +- 'stat64', + 'symlink', + 'sysctlbyname', + ] + ++stat_functions = [ ++ '__lxstat', ++ '__lxstat64', ++ '__xstat', ++ '__xstat64', ++ 'lstat', ++ 'lstat64', ++ 'stat', ++ 'stat64', ++] ++ ++functions += stat_functions ++ + foreach function : functions + if cc.has_function(function) + conf.set('WITH_@0@'.format(function.to_upper()), 1) +@@ -679,6 +684,13 @@ foreach function : functions + endforeach + + ++foreach function : stat_functions ++ if cc.has_header_symbol('sys/stat.h', function) ++ conf.set('WITH_@0@_DECL'.format(function.to_upper()), 1) ++ endif ++endforeach ++ ++ + # various header checks + + headers = [ +diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c +index 5a71de24e9..ebe357aa49 100644 +--- a/tests/virmockstathelpers.c ++++ b/tests/virmockstathelpers.c +@@ -67,39 +67,49 @@ + * - If __xstat & __xstat64 exist, then stat & stat64 will not exist + * as symbols in the library, so the latter should not be mocked. + * ++ * - If __xstat exists in the library, but not the header than it ++ * it is just there for binary back compat and should not be ++ * mocked ++ * + * The same all applies to lstat() + */ + + ++#if !defined(WITH___XSTAT_DECL) ++# if defined(WITH_STAT) ++# if !defined(WITH___XSTAT) && !defined(WITH_STAT64) || defined(__APPLE__) ++# define MOCK_STAT ++# endif ++# endif ++# if defined(WITH_STAT64) ++# define MOCK_STAT64 ++# endif ++#else /* WITH___XSTAT_DECL */ ++# if defined(WITH___XSTAT) && !defined(WITH___XSTAT64) ++# define MOCK___XSTAT ++# endif ++# if defined(WITH___XSTAT64) ++# define MOCK___XSTAT64 ++# endif ++#endif /* WITH___XSTAT_DECL */ + +-#if defined(WITH_STAT) +-# if !defined(WITH___XSTAT) && !defined(WITH_STAT64) || defined(__APPLE__) +-# define MOCK_STAT ++#if !defined(WITH___LXSTAT_DECL) ++# if defined(WITH_LSTAT) ++# if !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64) || defined(__APPLE__) ++# define MOCK_LSTAT ++# endif + # endif +-#endif +-#if defined(WITH_STAT64) && !defined(WITH___XSTAT64) +-# define MOCK_STAT64 +-#endif +-#if defined(WITH___XSTAT) && !defined(WITH___XSTAT64) +-# define MOCK___XSTAT +-#endif +-#if defined(WITH___XSTAT64) +-# define MOCK___XSTAT64 +-#endif +-#if defined(WITH_LSTAT) +-# if !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64) || defined(__APPLE__) +-# define MOCK_LSTAT ++# if defined(WITH_LSTAT64) ++# define MOCK_LSTAT64 + # endif +-#endif +-#if defined(WITH_LSTAT64) && !defined(WITH___LXSTAT64) +-# define MOCK_LSTAT64 +-#endif +-#if defined(WITH___LXSTAT) && !defined(WITH___LXSTAT64) +-# define MOCK___LXSTAT +-#endif +-#if defined(WITH___LXSTAT64) +-# define MOCK___LXSTAT64 +-#endif ++#else /* WITH___LXSTAT_DECL */ ++# if defined(WITH___LXSTAT) && !defined(WITH___LXSTAT64) ++# define MOCK___LXSTAT ++# endif ++# if defined(WITH___LXSTAT64) ++# define MOCK___LXSTAT64 ++# endif ++#endif /* WITH___LXSTAT_DECL */ + + #ifdef MOCK_STAT + static int (*real_stat)(const char *path, struct stat *sb); +-- +2.28.0 + diff --git a/libvirt.spec b/libvirt.spec index b85ed37..55b693c 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -93,7 +93,6 @@ %define with_libssh2 0%{!?_without_libssh2:0} %define with_wireshark 0%{!?_without_wireshark:0} %define with_libssh 0%{!?_without_libssh:0} -%define with_bash_completion 0%{!?_without_bash_completion:0} # Finally set the OS / architecture specific special cases @@ -177,8 +176,6 @@ %define with_libssh 0%{!?_without_libssh:1} %endif -%define with_bash_completion 0%{!?_without_bash_completion:1} - %if %{with_qemu} || %{with_lxc} # numad is used to manage the CPU and memory placement dynamically, # it's not available on many non-x86 architectures. @@ -211,7 +208,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.8.0 -Release: 1%{?dist} +Release: 5%{?dist} License: LGPLv2+ URL: https://libvirt.org/ @@ -221,6 +218,10 @@ URL: https://libvirt.org/ Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz # Fix glib errors in virsystemdtest Patch0001: 0001-tests-fix-incorrect-free-of-GVariant-in-our-GLib-moc.patch +# Fix glibc incompatibility in stat() mocking +Patch0002: 0002-tests-Fix-lstat-mock-initialization-on-macOS.patch +Patch0003: 0003-tests-Re-introduce-stat-lstat-mocks-on-macOS.patch +Patch0004: 0004-tests-fix-stat-mocking-with-Fedora-rawhide.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -277,9 +278,7 @@ BuildRequires: glib2-devel >= 2.48 BuildRequires: libxml2-devel BuildRequires: libxslt BuildRequires: readline-devel -%if %{with_bash_completion} BuildRequires: bash-completion >= 2.0 -%endif BuildRequires: gettext BuildRequires: libtasn1-devel BuildRequires: gnutls-devel @@ -894,9 +893,7 @@ Requires: %{name}-libs = %{version}-%{release} Requires: gettext # Needed by virt-pki-validate script. Requires: gnutls-utils -%if %{with_bash_completion} Requires: %{name}-bash-completion = %{version}-%{release} -%endif %description client The client binaries needed to access the virtualization @@ -916,20 +913,16 @@ Shared libraries for accessing the libvirt daemon. %package admin Summary: Set of tools to control libvirt daemon Requires: %{name}-libs = %{version}-%{release} -%if %{with_bash_completion} Requires: %{name}-bash-completion = %{version}-%{release} -%endif %description admin The client side utilities to control the libvirt daemon. -%if %{with_bash_completion} %package bash-completion Summary: Bash completion script %description bash-completion Bash completion script stub. -%endif %if %{with_wireshark} %package wireshark @@ -1025,15 +1018,15 @@ exit 1 %endif %if %{with_esx} - %define arg_esx -Ddriver_esx=enabled + %define arg_esx -Ddriver_esx=enabled -Dcurl=enabled %else - %define arg_esx -Ddriver_esx=disabled + %define arg_esx -Ddriver_esx=disabled -Dcurl=disabled %endif %if %{with_hyperv} - %define arg_hyperv -Ddriver_hyperv=enabled + %define arg_hyperv -Ddriver_hyperv=enabled -Dopenwsman=enabled %else - %define arg_hyperv -Ddriver_hyperv=disabled + %define arg_hyperv -Ddriver_hyperv=disabled -Dopenwsman=disabled %endif %if %{with_vmware} @@ -1055,9 +1048,9 @@ exit 1 %endif %if %{with_storage_gluster} - %define arg_storage_gluster -Dstorage_gluster=enabled + %define arg_storage_gluster -Dstorage_gluster=enabled -Dglusterfs=enabled %else - %define arg_storage_gluster -Dstorage_gluster=disabled + %define arg_storage_gluster -Dstorage_gluster=disabled -Dglusterfs=disabled %endif %if %{with_storage_zfs} @@ -1109,9 +1102,21 @@ exit 1 %endif %if %{with_storage_iscsi_direct} - %define arg_storage_iscsi_direct -Dstorage_iscsi_direct=enabled + %define arg_storage_iscsi_direct -Dstorage_iscsi_direct=enabled -Dlibiscsi=enabled %else - %define arg_storage_iscsi_direct -Dstorage_iscsi_direct=disabled + %define arg_storage_iscsi_direct -Dstorage_iscsi_direct=disabled -Dlibiscsi=disabled +%endif + +%if %{with_libssh} + %define arg_libssh -Dlibssh=enabled +%else + %define arg_libssh -Dlibssh=disabled +%endif + +%if %{with_libssh2} + %define arg_libssh2 -Dlibssh2=enabled +%else + %define arg_libssh2 -Dlibssh2=disabled %endif %define when %(date +"%%F-%%T") @@ -1175,6 +1180,8 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec) %{?arg_firewalld} \ %{?arg_firewalld_zone} \ %{?arg_wireshark} \ + %{?arg_libssh} \ + %{?arg_libssh2} \ -Dpm_utils=disabled \ -Dnss=enabled \ %{arg_packager} \ @@ -1848,9 +1855,7 @@ exit 0 %{_datadir}/systemtap/tapset/libvirt_qemu_probes*.stp %endif -%if %{with_bash_completion} %{_datadir}/bash-completion/completions/virsh -%endif %{_unitdir}/libvirt-guests.service @@ -1899,14 +1904,10 @@ exit 0 %files admin %{_mandir}/man1/virt-admin.1* %{_bindir}/virt-admin -%if %{with_bash_completion} %{_datadir}/bash-completion/completions/virt-admin -%endif -%if %{with_bash_completion} %files bash-completion %{_datadir}/bash-completion/completions/vsh -%endif %if %{with_wireshark} %files wireshark @@ -1962,6 +1963,20 @@ exit 0 %changelog +* Mon Nov 2 2020 Daniel P. Berrangé - 6.8.0-4 +- Really fix meson option for disabling glusterfs +- Fix disabling curl, openswman and libiscsi + +* Mon Nov 2 2020 Daniel P. Berrangé - 6.8.0-4 +- Fix name of meson option for disabling glusterfs + +* Fri Oct 30 2020 Daniel P. Berrangé - 6.8.0-3 +- Fix stat() mocking for new glibc + +* Wed Oct 28 2020 Daniel P. Berrangé - 6.8.0-2 +- Remove obsolete bash_completion conditional +- Pass args to meson based on with_libssh/with_libssh2 + * Thu Oct 01 2020 Cole Robinson - 6.8.0-1 - Update to version 6.8.0