From 521de2161bd4dad784d8a9b4add9ad6e83e269ba Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 5 Feb 2015 22:45:58 +0000 Subject: Don't give a wrong package name when it is unknown in a callback (mga#15032) --- NEWS | 2 ++ urpm/install.pm | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 62f82d49..a3443f7f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- don't give a wrong package name when it is unknown in a callback (mga#15032) + Version 8.03 - 1 January 2015 - enhanced doc diff --git a/urpm/install.pm b/urpm/install.pm index 8ede436b..b0ca418d 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -301,8 +301,18 @@ sub _get_callbacks { $options->{callback_error} ||= sub { my ($urpm, undef, $id, $subtype) = @_; - my $n = $urpm->{depslist}[$id]->fullname; - $urpm->{error}("ERROR: '$subtype' failed for $n: "); + my $n; + if (defined($id)) { + $n = $urpm->{depslist}[$id]->fullname; + } else { + # We don't know which package :( + if ($trans->NElements() == 1) { + $n = $trans->Element_fullname(0); + } else { + $n = "some package of current transaction"; + } + } + $urpm->{error}("ERROR: '$subtype' failed for $n"); }; if ($options->{verbose} >= 0 && $have_pkgs) { -- cgit v1.2.1