Repository: mesos
Updated Branches:
  refs/heads/master 8a6e9fe03 -> 4fdb1ca1b


Revert "Ignore overflow components in version parsing."

This reverts commit 8a6e9fe035cafd36b1451f9349a17e8c18e2a02d.


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

Branch: refs/heads/master
Commit: 4fdb1ca1b1cebef89c638f85412ba71590f2c2fa
Parents: 8a6e9fe
Author: Timothy Chen <[email protected]>
Authored: Sat Aug 29 19:14:28 2015 -0700
Committer: Timothy Chen <[email protected]>
Committed: Sat Aug 29 19:14:28 2015 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/version.hpp          | 14 ++++----------
 .../libprocess/3rdparty/stout/tests/version_tests.cpp |  7 +------
 2 files changed, 5 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4fdb1ca1/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
index 1faddb9..5101084 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
@@ -18,8 +18,6 @@
 #include <string>
 #include <vector>
 
-#include <glog/logging.h>
-
 #include <stout/error.hpp>
 #include <stout/numify.hpp>
 #include <stout/stringify.hpp>
@@ -54,18 +52,14 @@ struct Version
       strings::split(strings::split(s, "-")[0], ".");
 
     if (split.size() > maxComponents) {
-      LOG(WARNING) << "Version string has " << split.size() << " components; "
-                   << "only " << maxComponents << " components will be "
-                   << "recognized, the rest will be ignored.";
+      return Error("Version string has " + stringify(split.size()) +
+                   " components; maximum " + stringify(maxComponents) +
+                   " components allowed");
     }
 
     int components[maxComponents] = {0};
-    size_t componentSize = maxComponents;
-    if (split.size() < maxComponents) {
-      componentSize = split.size();
-    }
 
-    for (size_t i = 0; i < componentSize; i++) {
+    for (size_t i = 0; i < split.size(); i++) {
       Try<int> result = numify<int>(split[i]);
       if (result.isError()) {
         return Error("Invalid version component '" + split[i] + "': " +

http://git-wip-us.apache.org/repos/asf/mesos/blob/4fdb1ca1/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp 
b/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
index e48bda1..e8f8358 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/version_tests.cpp
@@ -57,15 +57,10 @@ TEST(VersionTest, Parse)
   EXPECT_EQ(version4.get(), version1.get());
   EXPECT_EQ(stringify(version4.get()), "1.20.3");
 
-  // Ignore additional components following "X.Y.Z".
-  Try<Version> version5 = Version::parse("1.20.3.fc22");
-  EXPECT_SOME(version5);
-  EXPECT_EQ(version5.get(), version1.get());
-  EXPECT_EQ(stringify(version5.get()), "1.20.3");
-
   EXPECT_ERROR(Version::parse("0.a.b"));
   EXPECT_ERROR(Version::parse(""));
   EXPECT_ERROR(Version::parse("a"));
   EXPECT_ERROR(Version::parse("1."));
   EXPECT_ERROR(Version::parse(".1.2"));
+  EXPECT_ERROR(Version::parse("0.1.2.3"));
 }

Reply via email to