| Summary: | urpmi reports an incorrect disk size usage when size is reduced (on 32bit arches) | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | Pascal Terjan <pterjan> |
| Component: | RPM Packages | Assignee: | Thierry Vignaud <thierry.vignaud> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Normal | CC: | marja11 |
| Version: | Cauldron | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | perl-URPM | CVE: | |
| Status comment: | |||
|
Description
Pascal Terjan
2016-10-30 18:43:54 CET
Marja Van Waes
2016-10-30 18:49:08 CET
CC:
(none) =>
marja11
Marja Van Waes
2016-10-30 18:49:18 CET
Hardware:
All =>
arm Sizes seem correct, the problem is in summing them: $ xzcat /var/lib/urpmi/debug/synthesis.hdlist.cz | cut -d@ -f 5 | sort -n | tail -n 1 1216700214 $ xzcat /var/lib/urpmi/free/synthesis.hdlist.cz | cut -d@ -f 5 | sort -n | tail -n 1 2187343771 $ xzcat /var/lib/urpmi/free/synthesis.hdlist.cz | grep filesize | cut -d@ -f 3 | sort -n | tail -n 1 1554328903 $ xzcat /var/lib/urpmi/debug/synthesis.hdlist.cz | grep filesize | cut -d@ -f 3 | sort -n | tail -n 1 280901606 sub _selected_size_filesize {
[...]
foreach (values %{$state->{rejected} || {}}) {
$_->{removed} || $_->{obsoleted} or next;
$size -= abs($_->{size});
}
$size goes "negative" here.
Removing rejected, new total is 91709742
Removing rejected, new total is 86562938
Removing rejected, new total is 86514210
Removing rejected, new total is 86460194
Removing rejected, new total is 18446744073704140297
Removing rejected, new total is 18446744073696953144
Removing rejected, new total is 18446744073696951045
Removing rejected, new total is 18446744073695463783
my $msg2 = $size >= 0 ?
N("%s of additional disk space will be used.", formatXiB($size)) :
N("%s of disk space will be freed.", formatXiB(-$size));
So the problem seems to be that the value is unsigned...
Ah the added/removed size is an Math::UInt64 which may be related to the problem.
This fixes it:
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index e6af91d..4963700 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -7,6 +7,8 @@ use strict;
use warnings;
use Config;
+use Math::Int64 qw(int64);
+
# perl_checker: require URPM
@@ -1838,6 +1840,8 @@ sub _selected_size_filesize {
my ($urpm, $state, $compute_filesize) = @_;
my ($size, $filesize, $bad_filesize);
+ $size = int64(0);
+
foreach (keys %{$state->{selected} || {}}) {
my $pkg = $urpm->{depslist}[$_];
$size += $pkg->size;
Pascal Terjan
2016-10-30 19:52:16 CET
Assignee:
mageiatools =>
thierry.vignaud I guess this is due to recent commits to swith to uint64 for sizes and not arch specific.
Pascal Terjan
2016-10-30 19:54:12 CET
Summary:
urpmi reports an incorrect disk size usage on armv7hl =>
urpmi reports an incorrect disk size usage when size is reduced
Pascal Terjan
2016-10-30 19:57:13 CET
Source RPM:
urpmi =>
perl-URPM
Pascal Terjan
2016-10-30 20:40:58 CET
Hardware:
arm =>
All
Thierry Vignaud
2016-11-10 16:17:21 CET
Status:
NEW =>
ASSIGNED commit 8aceb9b6a318668d0795af52bf9ea9dbb33351d9
Author: Pascal Terjan <pterjan@...>
Date: Thu Nov 10 16:19:41 2016 +0100
make sure to use int64 on 32bit arch
else we may got total size to overflow (mga#19686)
v2 by Thierry Vignaud: use native int64 on 64bit
---
Commit Link:
http://gitweb.mageia.org/software/rpm/perl-URPM/commit/?id=8aceb9b6a318668d0795af52bf9ea9dbb33351d9
I would have expect it to magically work when doing int +=int64 but... Status:
ASSIGNED =>
RESOLVED |