You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/02/23 22:29:35 UTC

[4/4] mesos git commit: Windows: Undefined `ACL` macro defined in Zookeeper headers.

Windows: Undefined `ACL` macro defined in Zookeeper headers.

On Windows, Zookeeper will define a `ACL` macro because `Windows.h`
defines a `struct ACL`, different from Zookeeper's `struct ACL`.
Since this is a macro, it bleeds into other sources and ends up
replacing odd bits of code, such as when we access our namespaced
`ACL`s.  i.e. `mesos::ACL::RunTask`.

This commit undefines the `ACL` macro after the inclusion of the
Zookeeper headers in two places, while redefining the macro in the
one source file where we use Zookeeper's `struct ACL`.

Review: https://reviews.apache.org/r/56962


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f0f0c2f3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f0f0c2f3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f0f0c2f3

Branch: refs/heads/master
Commit: f0f0c2f32c722b55d42705ecd0fbeca191cb00b9
Parents: fb99cd0
Author: Joseph Wu <jo...@apache.org>
Authored: Wed Feb 22 17:12:54 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Feb 23 14:28:42 2017 -0800

----------------------------------------------------------------------
 include/mesos/zookeeper/authentication.hpp | 7 +++++++
 include/mesos/zookeeper/zookeeper.hpp      | 7 +++++++
 src/tests/api_tests.cpp                    | 8 ++++++--
 src/zookeeper/authentication.cpp           | 9 +++++++++
 4 files changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/include/mesos/zookeeper/authentication.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/zookeeper/authentication.hpp b/include/mesos/zookeeper/authentication.hpp
index 6a955ab..ac19f4e 100644
--- a/include/mesos/zookeeper/authentication.hpp
+++ b/include/mesos/zookeeper/authentication.hpp
@@ -19,6 +19,13 @@
 
 #include <zookeeper.h>
 
+#ifdef __WINDOWS__
+// NOTE: We need to undefine this macro to prevent it from bleeding
+// into our code and thereby break compilation of our namespaced ACLs.
+// This macro is defined in zookeeper/src/c/include/winconfig.h.
+#undef ACL
+#endif // __WINDOWS__
+
 #include <string>
 
 #include <glog/logging.h>

http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/include/mesos/zookeeper/zookeeper.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/zookeeper/zookeeper.hpp b/include/mesos/zookeeper/zookeeper.hpp
index d4723dd..3b922a4 100644
--- a/include/mesos/zookeeper/zookeeper.hpp
+++ b/include/mesos/zookeeper/zookeeper.hpp
@@ -28,6 +28,13 @@
 
 #include <zookeeper.h>
 
+#ifdef __WINDOWS__
+// NOTE: We need to undefine this macro to prevent it from bleeding
+// into our code and thereby break compilation of our namespaced ACLs.
+// This macro is defined in zookeeper/src/c/include/winconfig.h.
+#undef ACL
+#endif // __WINDOWS__
+
 #include <string>
 #include <vector>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 378612d..24f31ff 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -4128,7 +4128,9 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(AgentAPITest, LaunchNestedContainerSession)
 
 // This tests verifies that unauthorized principals are unable to
 // launch nested container sessions.
-TEST_P(AgentAPITest, LaunchNestedContainerSessionUnauthorized)
+TEST_P_TEMP_DISABLED_ON_WINDOWS(
+    AgentAPITest,
+    LaunchNestedContainerSessionUnauthorized)
 {
   ContentType contentType = GetParam();
 
@@ -4645,7 +4647,9 @@ TEST_F(AgentAPITest, AttachContainerInputFailure)
 
 // Verifies that unauthorized users are not able to attach to a
 // nested container input.
-TEST_P(AgentAPITest, AttachContainerInputAuthorization)
+TEST_P_TEMP_DISABLED_ON_WINDOWS(
+    AgentAPITest,
+    AttachContainerInputAuthorization)
 {
   ContentType contentType = GetParam();
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f0f0c2f3/src/zookeeper/authentication.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/authentication.cpp b/src/zookeeper/authentication.cpp
index 0fd99b0..9fcb540 100644
--- a/src/zookeeper/authentication.cpp
+++ b/src/zookeeper/authentication.cpp
@@ -16,6 +16,15 @@
 
 #include <mesos/zookeeper/authentication.hpp>
 
+#ifdef __WINDOWS__
+// NOTE: We need to redefine this macro, normally defined in
+// zookeeper/src/c/include/winconfig.h.  Headers that include
+// zookeeper.h typically need to undefine this macro to prevent
+// it from bleeding into other sources.  However, this file
+// needs to use the Zookeeper ACL struct, rather than Mesos ACLs.
+#define ACL ZKACL
+#endif // __WINDOWS__
+
 namespace zookeeper {
 
 ACL _EVERYONE_READ_CREATOR_ALL_ACL[] = {