commit:     8c9da308d9c8ee174b4627b75bbfc30bc91c6f65
Author:     Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Fri Nov  8 23:25:23 2019 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Nov  8 23:25:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c9da308

sys-cluster/ceph: revbump to 14.2.4-r1, misc fixes

Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 .../{ceph-14.2.4.ebuild => ceph-14.2.4-r1.ebuild}  |  4 ++
 .../ceph/files/ceph-14.2.4-python-executable.patch | 29 +++++++++
 .../files/ceph-14.2.4-undefined-behaviour.patch    | 76 ++++++++++++++++++++++
 3 files changed, 109 insertions(+)

diff --git a/sys-cluster/ceph/ceph-14.2.4.ebuild 
b/sys-cluster/ceph/ceph-14.2.4-r1.ebuild
similarity index 98%
rename from sys-cluster/ceph/ceph-14.2.4.ebuild
rename to sys-cluster/ceph/ceph-14.2.4-r1.ebuild
index 82af9e6a844..02af6882fd5 100644
--- a/sys-cluster/ceph/ceph-14.2.4.ebuild
+++ b/sys-cluster/ceph/ceph-14.2.4-r1.ebuild
@@ -154,6 +154,8 @@ PATCHES=(
        "${FILESDIR}/ceph-14.2.0-cython-0.29.patch"
        "${FILESDIR}/ceph-14.2.3-boost-1.70.patch"
        "${FILESDIR}/ceph-14.2.3-dpdk-compile-fix-1.patch"
+       "${FILESDIR}/ceph-14.2.4-python-executable.patch"
+       "${FILESDIR}/ceph-14.2.4-undefined-behaviour.patch"
 )
 
 # dpdk and ninja don't get along
@@ -294,6 +296,8 @@ python_install() {
        pushd "${BUILD_DIR}/src/pybind" >/dev/null || die
        DESTDIR="${ED}" emake VERBOSE=1 install
        popd >/dev/null || die
+
+       python_optimize
 }
 
 src_install() {

diff --git a/sys-cluster/ceph/files/ceph-14.2.4-python-executable.patch 
b/sys-cluster/ceph/files/ceph-14.2.4-python-executable.patch
new file mode 100644
index 00000000000..40feaf11ad3
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-14.2.4-python-executable.patch
@@ -0,0 +1,29 @@
+diff --git a/src/ceph-crash.in b/src/ceph-crash.in
+index 5bfb50c474..d53c4eeb6a 100755
+--- a/src/ceph-crash.in
++++ b/src/ceph-crash.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON_EXECUTABLE@
++#!@PYTHON3_EXECUTABLE@
+ # -*- mode:python -*-
+ # vim: ts=4 sw=4 smarttab expandtab
+ 
+diff --git a/src/ceph.in b/src/ceph.in
+index f060023f57..3a84263ccc 100755
+--- a/src/ceph.in
++++ b/src/ceph.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON_EXECUTABLE@
++#!@PYTHON3_EXECUTABLE@
+ # -*- mode:python -*-
+ # vim: ts=4 sw=4 smarttab expandtab
+ #
+@@ -66,7 +66,7 @@ DEVMODEMSG = '*** DEVELOPER MODE: setting PATH, PYTHONPATH 
and LD_LIBRARY_PATH *
+ def respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path):
+     execv_cmd = []
+     if 'CEPH_DBG' in os.environ:
+-        execv_cmd += ['@PYTHON_EXECUTABLE@', '-mpdb']
++        execv_cmd += ['@PYTHON3_EXECUTABLE@', '-mpdb']
+ 
+     if platform.system() == "Darwin":
+         lib_path_var = "DYLD_LIBRARY_PATH"

diff --git a/sys-cluster/ceph/files/ceph-14.2.4-undefined-behaviour.patch 
b/sys-cluster/ceph/files/ceph-14.2.4-undefined-behaviour.patch
new file mode 100644
index 00000000000..99249fb01a0
--- /dev/null
+++ b/sys-cluster/ceph/files/ceph-14.2.4-undefined-behaviour.patch
@@ -0,0 +1,76 @@
+diff --git a/src/include/blobhash.h b/src/include/blobhash.h
+index 597884e4c9..97f2065ce3 100644
+--- a/src/include/blobhash.h
++++ b/src/include/blobhash.h
+@@ -14,33 +14,40 @@
+ #ifndef CEPH_BLOBHASH_H
+ #define CEPH_BLOBHASH_H
+ 
++#include <cstdint>
+ #include "hash.h"
+ 
+-/*
+-- this is to make some of the STL types work with 64 bit values, string hash 
keys, etc.
+-- added when i was using an old STL.. maybe try taking these out and see if 
things 
+-  compile now?
+-*/
+-
+ class blobhash {
+ public:
+-  uint32_t operator()(const char *p, unsigned len) {
+-    static rjhash<uint32_t> H;
+-    uint32_t acc = 0;
++  uint32_t operator()(const void* p, size_t len) {
++    static rjhash<std::uint32_t> H;
++    std::uint32_t acc = 0;
++    auto buf = static_cast<const unsigned char*>(p);
+     while (len >= sizeof(acc)) {
+-      acc ^= *(uint32_t*)p;
+-      p += sizeof(uint32_t);
+-      len -= sizeof(uint32_t);
++      acc ^= unaligned_load(buf);
++      buf += sizeof(std::uint32_t);
++      len -= sizeof(std::uint32_t);
+     }
+-    int sh = 0;
+-    while (len) {
+-      acc ^= (uint32_t)*p << sh;
+-      sh += 8;
+-      len--;
+-      p++;
++    // handle the last few bytes of p[-(len % 4):]
++    switch (len) {
++    case 3:
++      acc ^= buf[2] << 16;
++      [[fallthrough]];
++    case 2:
++      acc ^= buf[1] << 8;
++      [[fallthrough]];
++    case 1:
++      acc ^= buf[0];
++      [[fallthrough]];
+     }
+     return H(acc);
+   }
++private:
++  static inline std::uint32_t unaligned_load(const unsigned char* p) {
++    std::uint32_t result;
++    __builtin_memcpy(&result, p, sizeof(result));
++    return result;
++  }
+ };
+ 
+ 
+diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h
+index b6952ca498..576b7d6b8a 100644
+--- a/src/msg/msg_types.h
++++ b/src/msg/msg_types.h
+@@ -566,7 +566,7 @@ namespace std {
+     size_t operator()( const entity_addr_t& x ) const
+     {
+       static blobhash H;
+-      return H((const char*)&x, sizeof(x));
++      return H(&x, sizeof(x));
+     }
+   };
+ } // namespace std

Reply via email to