Bug #87123 -DWITH_ZLIB=system does not guarantee that "openssl zlib" is available
Submitted: 19 Jul 2017 16:06 Modified: 23 Aug 2017 1:21
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: openssl, zlib, zlib_decompress

[19 Jul 2017 16:06] Laurynas Biveinis
Description:
https://dev.mysql.com/doc/refman/8.0/en/zlib-decompress.html reads

"If MySQL was configured with the -DWITH_ZLIB=system option, zlib_decompress is not built. In this case, the system openssl zlib command can be used instead."

This would imply that if MySQL is able to configure with -DWITH_ZLIB=system, then "openssl zlib" command is checked and known to work. But this is not the case on e.g. Ubuntu Trusty, Xenial, Yakkety, Zesty; Debian Jessie, maybe elsewhere.

This change was introduced by [1] and it actually patches Debian/Ubuntu packaging to -DWITH_ZLIB=bundled too, but not everybody builds through packaging scripts.

[1]

d1a5ef9b077dd4a01d86c39bb0f61b99135b6b94
Author:     Tor Didriksen <tor.didriksen@oracle.com>
AuthorDate: Thu Jan 14 12:34:10 2016 +0100
Commit:     Tor Didriksen <tor.didriksen@oracle.com>
CommitDate: Fri Jan 15 13:44:56 2016 +0100

Bug#22329851 -DWITH_(LZ4|ZLIB)=SYSTEM BUILDS AND INSTALLS (LZ4|ZLIB)_DECOMPRESS

When using -DWITH_LZ4=system and/or -DWITH_ZLIB=system
lz4_decompress and/or zlib_decompress are not required as
lz4 and 'openssl zlib' are already installed on the system.

On debian: build with bundled rather than system zlib.

How to repeat:
On one of the above systems, cmake -DWITH_ZLIB=system, then e.g.
./mtr mysqlpump_basic
...
main.mysqlpump_basic                     w2 [ fail ]
        Test ended at 2017-07-18 07:45:22

CURRENT_TEST: main.mysqlpump_basic
Dump completed in 858
Dump completed in 700
Dump completed in 812
mysqlpump: [Warning] option 'extended-insert': unsigned value 0 adjusted to 1
Dump completed in 736
Dump completed in 834
Dump completed in 831
mysqlpump: [Warning] option 'extended-insert': unsigned value 0 adjusted to 1
Dump progress: 0/1 tables, 1/4 rows
Dump completed in 668
Dump completed in 818
Dump completed in 794
Dump completed in 819
Dump completed in 852
Dump completed in 757
Dump completed in 685
openssl:Error: 'zlib' is an invalid command.
...

Suggested fix:
1) Refuse -DWITH_ZLIB=system if openssl zlib is not available?
2) Revert [1] and just accept decompression utilities built every time?

It seems that 2) has been tried before by [2] reverting [3] where the latter seems similar to [1] except for packaging changes

[2]

3c47eaecfb67807c09575fa0bc4cab4d17699755
Author:     Erlend Dahl <erlend.dahl@oracle.com>
AuthorDate: Thu Jan 14 05:25:21 2016 +0100
Commit:     Erlend Dahl <erlend.dahl@oracle.com>
CommitDate: Thu Jan 14 05:35:38 2016 +0100

Revert "Bug#22329851 -DWITH_(LZ4|ZLIB)=SYSTEM BUILDS AND INSTALLS (LZ4|ZLIB)_DECOMPRESS"

Revert fix since it breaks the Debian/Ubuntu builds.

[3]

83436fb230e9087e5c9837b04d475ed0d9685f76
Author:     Tor Didriksen <tor.didriksen@oracle.com>
AuthorDate: Fri Jan 8 16:24:22 2016 +0100
Commit:     Tor Didriksen <tor.didriksen@oracle.com>
CommitDate: Wed Jan 13 15:46:21 2016 +0100

Bug#22329851 -DWITH_(LZ4|ZLIB)=SYSTEM BUILDS AND INSTALLS (LZ4|ZLIB)_DECOMPRESS

When using -DWITH_LZ4=system and/or -DWITH_ZLIB=system
lz4_decompress and/or zlib_decompress are not required as
lz4 and 'openssl zlib' are already installed on the system.
[19 Jul 2017 16:14] Laurynas Biveinis
Correct category
[20 Jul 2017 9:28] Umesh Shastry
Hello Laurynas,

Thank you for the report!

Thanks,
Umesh
[23 Aug 2017 1:21] Paul Dubois
Posted by developer:
 
Fixed in 8.0.3.

Compiling with -DWITH_SSL=system -DWITH_ZLIB=system assumed that the
system openssl zlib command was available, which might not be the
case. Now availability of that command is checked, and if
unavailable, the zlib_decompress utility is built.