From f26e3259a15cc26dac0a0a77e2488abb87892cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Sun, 20 Dec 2020 23:48:20 +0200 Subject: [PATCH] Deb: Use build flag to enforce default charset as utf8mb4 Possible now since https://github.com/mariadb-corporation/mariadb-connector-c/commit/29720950eeae75f1ea7ef1376a6149cabeb79d13 Upstreamed from https://salsa.debian.org/mariadb-team/mariadb-10.5/-/commit/ca5e93c754209f9c1a729bb057332ab3b0b76363 Closes: #1722 --- debian/rules | 1 + debian/salsa-ci.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/debian/rules b/debian/rules index d029eead974..fa155e311d2 100755 --- a/debian/rules +++ b/debian/rules @@ -97,6 +97,7 @@ endif -DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \ -DCMAKE_SYSTEM_PROCESSOR=$(DEB_HOST_ARCH) \ -DBUILD_CONFIG=mysql_release \ + -DCONC_DEFAULT_CHARSET=utf8mb4 \ -DPLUGIN_TOKUDB=NO \ -DPLUGIN_CASSANDRA=NO \ -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml index 579d43aac66..fcdcf5678a8 100644 --- a/debian/salsa-ci.yml +++ b/debian/salsa-ci.yml @@ -196,6 +196,40 @@ blhc: - pkg-config --cflags --libs libmariadb - pkg-config --cflags --libs mariadb - apt-get install -y --no-install-recommends g++ + - | + # Build a test binary that depends on libmysqlclient + cat > b933063.cpp < + #include + #include + int main() + { + MYSQL h; + if (!mysql_init(&h) + || mysql_options(&h, MYSQL_READ_DEFAULT_GROUP, "") + // || mysql_options(&h, MYSQL_SET_CHARSET_NAME, "utf8mb4") + || !mysql_real_connect(&h, "", "", NULL, "", 0, NULL, 0)) + throw std::runtime_error(mysql_error(&h)); + std::string q = "show variables like '%char%'"; + if (mysql_real_query(&h, q.data(), q.size())) + throw std::runtime_error(mysql_error(&h)); + MYSQL_RES* result = mysql_store_result(&h); + if (!result && mysql_errno(&h)) + throw std::runtime_error(mysql_error(&h)); + while (MYSQL_ROW row = mysql_fetch_row(result)) + { + std::cout << row[0] << ": " << row[1] << "\n"; + } + return 0; + } + EOF + apt-get install -y ./*.deb # Server must be installed for client to connect + echo "Testing -l mysqlclient" + g++ b933063.cpp -l mysqlclient && ./a.out | tee result + if grep --quiet latin result; then echo "ERROR: Charset latin found!"; exit 1; fi + echo "Testing -l mariadbclient" + g++ b933063.cpp -l mariadbclient && ./a.out | tee result + if grep --quiet latin result; then echo "ERROR: Charset latin found!"; exit 1; fi .test-install-all-libs: &test-install-all-libs - apt-get install -y ./libmariadb3_*.deb ./libmariadb-dev_*.deb ./libmariadb-dev-compat_*.deb ./libmariadbd19_*.deb ./libmariadbd-dev_*.deb ./mariadb-common_*.deb