Bug #78316 UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0
Submitted: 3 Sep 2015 17:50 Modified: 10 Sep 2015 4:24
Reporter: Shahriyar Rzayev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities Severity:S3 (Non-critical)
Version:1.5.4, 1.5.5 OS:Linux (Any)
Assigned to: CPU Architecture:Any

[3 Sep 2015 17:50] Shahriyar Rzayev
Description:
Just want to append `ls` command 

sh@sh--home:~$ mysqluserclone --source=`ls`:12345@localhost:3306 --destination=root:12345@localhost:3306 'root'@'localhost' admin:12345@localhost --force -vvv
WARNING: Using a password on the command line interface can be insecure.
Traceback (most recent call last):
  File "/usr/bin/mysqluserclone", line 138, in <module>
    source_values = parse_connection(opt.source, None, opt)
  File "/usr/lib/python2.7/dist-packages/mysql/utilities/common/ip_parser.py", line 364, in parse_connection
    config_path_data = handle_config_path(config_path, group)
  File "/usr/lib/python2.7/dist-packages/mysql/utilities/common/ip_parser.py", line 243, in handle_config_path
    opt_par = MySQLOptionsParser(file_loc)
  File "/usr/lib/python2.7/dist-packages/mysql/utilities/common/options_parser.py", line 79, in __init__
    self._parse_options(list(self.files))
  File "/usr/lib/python2.7/dist-packages/mysql/utilities/common/options_parser.py", line 138, in _parse_options
    read_files = self.read(files)
  File "/usr/lib/python2.7/dist-packages/mysql/utilities/common/options_parser.py", line 160, in read
    for line in codecs.open(filename, encoding='utf-8'):
  File "/usr/lib/python2.7/codecs.py", line 681, in next
    return self.reader.next()
  File "/usr/lib/python2.7/codecs.py", line 612, in next
    line = self.readline()
  File "/usr/lib/python2.7/codecs.py", line 527, in readline
    data = self.read(readsize, firstline=True)
  File "/usr/lib/python2.7/codecs.py", line 474, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte

Same thing with ordinary python run:

sh@sh--home:~$ python `ls`
  File "2014-10-19-182038_1024x600_scrot.png", line 1
SyntaxError: Non-ASCII character '\x89' in file 2014-10-19-182038_1024x600_scrot.png on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

How to repeat:
directory list is:

sh@sh--home:~$ ls
2014-10-19-182038_1024x600_scrot.png  Desktop    guvcview_image-1.jpg  Music     repos            Templates
Arduino                               Documents  Mail                  Pictures  sketchbook       Videos
Arduino_Build                         Downloads  mariamole             Public    sublime_arduino  workspace

Just take a screenshot give exact name and then use mysqluserclone with inserting `ls`.

Suggested fix:
No idea.
[10 Sep 2015 4:24] MySQL Verification Team
Hello Shahriyar,

Thank you for the report.

Thanks,
Umesh
[10 Sep 2015 4:26] MySQL Verification Team
// 

[root@ushastry Desktop]# python --version
Python 2.6.6

[root@ushastry ushastry]# cat /etc/*release
CentOS release 6.6 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
CentOS release 6.6 (Final)
CentOS release 6.6 (Final)

[root@ushastry Downloads]# rpm -qa|grep mysql
mysql-utilities-commercial-1.5.5-1.el6.noarch
mysql-workbench-commercial-6.3.4-1.el6.x86_64
mysql-utilities-extra-1.5.5-1.el6.noarch
mysql-connector-python-commercial-2.1.3-1.1.el6.x86_64
[root@ushastry Downloads]# 

[root@ushastry Desktop]# mysqluserclone --source=`ls`:12345@localhost:3306 --destination=root:12345@localhost:3306 'root'@'localhost' admin:12345@localhost --force -vvv
WARNING: Using a password on the command line interface can be insecure.
Traceback (most recent call last):
  File "/usr/bin/mysqluserclone", line 138, in <module>
    source_values = parse_connection(opt.source, None, opt)
  File "/mysql/utilities/common/ip_parser.py", line 364, in parse_connection
  File "/mysql/utilities/common/ip_parser.py", line 243, in handle_config_path
  File "/mysql/utilities/common/options_parser.py", line 79, in __init__
  File "/mysql/utilities/common/options_parser.py", line 138, in _parse_options
  File "/mysql/utilities/common/options_parser.py", line 160, in read
  File "/usr/lib64/python2.6/codecs.py", line 684, in next
    return self.reader.next()
  File "/usr/lib64/python2.6/codecs.py", line 615, in next
    line = self.readline()
  File "/usr/lib64/python2.6/codecs.py", line 530, in readline
    data = self.read(readsize, firstline=True)
  File "/usr/lib64/python2.6/codecs.py", line 477, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte
[root@ushastry Desktop]# 

[root@ushastry Desktop]# python `ls`
  File "bugs_mysql_com.png", line 1
SyntaxError: Non-ASCII character '\x89' in file bugs_mysql_com.png on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details