From e7a195ce42a1c3dbcdd1f78c954a4583b85fc789 Mon Sep 17 00:00:00 2001 From: Sandboxed API Team Date: Tue, 25 Aug 2020 09:00:55 -0700 Subject: [PATCH] Automated rollback of commit 82c56775ef4d08fe241af21b240cf3be9ac60c60. PiperOrigin-RevId: 328340042 Change-Id: Ib225f8012fb373c74e3f1b3e6201b2daca7da40b --- sandboxed_api/proto_helper.h | 2 +- sandboxed_api/rpcchannel.h | 2 +- sandboxed_api/sandbox.cc | 2 +- sandboxed_api/sandbox.h | 5 ++--- sandboxed_api/sandbox2/comms.cc | 2 +- sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel | 1 - .../sandbox2/examples/network_proxy/networkproxy_bin.cc | 4 ++-- sandboxed_api/sandbox2/forkserver.cc | 2 +- sandboxed_api/sandbox2/mounts.cc | 2 +- sandboxed_api/sandbox2/network_proxy/BUILD.bazel | 2 -- sandboxed_api/sandbox2/network_proxy/client.cc | 2 +- sandboxed_api/sandbox2/network_proxy/client.h | 2 +- sandboxed_api/sandbox2/network_proxy/filtering.cc | 3 +-- sandboxed_api/sandbox2/network_proxy/filtering.h | 2 +- sandboxed_api/sandbox2/policybuilder.h | 2 +- sandboxed_api/sandbox2/sandbox2.h | 2 +- sandboxed_api/sandbox2/util.cc | 4 ++-- sandboxed_api/sandbox2/util.h | 4 ++-- sandboxed_api/sandbox2/util/minielf.cc | 8 +++++--- sandboxed_api/sandbox2/util/minielf.h | 2 +- sandboxed_api/tools/clang_generator/emitter.cc | 2 +- sandboxed_api/tools/clang_generator/emitter.h | 2 +- sandboxed_api/tools/clang_generator/generator.cc | 4 ++-- sandboxed_api/tools/clang_generator/generator.h | 4 ++-- sandboxed_api/tools/clang_generator/types.cc | 2 +- sandboxed_api/util/status.h | 4 ++++ 26 files changed, 37 insertions(+), 36 deletions(-) diff --git a/sandboxed_api/proto_helper.h b/sandboxed_api/proto_helper.h index b00a73e..53ac26d 100644 --- a/sandboxed_api/proto_helper.h +++ b/sandboxed_api/proto_helper.h @@ -22,8 +22,8 @@ #include #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "sandboxed_api/proto_arg.pb.h" +#include "sandboxed_api/util/statusor.h" namespace sapi { diff --git a/sandboxed_api/rpcchannel.h b/sandboxed_api/rpcchannel.h index c54ef8e..ed50326 100644 --- a/sandboxed_api/rpcchannel.h +++ b/sandboxed_api/rpcchannel.h @@ -18,11 +18,11 @@ #include #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/call.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/var_type.h" +#include "sandboxed_api/util/statusor.h" namespace sapi { diff --git a/sandboxed_api/sandbox.cc b/sandboxed_api/sandbox.cc index 18239a4..b29646b 100644 --- a/sandboxed_api/sandbox.cc +++ b/sandboxed_api/sandbox.cc @@ -392,7 +392,7 @@ absl::Status Sandbox::TransferFromSandboxee(v::Var* var) { } sapi::StatusOr Sandbox::GetCString(const v::RemotePtr& str, - uint64_t max_length) { + uint64_t max_length) { if (!is_active()) { return absl::UnavailableError("Sandbox not active"); } diff --git a/sandboxed_api/sandbox.h b/sandboxed_api/sandbox.h index 8b4ee6a..d8f37ef 100644 --- a/sandboxed_api/sandbox.h +++ b/sandboxed_api/sandbox.h @@ -102,9 +102,8 @@ class Sandbox { absl::Status TransferToSandboxee(v::Var* var); absl::Status TransferFromSandboxee(v::Var* var); - sapi::StatusOr GetCString(const v::RemotePtr& str, - uint64_t max_length = 10ULL - << 20 /* 10 MiB*/ + sapi::StatusOr GetCString( + const v::RemotePtr& str, uint64_t max_length = 10ULL << 20 /* 10 MiB*/ ); // Waits until the sandbox terminated and returns the result. diff --git a/sandboxed_api/sandbox2/comms.cc b/sandboxed_api/sandbox2/comms.cc index 3e61013..6bb891c 100644 --- a/sandboxed_api/sandbox2/comms.cc +++ b/sandboxed_api/sandbox2/comms.cc @@ -36,7 +36,6 @@ #include "google/protobuf/message.h" #include "absl/memory/memory.h" #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" @@ -45,6 +44,7 @@ #include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" +#include "sandboxed_api/util/statusor.h" #ifdef MEMORY_SANITIZER #include "base/dynamic_annotations.h" diff --git a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel index 480c078..133cb88 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel @@ -49,7 +49,6 @@ cc_binary( "//sandboxed_api/util:flags", "//sandboxed_api/util:status", "//sandboxed_api/util:statusor", - "@com_google_absl//absl/status", "@com_google_absl//absl/strings:str_format", ], ) diff --git a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc index b355522..c22947d 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc +++ b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc @@ -12,15 +12,15 @@ #include #include "sandboxed_api/util/flag.h" -#include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/str_format.h" #include "sandboxed_api/sandbox2/client.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/network_proxy/client.h" #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" +#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" +#include "sandboxed_api/util/statusor.h" ABSL_FLAG(bool, connect_with_handler, true, "Connect using automatic mode."); diff --git a/sandboxed_api/sandbox2/forkserver.cc b/sandboxed_api/sandbox2/forkserver.cc index d0b637c..2125927 100644 --- a/sandboxed_api/sandbox2/forkserver.cc +++ b/sandboxed_api/sandbox2/forkserver.cc @@ -36,7 +36,6 @@ #include "absl/memory/memory.h" #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -56,6 +55,7 @@ #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" +#include "sandboxed_api/util/statusor.h" namespace { // "Moves" the old FD to the new FD number. diff --git a/sandboxed_api/sandbox2/mounts.cc b/sandboxed_api/sandbox2/mounts.cc index e1c0198..2f734e2 100644 --- a/sandboxed_api/sandbox2/mounts.cc +++ b/sandboxed_api/sandbox2/mounts.cc @@ -27,7 +27,6 @@ #include "google/protobuf/util/message_differencer.h" #include "absl/container/flat_hash_set.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" @@ -40,6 +39,7 @@ #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status_macros.h" +#include "sandboxed_api/util/statusor.h" namespace sandbox2 { namespace { diff --git a/sandboxed_api/sandbox2/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/network_proxy/BUILD.bazel index 5935390..3a3a9d6 100644 --- a/sandboxed_api/sandbox2/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/network_proxy/BUILD.bazel @@ -46,7 +46,6 @@ cc_library( "//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/util:status", "@com_google_absl//absl/memory", - "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", "@com_google_glog//:glog", @@ -63,7 +62,6 @@ cc_library( "//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/util:status", "//sandboxed_api/util:statusor", - "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_glog//:glog", ], diff --git a/sandboxed_api/sandbox2/network_proxy/client.cc b/sandboxed_api/sandbox2/network_proxy/client.cc index e528041..586d201 100644 --- a/sandboxed_api/sandbox2/network_proxy/client.cc +++ b/sandboxed_api/sandbox2/network_proxy/client.cc @@ -25,9 +25,9 @@ #include #include "absl/memory/memory.h" -#include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/util/strerror.h" +#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/client.h b/sandboxed_api/sandbox2/network_proxy/client.h index 7318993..e7af4dc 100644 --- a/sandboxed_api/sandbox2/network_proxy/client.h +++ b/sandboxed_api/sandbox2/network_proxy/client.h @@ -17,9 +17,9 @@ #include -#include "absl/status/status.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/sandbox2/comms.h" +#include "sandboxed_api/util/status.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/filtering.cc b/sandboxed_api/sandbox2/network_proxy/filtering.cc index fc93e6c..d6389d8 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering.cc +++ b/sandboxed_api/sandbox2/network_proxy/filtering.cc @@ -17,12 +17,11 @@ #include #include -#include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include "sandboxed_api/sandbox2/util/strerror.h" +#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/filtering.h b/sandboxed_api/sandbox2/network_proxy/filtering.h index c0a235b..fb6714a 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering.h +++ b/sandboxed_api/sandbox2/network_proxy/filtering.h @@ -19,8 +19,8 @@ #include -#include "sandboxed_api/util/statusor.h" #include "sandboxed_api/sandbox2/comms.h" +#include "sandboxed_api/util/statusor.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/policybuilder.h b/sandboxed_api/sandbox2/policybuilder.h index 07095ba..f05023c 100644 --- a/sandboxed_api/sandbox2/policybuilder.h +++ b/sandboxed_api/sandbox2/policybuilder.h @@ -29,11 +29,11 @@ #include #include "absl/base/macros.h" #include "absl/memory/memory.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/string_view.h" #include "sandboxed_api/sandbox2/mounts.h" #include "sandboxed_api/sandbox2/network_proxy/filtering.h" #include "sandboxed_api/sandbox2/policy.h" +#include "sandboxed_api/util/statusor.h" struct bpf_labels; diff --git a/sandboxed_api/sandbox2/sandbox2.h b/sandboxed_api/sandbox2/sandbox2.h index 633297f..9527ff2 100644 --- a/sandboxed_api/sandbox2/sandbox2.h +++ b/sandboxed_api/sandbox2/sandbox2.h @@ -26,7 +26,6 @@ #include #include "absl/base/macros.h" #include "absl/memory/memory.h" -#include "sandboxed_api/util/statusor.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" #include "sandboxed_api/sandbox2/ipc.h" @@ -34,6 +33,7 @@ #include "sandboxed_api/sandbox2/notify.h" #include "sandboxed_api/sandbox2/policy.h" #include "sandboxed_api/sandbox2/result.h" +#include "sandboxed_api/util/statusor.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/util.cc b/sandboxed_api/sandbox2/util.cc index b760d26..24d4a36 100644 --- a/sandboxed_api/sandbox2/util.cc +++ b/sandboxed_api/sandbox2/util.cc @@ -183,8 +183,8 @@ bool CreateMemFd(int* fd, const char* name) { } sapi::StatusOr Communicate(const std::vector& argv, - const std::vector& envv, - std::string* output) { + const std::vector& envv, + std::string* output) { int cout_pipe[2]; posix_spawn_file_actions_t action; diff --git a/sandboxed_api/sandbox2/util.h b/sandboxed_api/sandbox2/util.h index e42bf72..87fe31c 100644 --- a/sandboxed_api/sandbox2/util.h +++ b/sandboxed_api/sandbox2/util.h @@ -63,8 +63,8 @@ bool CreateMemFd(int* fd, const char* name = "buffer_file"); // Executes a the program given by argv and the specified environment and // captures any output to stdout/stderr. sapi::StatusOr Communicate(const std::vector& argv, - const std::vector& envv, - std::string* output); + const std::vector& envv, + std::string* output); // Returns signal description. std::string GetSignalName(int signo); diff --git a/sandboxed_api/sandbox2/util/minielf.cc b/sandboxed_api/sandbox2/util/minielf.cc index dce033b..3eac979 100644 --- a/sandboxed_api/sandbox2/util/minielf.cc +++ b/sandboxed_api/sandbox2/util/minielf.cc @@ -219,7 +219,8 @@ absl::Status ElfParser::ReadFileHeader() { return absl::OkStatus(); } -sapi::StatusOr ElfParser::ReadSectionHeader(absl::string_view src) { +sapi::StatusOr ElfParser::ReadSectionHeader( + absl::string_view src) { if (src.size() < sizeof(Elf64_Shdr)) { return absl::FailedPreconditionError( absl::StrCat("invalid section header data: got ", src.size(), @@ -292,7 +293,8 @@ sapi::StatusOr ElfParser::ReadSectionContents( return rv; } -sapi::StatusOr ElfParser::ReadProgramHeader(absl::string_view src) { +sapi::StatusOr ElfParser::ReadProgramHeader( + absl::string_view src) { if (src.size() < sizeof(Elf64_Phdr)) { return absl::FailedPreconditionError( absl::StrCat("invalid program header data: got ", src.size(), @@ -512,7 +514,7 @@ sapi::StatusOr ElfParser::Parse(FILE* elf, uint32_t features) { } sapi::StatusOr ElfFile::ParseFromFile(const std::string& filename, - uint32_t features) { + uint32_t features) { std::unique_ptr elf{fopen(filename.c_str(), "r"), [](FILE* f) { fclose(f); }}; if (!elf) { diff --git a/sandboxed_api/sandbox2/util/minielf.h b/sandboxed_api/sandbox2/util/minielf.h index c33a604..247d271 100644 --- a/sandboxed_api/sandbox2/util/minielf.h +++ b/sandboxed_api/sandbox2/util/minielf.h @@ -34,7 +34,7 @@ class ElfFile { }; static sapi::StatusOr ParseFromFile(const std::string& filename, - uint32_t features); + uint32_t features); int64_t file_size() const { return file_size_; } const std::string& interpreter() const { return interpreter_; } diff --git a/sandboxed_api/tools/clang_generator/emitter.cc b/sandboxed_api/tools/clang_generator/emitter.cc index 78b9a9a..18fdcd9 100644 --- a/sandboxed_api/tools/clang_generator/emitter.cc +++ b/sandboxed_api/tools/clang_generator/emitter.cc @@ -46,10 +46,10 @@ constexpr absl::string_view kHeaderProlog = #include "absl/base/macros.h" #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "sandboxed_api/sandbox.h" #include "sandboxed_api/vars.h" #include "sandboxed_api/util/status_macros.h" +#include "sandboxed_api/util/statusor.h" )"; constexpr absl::string_view kHeaderEpilog = diff --git a/sandboxed_api/tools/clang_generator/emitter.h b/sandboxed_api/tools/clang_generator/emitter.h index ad9f5f8..42ba92d 100644 --- a/sandboxed_api/tools/clang_generator/emitter.h +++ b/sandboxed_api/tools/clang_generator/emitter.h @@ -18,12 +18,12 @@ #include #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "absl/strings/string_view.h" #include "clang/AST/Decl.h" #include "clang/AST/Type.h" #include "sandboxed_api/tools/clang_generator/generator.h" #include "sandboxed_api/tools/clang_generator/types.h" +#include "sandboxed_api/util/statusor.h" namespace sapi { diff --git a/sandboxed_api/tools/clang_generator/generator.cc b/sandboxed_api/tools/clang_generator/generator.cc index ffe2106..508877e 100644 --- a/sandboxed_api/tools/clang_generator/generator.cc +++ b/sandboxed_api/tools/clang_generator/generator.cc @@ -18,12 +18,12 @@ #include #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "clang/Format/Format.h" #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/tools/clang_generator/diagnostics.h" #include "sandboxed_api/tools/clang_generator/emitter.h" #include "sandboxed_api/util/status_macros.h" +#include "sandboxed_api/util/statusor.h" namespace sapi { namespace { @@ -68,7 +68,7 @@ bool GeneratorASTVisitor::VisitFunctionDecl(clang::FunctionDecl* decl) { namespace internal { sapi::StatusOr ReformatGoogleStyle(const std::string& filename, - const std::string& code) { + const std::string& code) { // Configure code style based on Google style, but enforce pointer alignment clang::format::FormatStyle style = clang::format::getGoogleStyle(clang::format::FormatStyle::LK_Cpp); diff --git a/sandboxed_api/tools/clang_generator/generator.h b/sandboxed_api/tools/clang_generator/generator.h index 3b9680b..24e2658 100644 --- a/sandboxed_api/tools/clang_generator/generator.h +++ b/sandboxed_api/tools/clang_generator/generator.h @@ -20,13 +20,13 @@ #include "absl/container/flat_hash_set.h" #include "absl/memory/memory.h" #include "absl/status/status.h" -#include "sandboxed_api/util/statusor.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Tooling.h" #include "sandboxed_api/tools/clang_generator/types.h" +#include "sandboxed_api/util/statusor.h" namespace sapi { @@ -67,7 +67,7 @@ class GeneratorASTVisitor namespace internal { sapi::StatusOr ReformatGoogleStyle(const std::string& filename, - const std::string& code); + const std::string& code); } // namespace internal diff --git a/sandboxed_api/tools/clang_generator/types.cc b/sandboxed_api/tools/clang_generator/types.cc index 321d1e2..4d91499 100644 --- a/sandboxed_api/tools/clang_generator/types.cc +++ b/sandboxed_api/tools/clang_generator/types.cc @@ -208,7 +208,7 @@ std::string MapQualTypeReturn(const clang::ASTContext& context, return "absl::Status"; } // Remove const qualifier like in MapQualType(). - return absl::StrCat("sapi::StatusOr<", + return absl::StrCat("::sapi::StatusOr<", MaybeRemoveConst(context, qual).getAsString(), ">"); } diff --git a/sandboxed_api/util/status.h b/sandboxed_api/util/status.h index d9962fd..6390bc0 100644 --- a/sandboxed_api/util/status.h +++ b/sandboxed_api/util/status.h @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This file and it's implementation provide a custom fork of +// util/task/status.h. This will become obsolete and will be replaced once +// Abseil releases absl::Status. + #ifndef THIRD_PARTY_SAPI_UTIL_STATUS_H_ #define THIRD_PARTY_SAPI_UTIL_STATUS_H_