From 0026331ce0177bd3f902628aadcd1a84f3e2547d Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 24 Jan 2023 12:41:23 +0100 Subject: FileSystemManager: Do not follow symlinks ... and ensure that cascades of checks are performed with only a single filesystem stat per method. --- .../execution_api/bazel_msg/bazel_msg_factory.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/buildtool/execution_api') diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index 6a8ebb87..2f3dbc01 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -509,9 +509,7 @@ auto BazelMsgFactory::CreateDirectoryDigestFromLocalTree( // create and store file try { const auto full_name = root / name; - const bool is_executable = - FileSystemManager::IsExecutable(full_name, true); - if (auto digest = store_file(full_name, is_executable)) { + if (auto digest = store_file(full_name, IsExecutableObject(type))) { auto file = CreateFileNode(name.string(), type, {}); file.set_allocated_digest(gsl::owner{ new bazel_re::Digest{std::move(*digest)}}); @@ -568,15 +566,11 @@ auto BazelMsgFactory::CreateGitTreeDigestFromLocalTree( // create and store file try { const auto full_name = root / name; - const bool is_executable = - FileSystemManager::IsExecutable(full_name, true); - if (auto digest = store_file(full_name, is_executable)) { + if (auto digest = store_file(full_name, IsExecutableObject(type))) { if (auto raw_id = FromHexString( NativeSupport::Unprefix(digest->hash()))) { - entries[std::move(*raw_id)].emplace_back( - name.string(), - is_executable ? ObjectType::Executable - : ObjectType::File); + entries[std::move(*raw_id)].emplace_back(name.string(), + type); return true; } } -- cgit v1.2.3