From dd864e875f2933272008ccc19858f897df19bba2 Mon Sep 17 00:00:00 2001 From: Mateusz Malisz Date: Fri, 27 Jan 2023 17:37:39 -0800 Subject: [PATCH] Fix calamares bugs and update requires (#4713) * Fix calamares bugs and update requires * Add short explanation for the patch fixes * Reword comment, trigger github checks --- SPECS/calamares/calamares.spec | 27 ++++++++++-- .../calamares/install-progress-bar-fix.patch | 12 ++++++ SPECS/calamares/serialize-read-access.patch | 43 +++++++++++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 SPECS/calamares/install-progress-bar-fix.patch create mode 100644 SPECS/calamares/serialize-read-access.patch diff --git a/SPECS/calamares/calamares.spec b/SPECS/calamares/calamares.spec index 34b8adc298..1fd2857f49 100644 --- a/SPECS/calamares/calamares.spec +++ b/SPECS/calamares/calamares.spec @@ -7,7 +7,7 @@ Summary: Installer from a live CD/DVD/USB to disk # https://github.com/calamares/calamares/issues/1051 Name: calamares Version: 3.2.11 -Release: 39%{?dist} +Release: 40%{?dist} License: GPLv3+ Vendor: Microsoft Corporation Distribution: Mariner @@ -48,6 +48,14 @@ Patch0: calamares-3.2.11-default-settings.patch Patch1: use-single-job-for-progress-bar-value.patch Patch2: navigation-buttons-autodefault.patch Patch3: round-to-full-disk-size.patch +# Due to a race condition, Calamares would crash intermittently when switching +# partitioning method or encryption password. Patch4 fixes that bug. +Patch4: serialize-read-access.patch +# Progress bar would expect a non-false return from a pooled thread, assuming +# such result means a critical error. However, depending on timing +# the process might return false since it already exited. Patch5 fixes that bug. +Patch5: install-progress-bar-fix.patch + # Compilation tools BuildRequires: cmake BuildRequires: extra-cmake-modules @@ -81,6 +89,12 @@ BuildRequires: yaml-cpp-devel >= 0.5.1 Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: coreutils Requires: efibootmgr +# Partition manipulation +Requires: util-linux +# LVM / encrypted disk setup +Requires: cryptsetup +Requires: lvm2 + # Fonts Requires: freefont Requires: grub2 @@ -130,12 +144,12 @@ done mv %{SOURCE20} src/modules/license/license.conf mv %{SOURCE24} src/modules/users/users.conf -%patch0 -p1 -b .default-settings +%patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 -# delete backup files so they don't get installed -rm -f src/modules/*/*.conf.default-settings +%patch4 -p1 +%patch5 -p1 %build mkdir -p %{_target_platform} @@ -217,6 +231,11 @@ install -p -m 644 %{SOURCE53} %{buildroot}%{_sysconfdir}/calamares/mariner-eula %{_libdir}/cmake/Calamares/ %changelog +* Fri Jan 27 2023 Mateusz Malisz - 3.2.11-40 +- Fix application crash when discoverin partitions due to a race condition with serialize-read-access.patch +- Fix application crash when the Mariner installer process thread have already exited during progress bar installation view +- Update Requires with some runtime dependencies for LVM and encryption support. + * Mon Jul 25 2022 Minghe Ren - 3.2.11-39 - Modify users.conf to imporve security diff --git a/SPECS/calamares/install-progress-bar-fix.patch b/SPECS/calamares/install-progress-bar-fix.patch new file mode 100644 index 0000000000..4bb497b8af --- /dev/null +++ b/SPECS/calamares/install-progress-bar-fix.patch @@ -0,0 +1,12 @@ +diff -ruN a/src/modules/users/MarinerInstallerJob.cpp b/src/modules/users/MarinerInstallerJob.cpp +--- a/src/modules/users/MarinerInstallerJob.cpp 2023-01-24 14:48:46.464568866 -0800 ++++ b/src/modules/users/MarinerInstallerJob.cpp 2023-01-27 15:11:08.393214748 -0800 +@@ -91,7 +91,7 @@ + // is not filled in completely, sleep for a short duration and keep consuming the + // remaining stdout to provide a smooth transition. + if (!installerProc.waitForReadyRead(-1)) { +- Q_ASSERT(installerProc.waitForFinished(0)); ++ installerProc.waitForFinished(0); + installerFinished = true; + QThread::msleep(5); + } diff --git a/SPECS/calamares/serialize-read-access.patch b/SPECS/calamares/serialize-read-access.patch new file mode 100644 index 0000000000..b387f593bf --- /dev/null +++ b/SPECS/calamares/serialize-read-access.patch @@ -0,0 +1,43 @@ +diff -ruN a/src/modules/partition/core/PartitionModel.cpp b/src/modules/partition/core/PartitionModel.cpp +--- a/src/modules/partition/core/PartitionModel.cpp 2023-01-27 14:12:11.942298970 -0800 ++++ b/src/modules/partition/core/PartitionModel.cpp 2023-01-27 14:12:06.786346392 -0800 +@@ -79,6 +79,7 @@ + int + PartitionModel::rowCount( const QModelIndex& parent ) const + { ++ QMutexLocker lock(&m_lock); + Partition* parentPartition = partitionForIndex( parent ); + if ( parentPartition ) + return parentPartition->children().count(); +@@ -89,6 +90,7 @@ + QModelIndex + PartitionModel::index( int row, int column, const QModelIndex& parent ) const + { ++ QMutexLocker lock(&m_lock); + PartitionNode* parentPartition = parent.isValid() + ? static_cast< PartitionNode* >( partitionForIndex( parent ) ) + : static_cast< PartitionNode* >( m_device->partitionTable() ); +@@ -106,6 +108,7 @@ + QModelIndex + PartitionModel::parent( const QModelIndex& child ) const + { ++ QMutexLocker lock(&m_lock); + if ( !child.isValid() ) + return QModelIndex(); + Partition* partition = partitionForIndex( child ); +@@ -129,6 +132,7 @@ + QVariant + PartitionModel::data( const QModelIndex& index, int role ) const + { ++ QMutexLocker lock(&m_lock); + Partition* partition = partitionForIndex( index ); + if ( !partition ) + return QVariant(); +@@ -277,7 +281,6 @@ + Partition* + PartitionModel::partitionForIndex( const QModelIndex& index ) const + { +- QMutexLocker lock(&m_lock); + if ( !index.isValid() ) + return nullptr; + return reinterpret_cast< Partition* >( index.internalPointer() );