Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix sslmode typo #609

Merged
merged 3 commits into from
May 18, 2023
Merged

fix: fix sslmode typo #609

merged 3 commits into from
May 18, 2023

Conversation

mschoettle
Copy link
Contributor

We are trying to use SSL with MariaDB and ran into the issue with ssl_mode (fixed by the recently merged #475). We tried installing the latest commit on main and it produces the following error when building:

running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.linux-aarch64-cpython-310
      creating build/temp.linux-aarch64-cpython-310/src
      creating build/temp.linux-aarch64-cpython-310/src/MySQLdb
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC "-Dversion_info=(2, 2, 0, 'dev', 0)" -D__version__=2.2.0.dev0 -I/usr/local/include/python3.10 -c src/MySQLdb/_mysql.c -o build/temp.linux-aarch64-cpython-310/src/MySQLdb/_mysql.o -I/usr/include/mariadb/ -std=c99
      In file included from /usr/local/include/python3.10/Python.h:8,
                       from src/MySQLdb/_mysql.c:46:
      /usr/local/include/python3.10/pyconfig.h:1643: warning: "_POSIX_C_SOURCE" redefined
       1643 | #define _POSIX_C_SOURCE 200809L
            |
      In file included from /usr/include/aarch64-linux-gnu/sys/types.h:25,
                       from /usr/include/mariadb/mysql.h:38,
                       from src/MySQLdb/_mysql.c:29:
      /usr/include/features.h:310: note: this is the location of the previous definition
        310 | # define _POSIX_C_SOURCE 199506L
            |
      src/MySQLdb/_mysql.c: In function ‘_mysql_ConnectionObject_Initialize’:
      src/MySQLdb/_mysql.c:534:13: error: ‘sslmode_num’ undeclared (first use in this function); did you mean ‘ssl_mode_num’?
        534 |         if (sslmode_num >= SSLMODE_REQUIRED) {
            |             ^~~~~~~~~~~
            |             ssl_mode_num
      src/MySQLdb/_mysql.c:534:13: note: each undeclared identifier is reported only once for each function it appears in
      src/MySQLdb/_mysql.c:535:81: error: ‘enforce_tls’ undeclared (first use in this function)
        535 |             mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);
            |                                                                                 ^~~~~~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

This PR fixes the sslmode typo and replaces enforce_tls with 1.

@mschoettle mschoettle changed the title fix: fix sslmode typo for MariaDB fix: fix sslmode typo May 18, 2023
@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (ba85984) 88.86% compared to head (8def204) 88.86%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #609   +/-   ##
=======================================
  Coverage   88.86%   88.86%           
=======================================
  Files           7        7           
  Lines         548      548           
=======================================
  Hits          487      487           
  Misses         61       61           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mschoettle mschoettle mentioned this pull request May 18, 2023
@methane
Copy link
Member

methane commented May 18, 2023

Thank you. We need CI that uses mariadbclient.

@methane methane merged commit 398208f into PyMySQL:main May 18, 2023
@mschoettle mschoettle deleted the fix-sslmode-typo branch May 19, 2023 13:58
@methane methane mentioned this pull request May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants