Subject: [alpine-aports] [PATCH] testing/mongodb: Fix #5188 where mongod crashes at db.dropDatabase().

From: Marc Vertes <[email-masked]>
Date: Sat, 27 Feb 2016 14:18:10 +0100

>From the error log, it seems this is a problem due to wiredtiger.
The problem does not occure if using internal engine.
Ensure mongodb is using internal provided wiredtiger engine instead of
system one. An additional patch to avoid strtouq is needed.
---
 testing/mongodb/APKBUILD                 | 14 ++++++++------
 testing/mongodb/wiredtiger-strtouq.patch | 11 +++++++++++
 2 files changed, 19 insertions(+), 6 deletions(-)
 create mode 100644 testing/mongodb/wiredtiger-strtouq.patch

diff --git a/testing/mongodb/APKBUILD b/testing/mongodb/APKBUILD
index 3da7c6a..cff25f0 100644
--- a/testing/mongodb/APKBUILD
+++ b/testing/mongodb/APKBUILD
@@ -1,16 +1,15 @@
 # Maintainer: Filipp Andronov <[email-masked]>
-
+# Contributor: Marc Vertes <[email-masked]>
 pkgname=mongodb
 pkgver=3.2.3
-pkgrel=0
+pkgrel=1
 pkgdesc='A high-performance, open source, schema-free document-oriented database'
 url='http://www.mongodb.org'
 arch='x86_64'
 license='AGPL3'
 pkgusers="mongodb"
 depends=
-depends_dev="scons openssl-dev pcre-dev wiredtiger-dev snappy-dev boost-dev
-	asio-dev libpcap-dev"
+depends_dev="scons openssl-dev pcre-dev snappy-dev boost-dev asio-dev libpcap-dev"
 makedepends="$depends_dev"
 install="$pkgname.pre-install"
 source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz
@@ -19,6 +18,7 @@ source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz
 	backtrace.patch
 	fix-asio-strerror_r.patch
 	musl-available-stack.patch
+	wiredtiger-strtouq.patch
 	boost160.patch
 
         mongodb.confd
@@ -36,7 +36,7 @@ source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz
 # TODO: check if there are more libs could be replaced by system counterparts (see libpcap does't use, for example)
 # TODO: proper fix for heap usage
 # Right now code patched to always return 0 for heap usage statistics. That is necessary because musl malloc info
-# doesn't compatible with glibc and breaks build. It is _possible_ to patch code to return 0
+# isn't compatible with glibc and breaks build. It is _possible_ to patch code to return 0
 # because on 64bit platform statistics is broken and returns wrong numbers, see SERVER-9168 mongo bug.
 #
 # There is a way to return propper value when tc-malloc used, but it doesn't compile for libmusl. Work is in progress,
@@ -49,7 +49,6 @@ _buildopts="
 		--use-system-boost \
 		--use-system-pcre \
 		--use-system-snappy \
-		--use-system-wiredtiger \
 		--use-system-zlib \
 	"
 
@@ -97,6 +96,7 @@ md5sums="4e7faa648ce5f44f1fa91404abbd225d  mongodb-src-r3.2.3.tar.gz
 86a988b5d4402227d177b8a1167008e8  backtrace.patch
 cd0833592e3a23e729ebd71eb756318c  fix-asio-strerror_r.patch
 a0e1d0ef5df415965a20a5da67d853c9  musl-available-stack.patch
+e6016216b02afd44164e17ae31e3ce7d  wiredtiger-strtouq.patch
 1df24dc2aa6b8f4c6da22f097a921ebb  boost160.patch
 7d2f94bed7bfacd32fcd52dfd931f077  mongodb.confd
 792a0b53b3e843cf14176c5beb8cdfe1  mongodb.initd
@@ -109,6 +109,7 @@ sha256sums="82030ada190095b5d95c0b59e9cf74efe9db602b49d2b8857b06f2683a5227fa  mo
 300d9f6b819730de54018d4b418eb7f921ba9c83fad4958a040544b076160848  backtrace.patch
 ec6d404221f02706ef2e52e00e414e98666dcc3606e78c9b3d33dfbd42a1eae7  fix-asio-strerror_r.patch
 68dba3180f0aedac2a3b9f868723552a2945882e53c9635e0d0585be9fd1e47b  musl-available-stack.patch
+20c465ae169e5e3642ca0c8486b2165a412dabe171e8e249c134e0a4688342a4  wiredtiger-strtouq.patch
 0e9da35f4303e53daf51e78961c517895f2d12f4fa49298f01e1665e15246d73  boost160.patch
 a4ca29c577428c02cd0b0a8b46756df5f53a05519c9d13c270533cf99b9b819d  mongodb.confd
 7e39fbd4dc18dba21c8767931683f4795e58e0e91b9f9a5842539923ded453c9  mongodb.initd
@@ -121,6 +122,7 @@ b9fdacb273d5a4e1e60735846b262287f84ca6cbded9393d182f69158d3162a50cae5d834f76860d
 7d097f497cb910c9cb81086cd8c222e43456d1a6de4adfe3e97a4d99add454279350fdeb7305dab84b3deca04afd824036d4065ee0fb8cdd8c03e96d98ee86af  backtrace.patch
 f829b1ad542db3ee776d444243b8b47ab4e48a7386d9b199d7b1adafd31556cf173a5683b78ee735d6a69999ad9af5ad152fde955bbe8865f7910718991ce97c  fix-asio-strerror_r.patch
 4251ad85c6a76cb5d87e7e1a3bb2f67c6abb046b3c145b86201310d89b43e99f3b4124da8a8df1f92dfcbcfc2187c14c14a85f48980cfd419ddb2e38508da071  musl-available-stack.patch
+bbb323d428d59584703e8692bf4df7fe0d37c0324c23822bade2edd1ca78759191f778230b7107502a9d2f7f22afc84d4ea350139fc1d751ceb2fff219b9ddf8  wiredtiger-strtouq.patch
 385c82875174caae433a3b381eb10f98a6fed0c8943788ddefff1de80a898e480bdbbf094a7783285cf2ae11ce3fc6878e57d58183d05be2f0837b206aaa4da6  boost160.patch
 9bcd870742c31bf25f34188ddc3c414de1103e9860dea9f54eee276b89bc2cf1226abab1749c5cda6a6fb0880e541373754e5e83d63cc7189d4b9c274fd555c3  mongodb.confd
 2cb295ac0eb44acb4533c86d6d0988d5f760361a43cff7845713f3e2cf0e37023d23790a2926c613bf2b0668060c0b68d59000db52daaacd8af10e701a8b4192  mongodb.initd
diff --git a/testing/mongodb/wiredtiger-strtouq.patch b/testing/mongodb/wiredtiger-strtouq.patch
new file mode 100644
index 0000000..db66bcd
--- /dev/null
+++ b/testing/mongodb/wiredtiger-strtouq.patch
@@ -0,0 +1,11 @@
+--- mongodb-src-r3.2.3/src/third_party/wiredtiger/build_linux/wiredtiger_config.h.orig
++++ mongodb-src-r3.2.3/src/third_party/wiredtiger/build_linux/wiredtiger_config.h
+@@ -101,7 +101,7 @@
+ #define HAVE_STRING_H 1
+ 
+ /* Define to 1 if you have the `strtouq' function. */
+-#define HAVE_STRTOUQ 1
++/* #undef HAVE_STRTOUQ 1 */
+ 
+ /* Define to 1 if you have the `sync_file_range' function. */
+ /* #undef HAVE_SYNC_FILE_RANGE */
-- 
2.7.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---