[debian-mysql] Bug#635838: mysqldumpslow doesn't handle "...\\" correctly

Jörg Sommer joerg at alea.gnuu.de
Thu Jul 28 22:30:58 UTC 2011


Package: mysql-client-5.1
Version: 5.1.57-3
Severity: normal
Tags: patch

Hi,

% cat /tmp/ugly.log
# Time: 110726  9:21:14
# User at Host: user[user] @ localhost [::1]
# Query_time: 1  Lock_time: 0  Rows_sent: 0  Rows_examined: 413
SELECT SQL_CALC_FOUND_ROWS * FROM table WHERE column = 'http://www.example.com/index.html?id=42\\\\';

old version:
% /tmp/mysqldumpslow.orig /tmp/ugly.log

Reading mysql slow query log from /tmp/ugly.log
Count: 1  Time=1.00s (1s)  Lock=0.00s (0s)  Rows=0.0 (0), user[user]@localhost
  SELECT SQL_CALC_FOUND_ROWS * FROM table WHERE column = 'http://www.example.com/index.html?id=N\\\

new version:
% /tmp/mysqldumpslow /tmp/ugly.log

Reading mysql slow query log from /tmp/ugly.log
Count: 1  Time=1.00s (1s)  Lock=0.00s (0s)  Rows=0.0 (0), user[user]@localhost
  SELECT SQL_CALC_FOUND_ROWS * FROM table WHERE column = 'S'

% diff -u /tmp/mysqldumpslow.orig /tmp/mysqldumpslow
--- /tmp/mysqldumpslow.orig	2011-07-29 00:23:28.215764141 +0200
+++ /tmp/mysqldumpslow	2011-07-29 00:23:27.177763970 +0200
@@ -124,8 +124,9 @@
 	s/\b0x[0-9A-Fa-f]+\b/N/g;
         s/''/'S'/g;
         s/""/"S"/g;
-        s/(\\')//g;
-        s/(\\")//g;
+        # You don't have to worry about \' at begin of line, because
+        # leading whitespace is normalized.
+        s/[^\\](?:\\\\)*(?:\\['"])//g;
         s/'[^']+'/'S'/g;
         s/"[^"]+"/"S"/g;
 	# -n=8: turn log_20001231 into log_NNNNNNNN

Bye, Jörg.

-- System Information:
Debian Release: unstable/experimental
  APT prefers unstable
  APT policy: (900, 'unstable'), (700, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 3.0.0-rc7.ledtest-00088-g1765a36-dirty
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature http://en.wikipedia.org/wiki/OpenPGP
URL: <http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20110729/50be94c3/attachment.pgp>


More information about the pkg-mysql-maint mailing list