Skip to content

Commit

Permalink
Fixed free space overflow for disks > 8EiB (bsc#991090)
Browse files Browse the repository at this point in the history
- Do not display a false "not enough free space" warning popup if
  the free space is bigger than 8EiB (2^63) (bsc#991090)
- Do not display the "not enough free space" warning for partitions
  where nothing is going to be installed (bsc#926841)
- Back ported disk usage fix - check the parent directory if the
  target directory does not exist (yet) (bsc#1073696)

- 3.2.27
  • Loading branch information
lslezak committed Jul 16, 2018
1 parent bae8a0b commit 4595ad1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
11 changes: 11 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Jul 16 11:19:03 UTC 2018 - lslezak@suse.cz

- Do not display a false "not enough free space" warning popup if
the free space is bigger than 8EiB (2^63) (bsc#991090)
- Do not display the "not enough free space" warning for partitions
where nothing is going to be installed (bsc#926841)
- Back ported disk usage fix - check the parent directory if the
target directory does not exist (yet) (bsc#1073696)
- 3.2.27

-------------------------------------------------------------------
Fri Apr 13 08:26:41 UTC 2018 - gsouza@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-packager.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 3.2.26
Version: 3.2.27
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
44 changes: 39 additions & 5 deletions src/modules/SlideShowCallbacks.rb
Expand Up @@ -10,9 +10,12 @@
# $Id$
#
require "yast"
require "pathname"

module Yast
class SlideShowCallbacksClass < Module
include Yast::Logger

def main
Yast.import "Pkg"
Yast.import "UI"
Expand Down Expand Up @@ -300,8 +303,13 @@ def DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, delet
if pkgdu != nil
# check each mount point
Builtins.foreach(pkgdu) do |part, data|
# disk sizes from libzypp, in KiB!
_disk_size, used_now, used_future, read_only = *data
# the size difference, how much the package needs on this partition
required_space = used_future - used_now

# skip read-only partitions, the package cannot be installed anyway
if Ops.get(data, 3, 0) == 1
if read_only == 1
Builtins.y2debug("Skipping read-only partition %1", part)
next
end
Expand All @@ -310,6 +318,24 @@ def DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, delet
Builtins.substring(part, 0, 1) != "/"
part = Ops.add("/", part)
end

# nothing to install on this partition, skip it (bsc#926841)
if required_space <= 0
log.debug("Nothing to install at #{part}, skipping")
next
end

target_dir = File.join(Installation.destdir, part)

# handle missing directories (not existing yet or incorrect metadata),
# if the directory does not exist then go up, normally it should
# stop at Installation.destdir (but it will stop at "/" at last)
until File.exist?(target_dir)
log.warn("Directory #{target_dir} does not exist")
target_dir = Pathname.new(target_dir).parent.to_s
log.info("Checking the parent directory (#{target_dir})")
end

target_dir = Ops.add(Installation.destdir, part)
disk_available = Pkg.TargetAvailable(target_dir)
Builtins.y2debug(
Expand All @@ -318,13 +344,19 @@ def DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, delet
target_dir,
disk_available
)
if Ops.less_than(disk_available, Ops.get(data, 2, 0))

if disk_available < 0
log.debug("Data overflow, too much free space available, skipping the check")
next
end

if disk_available < required_space
Builtins.y2warning(
"Not enought free space in %1 (%2): available: %3, required: %4",
"Not enough free space in %1 (%2): available: %3, required: %4",
part,
target_dir,
disk_available,
Ops.get(data, 2, 0)
required_space
)

cont = YesNoAgainWarning(
Expand Down Expand Up @@ -354,7 +386,9 @@ def DisplayStartInstall(pkg_name, pkg_location, pkg_description, pkg_size, delet
disk_available
)

if Ops.less_than(disk_available, pkg_size)
if disk_available < 0
log.debug("Data overflow, too much free space available, skipping the check")
elsif Ops.less_than(disk_available, pkg_size)
Builtins.y2warning(
"Not enough free space in %1: available: %2, required: %3",
Installation.destdir,
Expand Down

0 comments on commit 4595ad1

Please sign in to comment.