diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-09-05 13:32:39 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-09-05 13:32:39 +0000 |
commit | 5233a64be8e18c67fc309865fbaf3bbdca636e81 (patch) | |
tree | 9ca743e9ab90dca67f302ca9dc3b32eb7f64c178 | |
parent | 99f7728a2c2d4aaafb585e85e06282f429031f94 (diff) | |
download | drakx-5233a64be8e18c67fc309865fbaf3bbdca636e81.tar drakx-5233a64be8e18c67fc309865fbaf3bbdca636e81.tar.gz drakx-5233a64be8e18c67fc309865fbaf3bbdca636e81.tar.bz2 drakx-5233a64be8e18c67fc309865fbaf3bbdca636e81.tar.xz drakx-5233a64be8e18c67fc309865fbaf3bbdca636e81.zip |
At some point, an empty hashref is autovivified in $packages->{medium}.
So, protect the loops that iterate over this hash, in application of
the belt and suspenders doctrine.
-rw-r--r-- | perl-install/install_any.pm | 2 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 69686e7de..8646d4ac4 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -1021,7 +1021,7 @@ sub warnAboutFilesStillOpen() { sub install_urpmi { my ($method, $packages) = @_; - my @mediums = values %{$packages->{mediums}}; + my @mediums = grep { defined $_->{medium} } values %{$packages->{mediums}}; my $hdInstallPath = any::hdInstallPath(); #- rare case where urpmi cannot be installed (no hd install path). diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 3eb471b5c..869384677 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -247,7 +247,6 @@ sub packageRequest { #- check for medium selection, if the medium has not been #- selected, the package cannot be selected. foreach (values %{$packages->{mediums}}) { - #- XXX $_ should always be an object here !$_->{selected} && $pkg->id >= $_->{start} && $pkg->id <= $_->{end} and return; } @@ -369,6 +368,7 @@ sub psUpdateHdlistsDeps { #- check if current configuration is still up-to-date and do not need to be updated. foreach (values %{$packages->{mediums}}) { + next if ref $_ ne 'install_medium'; #- skip empty hash artifact $_->selected || $_->ignored or next; my $hdlistf = "$urpmidir/hdlist.$_->{fakemedium}.cz" . ($_->{hdlist} =~ /\.cz2/ && "2"); my $synthesisf = "$urpmidir/synthesis.hdlist.$_->{fakemedium}.cz" . ($_->{hdlist} =~ /\.cz2/ && "2"); @@ -966,6 +966,7 @@ sub installTransactionClosure { #- search first usable medium (sorted by medium ordering). foreach (sort { $a->{start} <=> $b->{start} } values %{$packages->{mediums}}) { + next if ref $_ ne 'install_medium'; #- skip empty hash artifact unless ($_->selected) { #- this medium is not selected, but we have to make sure no package is left #- in $id2pkg. |