From eb72d4e0abc2a0bde902b12202a6bed399e2ea3b Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 8 Aug 2019 17:59:36 +0900 Subject: [PATCH] Skip dependency ckecking when backend has executed as root Change-Id: I42a89ac1d5cc17d754c6580b9c650cad18473e01 Signed-off-by: Junghyun Yeon --- src/common/step/pkgmgr/step_check_installable.cc | 5 +++++ src/common/step/pkgmgr/step_check_removable.cc | 7 +++++++ src/common/step/pkgmgr/step_check_upgradable.cc | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/src/common/step/pkgmgr/step_check_installable.cc b/src/common/step/pkgmgr/step_check_installable.cc index d02c6d7..7e5f647 100644 --- a/src/common/step/pkgmgr/step_check_installable.cc +++ b/src/common/step/pkgmgr/step_check_installable.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -57,6 +58,10 @@ Step::Status StepCheckInstallable::process() { } } + // Don't check dependency if backend has executed as root + if (getuid () == 0) + return Status::OK; + bool installable = true; manifest_x* manifest = context_->manifest_data.get(); for (const auto& dep : GListRange(manifest->dependencies)) { diff --git a/src/common/step/pkgmgr/step_check_removable.cc b/src/common/step/pkgmgr/step_check_removable.cc index 2ee4627..e9e92ca 100644 --- a/src/common/step/pkgmgr/step_check_removable.cc +++ b/src/common/step/pkgmgr/step_check_removable.cc @@ -4,6 +4,9 @@ #include "common/step/pkgmgr/step_check_removable.h" +#include +#include + #include #include @@ -32,6 +35,10 @@ Step::Status StepCheckRemovable::process() { return Status::OPERATION_NOT_ALLOWED; } + // Don't check dependency if backend has executed as root + if (getuid() == 0) + return Status::OK; + std::vector depends_on; if (!pkg_query.PackagesDependsOn(&depends_on)) return Status::INVALID_VALUE; diff --git a/src/common/step/pkgmgr/step_check_upgradable.cc b/src/common/step/pkgmgr/step_check_upgradable.cc index 0e1a7ec..aad7a3e 100644 --- a/src/common/step/pkgmgr/step_check_upgradable.cc +++ b/src/common/step/pkgmgr/step_check_upgradable.cc @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include @@ -34,6 +36,10 @@ Step::Status StepCheckUpgradable::process() { return Status::INVALID_VALUE; } + // Don't check dependency if backend has executed as root + if (getuid() == 0) + return Status::OK; + std::vector depends_on; if (!pkg_query.PackagesDependsOn(&depends_on)) return Status::INVALID_VALUE; -- 2.7.4