Config string parsing fails if value contains an '='

Bug #1408317 reported by Jean-Baptiste Lallement
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Autopilot
Fix Released
Medium
Christopher Lee
autopilot (Ubuntu)
Fix Released
Undecided
Unassigned
Vivid
New
Undecided
Unassigned

Bug Description

Config string parsing fails if the value of a parameter contains an '='.

For example with ubuntu-sanity-tests if the WiFi passphrase contains an '=' it fails with:
=====
Traceback (most recent call last):
  File "/tmp/adt-run.YAwQfE/build.3M3/real-tree/ubuntu_sanity_tests/tests/test_settings_wizard.py", line 46, in setUp
    self._apply_default_config()
  File "/tmp/adt-run.YAwQfE/build.3M3/real-tree/ubuntu_sanity_tests/tests/test_settings_wizard.py", line 55, in _apply_default_config
    config = get_test_configuration()
  File "/tmp/adt-run.YAwQfE/deps/usr/lib/python3/dist-packages/autopilot/_config.py", line 67, in get_test_configuration
    return ConfigDict(_test_config_string)
  File "/tmp/adt-run.YAwQfE/deps/usr/lib/python3/dist-packages/autopilot/_config.py", line 84, in __init__
    "Invalid configuration string '{}'".format(config_string)
ValueError: Invalid configuration string 'device_password=0000,output_dir=./results,sim_0_pin=0000,wifi_password=password_with_an_=_sign,wifi_ssid=MyAccessPoint'
=====

This is because the string key=value is split on '=' without limit. A possible patch is:
====
=== modified file 'autopilot/_config.py'
--- autopilot/_config.py 2014-05-21 07:42:24 +0000
+++ autopilot/_config.py 2015-01-07 14:05:34 +0000
@@ -74,7 +74,7 @@
         for item in config_string.split(','):
             if not item:
                 continue
- parts = item.split('=')
+ parts = item.split('=', 1)
             if len(parts) == 1:
                 self._data[parts[0].lstrip()] = '1'
             elif len(parts) == 2:
====

Related branches

Changed in autopilot:
importance: Undecided → Medium
status: New → Triaged
Changed in autopilot:
status: Triaged → In Progress
assignee: nobody → Christopher Lee (veebers)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:autopilot at revision None, scheduled for release in autopilot, milestone 1.4

Changed in autopilot:
status: In Progress → Fix Committed
Changed in autopilot:
status: Fix Committed → Fix Released
Changed in autopilot (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.