Bug #57537 get_local_ip_list() implementation in mysql-workbench-5.2.29 is broken
Submitted: 18 Oct 2010 19:31 Modified: 24 Nov 2010 15:43
Reporter: Hans de Graaff Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.2.29 OS:Linux (Gentoo, probably others)
Assigned to: Maksym Yehorov CPU Architecture:Any

[18 Oct 2010 19:31] Hans de Graaff
The new get_local_ip_list() implementation is broken in several ways.

First of all it has no sane fallback, leading to whole administration module not being available anymore when there are problems:

Traceback (most recent call last):
  File "/usr/lib64/mysql-workbench/modules/wb_admin_grt.py", line 28, in <module>
    import wb_admin_configuration
  File "/usr/lib64/mysql-workbench/modules/wb_admin_configuration.py", line 8, in <module>
    from wb_admin_config_file_ui import WbAdminConfigFileUI
  File "/usr/lib64/mysql-workbench/modules/wb_admin_config_file_ui.py", line 6, in <module>
    import wb_admin_config_file_be
  File "/usr/lib64/mysql-workbench/modules/wb_admin_config_file_be.py", line 15, in <module>
    from wb_server_control import ServerProfile
  File "/usr/lib64/mysql-workbench/modules/wb_server_control.py", line 40, in <module>
    local_ip_list = get_local_ip_list()
  File "/usr/lib64/mysql-workbench/modules/wb_server_control.py", line 28, in get_local_ip_list
    result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
  File "/usr/lib64/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
** Message: Failed loading module '/usr/lib64/mysql-workbench/modules/wb_admin_grt.py' (python)

Furthermore, this failure occurs on Gentoo systems because ifconfig is not in the default user path, and hopefully the same applies for any other decently configured unix system. It's an administration tool and shouldn't be available by default to normal users. FWIW, on Gentoo it is available as /sbin/ifconfig, if the system user has chosen to install it. Its presence isn't guaranteed.

Finally, the current code doesn't take IPv6 addresses into account.

How to repeat:
Try to run mysql-workbench.

Suggested fix:
This whole approach of running an external tool seems very fishy to me, but I can't easily provide you with an alternative. At least it should:

- deal with problems and possibly print a warning about it
- deal with IPv6
[19 Oct 2010 9:52] Maksym Yehorov
Added exception handling.
[29 Oct 2010 17:34] Eduardo Coasaca
I had the same problem with: MySQLWorkbench 5.2.29 compiled from tar.gz src and running on my Slackware 13.1.
get_local_ip_list() function uses a Python "subprocess.Popen" to call internally the "linux ifconfig command" so it retrieves the stdout result and parses it to get the IP lists of the current machine. However, on Slackware (and probably some other low user-level permission for the /sbin/ifconfig commmand) users cannot access the ifconfig command, so it causes the admin plugin not to be loaded.

My Solution: (SLACKWARE 13.1)
- cd /usr/bin; ln -s /sbin/ifconfig

I didnt give access to /sbin, just create a symbolink link to /sbin/ifconfig into /usr/bin for all users

other solution could be to add /sbin to the PATH

good luck
[23 Nov 2010 17:14] Johannes Taxacher
fixed in current release (5.2.30)
[24 Nov 2010 15:43] Tony Bedford
An entry has been added to the 5.2.30 changelog:

The implementation of get_local_ip_list() had several problems:

It did not have a graceful fallback state in the event of errors.

Failed due to ifconfig not being on the default user path.

It did not handle IPv6 addresses.