Bug #76839 mysqlindexcheck AttributeError: 'NoneType' object has no attribute 'replace'
Submitted: 26 Apr 2015 13:56 Modified: 27 Jul 2015 21:35
Reporter: Shahriyar Rzayev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S1 (Critical)
Version:1.5.4 OS:Linux (CentOS 7)
Assigned to: CPU Architecture:Any

[26 Apr 2015 13:56] Shahriyar Rzayev
Description:
Testing mysqlindexcheck utility as follows:

[root@node1 ~]# mysqlindexcheck -- 
WARNING: Using a password on the command line interface can be insecure.
Usage: mysqlindexcheck --server=user:pass@host:port:socket db1.table1 db2 db3.table2

mysqlindexcheck: error: You must specify at least one table or database to check.

1. Warning is showing up even without typing any password

[root@node1 ~]# mysqlindexcheck -- kkjsndkfnsd
WARNING: Using a password on the command line interface can be insecure.
# Source on localhost: ... 
ERROR: Access denied for user 'root'@'localhost' (using password: NO)

It will consider string after '--' as database name, even we do not specify connection information.

If you specify employees. with 'dot' and no table name:

[root@node1 ~]# mysqlindexcheck --server=root:12345@localhost:3306 -vvv employees. --stats --show-drops --show-indexes -r
WARNING: Using a password on the command line interface can be insecure.
# Source on localhost: ... connected.
# Checking indexes...
Traceback (most recent call last):
  File "/usr/bin/mysqlindexcheck", line 167, in <module>
    indexcheck.check_index(source_values, args, options)
  File "/usr/lib/python2.7/site-packages/mysql/utilities/command/indexcheck.py", line 119, in check_index
    tbl = Table(source, table_name, tbl_options)
  File "/usr/lib/python2.7/site-packages/mysql/utilities/common/table.py", line 343, in __init__
    self.q_tbl_name = quote_with_backticks(self.tbl_name)
  File "/usr/lib/python2.7/site-packages/mysql/utilities/common/sql_transform.py", line 99, in quote_with_backticks
    return "`" + identifier.replace("`", "``") + "`"
AttributeError: 'NoneType' object has no attribute 'replace'

How to repeat:
Necessary steps are provided.

Suggested fix:
Definitely if there is no valid --server option and information do not accept any other option. Because without server connection this tool does not work.
[27 Apr 2015 5:45] MySQL Verification Team
Hello Shahriyar,

Thank you for the report.

Thanks,
Umesh
[27 Apr 2015 5:46] MySQL Verification Team
// 1.5.4

[root@cluster-repo mysql-5.7.8]# mysqlindexcheck  --server=root@localhost:15000 -vvv test.
WARNING: Using a password on the command line interface can be insecure.
# Source on localhost: ... connected.
# Checking indexes...
Traceback (most recent call last):
  File "/usr/bin/mysqlindexcheck", line 167, in <module>
    indexcheck.check_index(source_values, args, options)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/command/indexcheck.py", line 119, in check_index
    tbl = Table(source, table_name, tbl_options)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/table.py", line 343, in __init__
    self.q_tbl_name = quote_with_backticks(self.tbl_name)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/sql_transform.py", line 99, in quote_with_backticks
    return "`" + identifier.replace("`", "``") + "`"
AttributeError: 'NoneType' object has no attribute 'replace'
[root@cluster-repo mysql-5.7.8]#
[root@cluster-repo mysql-5.7.8]# mysqlindexcheck  --server=root@localhost:15000 -vvv test. --stats --show-drops --show-indexes -r
WARNING: Using a password on the command line interface can be insecure.
# Source on localhost: ... connected.
# Checking indexes...
Traceback (most recent call last):
  File "/usr/bin/mysqlindexcheck", line 167, in <module>
    indexcheck.check_index(source_values, args, options)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/command/indexcheck.py", line 119, in check_index
    tbl = Table(source, table_name, tbl_options)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/table.py", line 343, in __init__
    self.q_tbl_name = quote_with_backticks(self.tbl_name)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/sql_transform.py", line 99, in quote_with_backticks
    return "`" + identifier.replace("`", "``") + "`"
AttributeError: 'NoneType' object has no attribute 'replace'
[27 Jul 2015 21:35] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Utilities 1.5.5 / 1.6.2 releases, and here's the changelog entry:

The mysqlindexcheck utility would accept options and execute when an
invalid --server option was passed. A valid server connection is now
required. Also, the utility would report "Using a password on the command
line interface can be insecure." even when a password was not used.

Thank you for the bug report.
[11 Aug 2015 22:40] Philip Olson
Correction: This bug fix only applies to 1.6.2, and not 1.5.5.