Bug #83457 Incorrect ISA detection code in OEL RPM spec
Submitted: 20 Oct 2016 11:10 Modified: 25 Oct 2016 14:11
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.6, 5.7, 8.0 OS:Any
Assigned to: Terje Røsten CPU Architecture:Any

[20 Oct 2016 11:10] Alexey Kopytov
packaging/rpm-oel/mysql_config.sh is a wrapper script used to call the
appopriate mysql-config-{32|64} binary depending on the architecture.

The problem is that the following code from the very beginning of the
script does not work as intended:

# This command respects setarch, works on OL6/RHEL6 and later
isa_bits=$(rpm --eval %__isa_bits)

case $bits in
    32|64) bits=$isa_bits ;;
        *) bits=unknown ;;

Note that we assign the results of "rpm --eval %__isa_bits" to the
"isa_bits" variable, but then use the "bits" variable to access that

So that code never works, and then we fall back to another ISA detection
method that works only on x86/x86_64/PPC CPUs.

It's interesting that packaging/rpm-fedora/mysql_config.sh uses the
correct variable name, but does not have a fallback logic. Also, rpm-docker and rpm-sles do not have that wrapper at all for unknown reasons.

I'm going to submit a patch to fix that.

How to repeat:
Look at packaging/rpm-oel/mysql_config.sh. Compare with
[20 Oct 2016 11:14] Terje Røsten

Thanks for report!
[20 Oct 2016 11:50] Terje Røsten
FYI: docker don't ship -devel package and SLES do things differently. Fedora and EL should be identical.
[20 Oct 2016 11:53] Alexey Kopytov
Hi Terje! Thanks for clarifications.
[20 Oct 2016 22:18] Daniel Black
While you are at it can you please add ppc64le to the list of 64bit architectures. It isn't matched by the ppc64 pattern (which still exists as the big endian variant).

$ uname -m
[21 Oct 2016 5:15] Alexey Kopytov
Added ppc64le to my Github PR.
[21 Oct 2016 6:46] Terje Røsten
hi guys,

is ppc64le a multilib arch? Can ppc32 bins be used on ppc64le? 
Fedora seems to limit multilib to:

    i386  x86_64
    ppc   ppc64
    s390  s390x
    sparc sparc64


On aarch64 and ppc64le it would be ok not to install wrapper at all.

Any way it can't hurt to add aarch64 and ppc64le and fix the script. 

I will merge your changes, thanks!
[21 Oct 2016 13:29] OCA Admin
Contribution submitted via Github - Bug #83457: Incorrect ISA detection code in OEL RPM spec 
(*) Contribution by Alexey Kopytov (Github akopytov, mysql-server/pull/107#issuecomment-255199207): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_90192198.txt (text/plain), 2.83 KiB.

[22 Oct 2016 6:37] Alexey Kopytov
Hi Terje,

I don't know whether ppc64le is a multilib arch, but aarch64 is. As in, an AArch64 CPU may support both A32 and A64 instruction sets. I'm focused on A64, so I don't know much about software infrastructure in 'mixed' environments.
[23 Oct 2016 22:57] Daniel Black
No ppc64le isn't multiarch - 64bit only. There isn't even a 32bit little endian ABI defined.
[25 Oct 2016 14:11] Paul Dubois
Posted by developer:
Noted in 5.5.54, 5.6.35, 5.7.17, 8.0.1 changelogs.

OEL RPM packages now better detect which platforms have multilib
support (for which 32-bit and 64-bit libraries can be installed).
Thanks to Alexey Kopytov for the patch.
[25 Oct 2016 23:48] Daniel Black
Thanks Alexey, Paul, Tejre