[devel] [PATCH for apt] Fix crash when removing 3rd-party packages with some tags missing

Aleksei Nikiforov darktemplar на altlinux.org
Пт Янв 31 11:36:54 MSK 2020


---
 apt/apt-pkg/rpm/rpmpm.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/apt/apt-pkg/rpm/rpmpm.cc b/apt/apt-pkg/rpm/rpmpm.cc
index e00630f..4bca9f4 100644
--- a/apt/apt-pkg/rpm/rpmpm.cc
+++ b/apt/apt-pkg/rpm/rpmpm.cc
@@ -81,7 +81,12 @@ std::string rpm_name_conversion(const pkgCache::PkgIterator &Pkg)
 #if RPM_VERSION >= 0x040202
    // This is needed for removal to work on multilib packages, but old
    // rpm versions don't support name.arch in RPMDBI_LABEL, oh well...
-   Name = Name + "." + Pkg.CurrentVer().Arch();
+   // Note: some 3rd-party packages may still miss arch, so only use it
+   // when it's present
+   if (Pkg.CurrentVer().Arch() != nullptr)
+   {
+      Name = Name + "." + Pkg.CurrentVer().Arch();
+   }
 #endif
 
    return Name;
-- 
2.24.1



Подробная информация о списке рассылки Devel