From 2c1c2f390da44436e0d202c98f2ed4a21aee28d7 Mon Sep 17 00:00:00 2001 From: Jan Kolarik Date: Mon, 27 Nov 2023 15:57:07 +0100 Subject: [PATCH] solv_repo: Add read permissions to cached solv files In order to reuse cached `*.solv` and `*.solvx` files by users, we need to add read permissions. --- libdnf5/repo/solv_repo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libdnf5/repo/solv_repo.cpp b/libdnf5/repo/solv_repo.cpp index 75fb9cc34..3506cf11a 100644 --- a/libdnf5/repo/solv_repo.cpp +++ b/libdnf5/repo/solv_repo.cpp @@ -585,6 +585,10 @@ void SolvRepo::write_main(bool load_after_write) { } } + std::filesystem::permissions( + cache_tmp_file.get_path(), + std::filesystem::perms::group_read | std::filesystem::perms::others_read, + std::filesystem::perm_options::add); std::filesystem::rename(cache_tmp_file.get_path(), solvfile_path); cache_tmp_file.release(); } @@ -668,6 +672,10 @@ void SolvRepo::write_ext(Id repodata_id, RepodataType type) { data->state = REPODATA_AVAILABLE; } + std::filesystem::permissions( + cache_tmp_file.get_path(), + std::filesystem::perms::group_read | std::filesystem::perms::others_read, + std::filesystem::perm_options::add); std::filesystem::rename(cache_tmp_file.get_path(), solvfile_path); cache_tmp_file.release(); }