diff options
author | Sangyoon Jang <jeremy.jang@samsung.com> | 2024-07-22 09:23:29 +0900 |
---|---|---|
committer | Sangyoon Jang <jeremy.jang@samsung.com> | 2024-07-22 09:42:48 +0900 |
commit | ef566d203729bfa277d2efea5b02abcc9b42ae4b (patch) | |
tree | fdf7b66ea2a37bfafde84100f167ea558d216063 | |
parent | c9a56759cdbcc841fd53c4daff93d15c22d891e0 (diff) | |
download | app-installers-ef566d203729bfa277d2efea5b02abcc9b42ae4b.tar.gz app-installers-ef566d203729bfa277d2efea5b02abcc9b42ae4b.tar.bz2 app-installers-ef566d203729bfa277d2efea5b02abcc9b42ae4b.zip |
Fix access denied error at dotnet AOT plugin
Set ownership manually after copying new contents.
Change-Id: Ic2316f7be5f319309aa057617f90833b719e07a0
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
-rw-r--r-- | src/common/step/backup/step_copy_backup.cc | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/common/step/backup/step_copy_backup.cc b/src/common/step/backup/step_copy_backup.cc index 6460cf2b..b957d9d5 100644 --- a/src/common/step/backup/step_copy_backup.cc +++ b/src/common/step/backup/step_copy_backup.cc @@ -36,7 +36,7 @@ bool CheckFreeSpace(const fs::path& backup_path, const fs::path& shared_path) { return true; } -bool CreateSharedRes(const fs::path& src, const fs::path& dst) { +bool CreateSharedRes(const fs::path& dst) { std::error_code error; fs::create_directories(dst / kSharedResPath, error); @@ -45,11 +45,6 @@ bool CreateSharedRes(const fs::path& src, const fs::path& dst) { return false; } - if (!ci::CopyOwnershipAndPermissions(src / "shared", dst / "shared") || - !ci::CopyOwnershipAndPermissions(src / kSharedResPath, - dst / kSharedResPath)) - return false; - return true; } @@ -236,8 +231,14 @@ bool StepCopyBackup::NewContent() { return false; } - if (ShouldBackupSharedRes()) { - if (!CreateSharedRes(backup_path_, context_->GetPkgPath())) + // This is a trick that making installer copy new shared/res contents + // instead of move(move will fail by directory not empty error). Because + // transmute attribute of smack is not working on move operation. + // Early smack labeling is needed because of accessing shared/res from + // other applications during package update. + bool should_backup_shared_res = ShouldBackupSharedRes(); + if (should_backup_shared_res) { + if (!CreateSharedRes(context_->GetPkgPath())) return false; } @@ -262,6 +263,18 @@ bool StepCopyBackup::NewContent() { LOG(ERROR) << "Failed to set ownership"; return false; } + + // Set ownership of the contents of shared/res same as installer (originally + // it was set as tizenglobalapps by copy operation instead of move) to avoid + // access denied error at child process of installer (e.g. dotnet AOT plugin) + if (should_backup_shared_res) { + if (!ci::SetOwnershipAll( + install_path_ / "shared/res", getuid(), getgid())) { + LOG(ERROR) << "Failed to set ownership"; + return false; + } + } + LOG(INFO) << "Successfully move: " << context_->unpacked_dir_path.get() << " to: " << install_path_ << " directory"; |