I am trying to build Couchbase server on s390x architecture (RHEL7/SLES12). After successful build, when I ran the test cases, “couchdb-couch_set_view-19-compaction-retry” test case failed for s390x.
I made following change in the code to make it pass:
bash-4.2# diff ./couchstore/src/views/bin/couch_view_file_merger.c_ORIG ./couchstore/src/views/bin/couch_view_file_merger.c
38,39c38,39
< } merge_file_type_t;
<
.—
.> };
.> typedef unsigned char merge_file_type_t;
The “if (fscanf(stdin, “%c\n”, (char *)&view_file_type) != 1)” statement gets wrong input character if we don’t do this change. The C and C++ standards allows the character type char to be signed or unsigned, depending on the platform and compiler. For s390x, the type of char is unsigned. This variation causes getting junk characters for s390x. The code change will make the type consistent across all platforms.