-
Notifications
You must be signed in to change notification settings - Fork 17
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
Test failures with MariaDB-10.6.4 + libmariadb3-3.2.3 #164
Comments
We're seeing this (at least the second one in https://bugs.debian.org/1002093 |
Hello @Tux and @gregoa, following patch should fix issue with escaping. Could you test it? diff --git a/dbdimp.c b/dbdimp.c
index 73bd3f33f55d..433a1c071aa6 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -627,6 +627,25 @@ static char **fill_out_embedded_options(char *options,
return options_list;
}
+#if MYSQL_VERSION_ID < 50001
+/* MySQL client prior to version 5.0.1 does not implement mysql_real_escape_string() for SERVER_STATUS_NO_BACKSLASH_ESCAPES */
+static unsigned long string_escape_quotes(char *to, const char *from, unsigned long len)
+{
+ const char *to_start = to;
+ const char *end = from + len;
+
+ while (from < end)
+ {
+ if (*from == '\'')
+ *to++ = '\'';
+ *to++ = *from++;
+ }
+
+ *to = '\0';
+ return to - to_start;
+}
+#endif
+
/*
constructs an SQL statement previously prepared with
actual values replacing placeholders
@@ -838,9 +857,8 @@ static char *parse_params(
#if MYSQL_VERSION_ID < 50001
if (sock->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
{
- *ptr++ = 'X';
*ptr++ = '\'';
- ptr += mysql_hex_string(ptr, ph->value, ph->len);
+ ptr += string_escape_quotes(ptr, ph->value, ph->len);
*ptr++ = '\'';
}
else
@@ -6411,9 +6429,8 @@ SV* mariadb_db_quote(SV *dbh, SV *str, SV *type)
#if MYSQL_VERSION_ID < 50001
if (imp_dbh->pmysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
{
- *sptr++ = 'X';
*sptr++ = '\'';
- sptr += mysql_hex_string(sptr, ptr, len);
+ sptr += string_escape_quotes(sptr, ptr, len);
*sptr++ = '\'';
}
else
diff --git a/t/45bind_no_backslash_escapes.t b/t/45bind_no_backslash_escapes.t
index 13dce122ce90..eaf011b03401 100644
--- a/t/45bind_no_backslash_escapes.t
+++ b/t/45bind_no_backslash_escapes.t
@@ -18,10 +18,6 @@ if ($dbh->{mariadb_serverversion} < 50001) {
plan skip_all => "Servers < 5.0.1 do not support sql_mode NO_BACKSLASH_ESCAPES";
}
-if ($dbh->{mariadb_clientversion} < 50001) {
- $id2_quoted_no_backslash = q(X'737472696E675C737472696E6722737472696E6727737472696E67');
-}
-
plan tests => 20;
ok $dbh->do('CREATE TEMPORARY TABLE t(id VARCHAR(255), value TEXT)'); |
Thanks for the patch, and nope, still fails:
That's against mariadb 10.6.7, in case it matters. At least now it's the "other" test which fails :) |
But above is a fix for issue with escaping (affects only test 45bind_no_backslash_escapes.t). Which seems to be fixed? |
On Thu, 07 Apr 2022 11:37:45 -0700, pali wrote:
But above is a fix for issue with escaping (affects only test
45bind_no_backslash_escapes.t). Which seems to be fixed?
Correct, I can't reproduce this failure anymore.
But now I see the other one as well, which was not present back then.
…--
.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
`-
|
Perfect! So at least something as a first step :-)
Please report separate issue. Ideally one issue for one failure as different failures needs different investigation and different fix. |
Alright, that's #167 now |
…ES properly Fixes failing test t/45bind_no_backslash_escapes.t See: perl5-dbi#164
Pull request #168 was merged so I'm closing this issue (manually). |
Upstream changes: 1.23 2023-09-10 - Add a missing break (perl5-dbi/DBD-MariaDB#163) - Signal error if mariadb_db_async_result() fails (perl5-dbi/DBD-MariaDB#162) - Update links to project website, issues and years - Fix compilation with some MariaDB client library 10.2 and 10.3 versions - Fix mariadb_use_result attribute (perl5-dbi/DBD-MariaDB#173) - Fix statements with multiple result sets in asynchronous mode - Fix mariadb_sockfd attribute for Windows - Croaks when changing AutoCommit attribute fails (perl5-dbi/dbi#104) - Various documentation and tests fixes - Fix support for MariaDB Connector/C prior to 3.1.3 version - Fix usage of Win32::GetShortPathName() in Makefile.PL - Build release tarball in TAR format (instead of PAX) - Allow to query and change mariadb_multi_statements attribute - Add connect option mariadb_auth_plugin for specifying auth plugin - Fix support for MySQL 8.0+ client library (perl5-dbi/DBD-MariaDB#191) (perl5-dbi/DBD-mysql#329) - Add Github Actions CI and Cirrus CI (FreeBSD) for automated testing 1.22 2022-04-22 - Disable usage of libmysqld.a from MySQL 8.x series - Install README.pod into DBD/MariaDB/ subdirectory (perl5-dbi/DBD-MariaDB#146) - Do not export driver private C functions - Fix typo in error message - Fix compatibility with new MariaDB client and server versions (perl5-dbi/DBD-MariaDB#164) (perl5-dbi/DBD-MariaDB#167) (perl5-dbi/DBD-mysql#333)
As reported by the auto-build tools of openSUSE Tumbleweed, I cloned the git repo on Tumbleweed and was able to reproduce/confirm the failures
The text was updated successfully, but these errors were encountered: