Skip to content

Commit

Permalink
Revert copying the libzypp cache to the target system (bsc#1183711)
Browse files Browse the repository at this point in the history
... and replacing it by a symlink, it is not safe and it can
cause crash (segfault) in some cases

- 4.3.21
  • Loading branch information
lslezak committed Apr 6, 2021
1 parent 849fa22 commit b5ce3fe
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
8 changes: 8 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Apr 6 13:06:27 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

- Revert copying the libzypp cache to the target system and
replacing it by a symlink, it is not safe and it can
cause crash (segfault) in some cases (bsc#1183711)
- 4.3.21

-------------------------------------------------------------------
Thu Mar 18 16:33:19 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

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


Name: yast2-packager
Version: 4.3.20
Version: 4.3.21
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand Down
29 changes: 10 additions & 19 deletions src/clients/inst_kickoff.rb
Expand Up @@ -4,8 +4,6 @@
module Yast
# Do various tasks before starting with installation of rpms.
class InstKickoffClient < Client
include Yast::Logger

def main
Yast.import "Pkg"
textdomain "packager"
Expand Down Expand Up @@ -46,7 +44,16 @@ def main
)
end

copy_zypp_cache
# copy the credential files, libzypp loads them from target
zypp_dir = "/etc/zypp"
credentials_d = zypp_dir + "/credentials.d"

if File.exist?(credentials_d) && Installation.destdir != "/"
target_zypp = Installation.destdir + zypp_dir
Builtins.y2milestone("Copying libzypp credentials to #{target_zypp}...")
::FileUtils.mkdir_p(target_zypp)
::FileUtils.cp_r(credentials_d, target_zypp)
end

# installation, for instance...
if !Mode.update
Expand Down Expand Up @@ -131,22 +138,6 @@ def main
:next
end

# copy the zypp cache to the target system (only when running in inst-sys!)
# to save some memory during installation
def copy_zypp_cache
return unless Stage.initial

# copy the credential files (libzypp loads them from target)
# and the repository cache to the target system
Pkg.SourceCacheCopyTo(Installation.destdir)

# symlink the cache from inst-sys to save same space (RAM!)
cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp"
log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}")
::FileUtils.rm_rf(cache_path)
File.symlink(File.join(Installation.destdir, cache_path), cache_path)
end

# Handle the backup.
def backup_stuff
if Installation.update_backup_modified
Expand Down
4 changes: 4 additions & 0 deletions src/lib/packager/clients/pkg_finish.rb
Expand Up @@ -98,6 +98,10 @@ def write
Pkg.SourceSaveAll
Pkg.TargetFinish

# save repository metadata cache to the installed system
# (needs to be done _after_ saving repositories, see bnc#700881)
Pkg.SourceCacheCopyTo(Installation.destdir)

# Patching /etc/zypp/zypp.conf in order not to install
# recommended packages, doc-packages,...
# (needed for products like CASP)
Expand Down
1 change: 1 addition & 0 deletions test/pkg_finish_test.rb
Expand Up @@ -68,6 +68,7 @@
expect(Yast::Pkg).to receive(:SourceLoad)
expect(Yast::Pkg).to receive(:SourceSaveAll)
expect(Yast::Pkg).to receive(:TargetFinish)
expect(Yast::Pkg).to receive(:SourceCacheCopyTo).with(destdir)
allow(Yast::WFM).to receive(:Execute)
expect(client.run).to be_nil
end
Expand Down

0 comments on commit b5ce3fe

Please sign in to comment.