• x32: mariadb: if defined __ILP32__ and __x86_64__ ?

    From =?UTF-8?B?T3R0byBLZWvDpGzDpGluZW4=?@21:1/5 to All on Wed Jul 3 06:30:01 2024
    Hi!

    MariaDB has this piece of code that is failing on x32 as reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063738

    tests/mysql_client_fw.c
    @@ -1442

    #if defined __x86_64__
    compile_time_assert(sizeof(MYSQL) == 1272);
    #elif defined __i386__
    compile_time_assert(sizeof(MYSQL) == 964);
    #endif

    How should I fix this for x32? What is the preprocessor if clause and
    can I safely assume the size is 964?

    Previous x32 builds passed before upstream introduced this change. References: - https://wiki.debian.org/X32Port
    - https://buildd.debian.org/status/logs.php?pkg=mariadb&arch=x32
    - https://salsa.debian.org/mariadb-team/mariadb-server

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bernd Petrovitsch@21:1/5 to Bernd Petrovitsch on Wed Jul 3 12:50:01 2024
    Hi all!

    sent too fast:

    On 03/07/2024 12:31, Bernd Petrovitsch wrote:
    [...]
    On 03/07/2024 06:05, Otto Kekäläinen wrote:
    [...]
    MariaDB has this piece of code that is failing on x32 as reported in
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063738

    tests/mysql_client_fw.c
    @@ -1442

    #if defined __x86_64__

    #if defined(__x86_64__) && !defined(__ILP32__)

    Of course you need more but the __ILP32__ symbol is
    typically used to distinguish x32 from amd64.
    To illustrate it it, e.g.
    ---- snip ---
    #if defined __x86_64__
    # if defined __ILP32__
    compile_time_assert(sizeof(MYSQL) == 964); // x32
    # else
    compile_time_assert(sizeof(MYSQL) == 1272); // amd64
    # endif
    #elif defined __i386__
    compile_time_assert(sizeof(MYSQL) == 964); // ix86
    #endif
    ---- snip ---

       compile_time_assert(sizeof(MYSQL) == 1272);
    #elif defined __i386__
       compile_time_assert(sizeof(MYSQL) == 964);
    #endif

    How should I fix this for x32? What is the preprocessor if clause and
    can I safely assume the size is 964?

    Kind regards,
        Bernd
    --
    Bernd Petrovitsch Email : bernd@petrovitsch.priv.at
    There is NO CLOUD, just other people's computers. - FSFE
    LUGA : http://www.luga.at

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bernd Petrovitsch@21:1/5 to All on Wed Jul 3 13:30:01 2024
    Hi all!

    On 03/07/2024 06:05, Otto Kekäläinen wrote:
    [...]
    MariaDB has this piece of code that is failing on x32 as reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063738

    tests/mysql_client_fw.c
    @@ -1442

    #if defined __x86_64__

    #if defined(__x86_64__) && !defined(__ILP32__)

    compile_time_assert(sizeof(MYSQL) == 1272);
    #elif defined __i386__
    compile_time_assert(sizeof(MYSQL) == 964);
    #endif

    How should I fix this for x32? What is the preprocessor if clause and
    can I safely assume the size is 964?

    Kind regards,
    Bernd
    --
    Bernd Petrovitsch Email : bernd@petrovitsch.priv.at
    There is NO CLOUD, just other people's computers. - FSFE
    LUGA : http://www.luga.at

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?utf-8?B?0L3QsNCx?=@21:1/5 to All on Wed Jul 3 13:50:01 2024
    Hi!

    On Tue, Jul 02, 2024 at 09:05:14PM -0700, Otto Kekäläinen wrote:
    tests/mysql_client_fw.c
    @@ -1442

    #if defined __x86_64__
    compile_time_assert(sizeof(MYSQL) == 1272);
    #elif defined __i386__
    compile_time_assert(sizeof(MYSQL) == 964);
    #endif

    How should I fix this for x32? What is the preprocessor if clause and
    can I safely assume the size is 964?
    The comment before this reads
    /*
    this limited check is enough, if sizeof(MYSQL) changes, it changes
    everywhere
    */
    so this looks like an ABI stability check,
    validating not that MYSQL should be Some Specific Size,
    but that it's The Size It Was Last Time.

    IMO turn the first line into
    #if defined(__x86_64__) && !defined(__ILP32__)
    since they did actually just want to check
    if the size is the same they measured on amd64 and i386.

    And if it were to change on either of these two,
    it would change everywhere (apparently).

    Best,

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmaFOKQACgkQvP0LAY0m WPESXRAAijyq4dlnQWuctpIprbtsY0bGznGIH58p3MSkSH+bESCK8u/gldPnpmDq DNMQTlUmRldc/5pJp8GNV/Kesc0u8hrJXkwJw5Avqo6kxPYcigBSiJtchLVjglju 6R34VUB4FDnvccrp7j5UeFOqXUGtAET5Q1TwYp01kupNZHnZL7hx/Isn2IUHJll3 ChNLxVeqe8lIaBD47G+7yTSht2RzmnSegKutESbIpmDR68c//wjZ5U8s0xyAhuTN iLaK3wmTJ+OFTPlMrgQ8+LcNGpuGwCtwjNmt8+UQEbANeHVC6Jg2NRD/wKteDm/t R0HQok2apWmpu7X4m+Esmub257TUeDgaCZBy4ZEQ0OytZJNry2nBkYPilnl0eadG 6vbqRdjoLic4kCIjZTpUmjkUU34zrXz9gCtOQGwimFoiyXYvYollQqKsJnQdXEJx ydQ4URSGr0mnH9V2wIB9Llb15G6fuCeA0rLONizqQ8GmAoCT6a2d74tZa8+JpK8y cIXgeZuoaSq+KdtiavGdPVCPAN0uMEiRqKPMXKfiGcJWD6OkaW+oD44OH3QM5kFG kMTXGREwYKiSpuN+ySKx1AvvCaYkpUF3Knb2VRrZE1HZMBpLsh5+64dZCIspzppC +gIbBuDmGoRhY6ehnr9h20VZw9fHfV6yG1uhIHCwOWS72dLFJr0=
    =XNWH
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?B?T3R0byBLZWvDpGzDpGluZW4=?@21:1/5 to All on Thu Jul 4 18:10:02 2024
    Thanks for the advice. Potential fix posted now at https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/90
    for team review.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)