mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-03-08 08:58:43 +03:00
fix Tools::df for big storage usage values
if the size/avail of a mount is bigger than a certain amount, json_encode writes the number in scientific format, which was not matched by our \d+ regex. This then resulted in 'undef' values for the result hash and subsequently led to errors and warnings. Extend the regex to also match scientific formatted numbers, perl can then use them as is, no need for any conversion. https://forum.proxmox.com/threads/bug-in-pve-tools-df-when-adding-petabyte-scale-storage.60090/#post-277050 Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
76c5fee814
commit
c1d62a9d54
@ -1008,7 +1008,7 @@ sub df {
|
||||
warn $@ if $@;
|
||||
|
||||
# untaint the values
|
||||
my ($blocks, $used, $bavail) = map { defined($_) ? (/^(\d+)$/) : 0 }
|
||||
my ($blocks, $used, $bavail) = map { defined($_) ? (/^([\d\.e\-+]+)$/) : 0 } # can be in scientific notation
|
||||
$res->@{qw(blocks used bavail)};
|
||||
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user