Bug 274811

Summary: databases/grass8: fix mysql connect [patch]
Product: Ports & Packages Reporter: Martin Birgmeier <d8zNeCFG>
Component: Individual Port(s)Assignee: Loïc Bartoletti <lbartoletti>
Status: In Progress ---    
Severity: Affects Only Me CC: alt2600, d8zNeCFG
Priority: --- Flags: lbartoletti: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to fix type incompatibilities none

Description Martin Birgmeier 2023-10-30 10:49:48 UTC
Created attachment 245993 [details]
patch to fix type incompatibilities

Scenario:
- FreeBSD stable/14 (Oct. 27)
- ports latest
- compiling ports using portmaster
- building databases/grass8

Result:
- build fails in db/drivers/mysql/db.c with incompatible types
  (char * instead of required int for parameter "port")

Expected result:
- build should succeed

Patch attached (compiles, but untested).

This could never have worked before - all combinations of grass7/8 and mysql 5.7/8.0 seem to be wrong.

-- Martin
Comment 1 Loïc Bartoletti freebsd_committer freebsd_triage 2024-02-21 12:34:21 UTC
Indeed, has been patched upstream https://github.com/OSGeo/grass/pull/3325
Comment 2 alt2600 2024-03-11 22:59:25 UTC
(In reply to Loïc Bartoletti from comment #1)

has upstream been pulled down? failed for me today while doing my ports rebuild after upgrading to 14.0p5 release amd64. Same error with mysql driver
Comment 3 Loïc Bartoletti freebsd_committer freebsd_triage 2024-03-18 08:40:45 UTC
Hi,
Should be fixed in https://cgit.freebsd.org/ports/commit/?id=4d6dff20cdbc7e3bc41a3e0b668d474033d9bb2c

Please, let me know, if it's ok to you.
Comment 4 Martin Birgmeier 2024-03-18 18:06:00 UTC
(In reply to Loïc Bartoletti from comment #3)

I rebuilt the port after it was upgraded, and the patch (see the attachments) still applied cleanly.

So I guess it is still needed and the issue has not yet been fixed upstream.

-- Martin
Comment 5 alt2600 2024-03-22 00:43:56 UTC
(In reply to Loïc Bartoletti from comment #3)

I didn't try Martin's patch, but from ports alone no it still fails to build the mysql driver as of a ports tree pull about 2 hours ago.
Comment 6 alt2600 2024-05-06 03:42:06 UTC
(In reply to Loïc Bartoletti from comment #1)

That pull request 3325 was put into 8.4.0, its not available in the current version

https://github.com/OSGeo/grass/milestone/19?closed=1
search with 
mysql_real_connect

8.3.2 db.c in ports

    {
        /* Client version */
        const char *user, *password, *host, *port;
        CONNPAR connpar;

        if (parse_conn(name, &connpar) == DB_FAILED) {
            db_d_report_error();
            return DB_FAILED;
        }

        G_debug(3,
                "host = %s, port = %d, dbname = %s, "
                "user = %s, password = %s",
                connpar.host, connpar.port, connpar.dbname, connpar.user,
                connpar.password);

        db_get_login2("mysql", name, &user, &password, &host, &port);

        connection = mysql_init(NULL);
        res = mysql_real_connect(connection, host, user, password,
                                 connpar.dbname, port, NULL, 0);

        if (res == NULL) {
            db_d_append_error("%s\n%s", _("Connection failed."),
                              mysql_error(connection));
            db_d_report_error();
            return DB_FAILED;
        }
    }


the if statement checking null or 0 with atoi patch #3325 hasn't been added upstream yet