From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 From: Aleksei Nikiforov To: devel@lists.altlinux.org Date: Fri, 31 Jan 2020 11:36:54 +0300 Message-Id: <20200131083654.55647-1-darktemplar@altlinux.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Aleksei Nikiforov Subject: [devel] [PATCH for apt] Fix crash when removing 3rd-party packages with some tags missing X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 08:37:38 -0000 Archived-At: List-Archive: List-Post: --- 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