Smart URL parsing isn't too smart =)

Cliff Wells cliff at develix.com
Fri May 16 12:01:47 PDT 2008


I just caught an error in how smart parses URL from its config files.

Given a line such as

baseurl=http://blah/blah?arch=i386

smart throws an exception because it expects to only find one "equals"
sign in the string.  

[root at portableevil ~]# smart update
Traceback (most recent call last):
  File "/usr/bin/smart", line 194, in <module>
    main(sys.argv[1:])
  File "/usr/bin/smart", line 165, in main
    initPlugins()
  File "/usr/lib/python2.5/site-packages/smart/__init__.py", line 188,
in initPlugins
    __import__("smart.plugins."+entry[:-3])
  File "/usr/lib/python2.5/site-packages/smart/plugins/channelsync.py",
line 200, in <module>
    syncChannels(sysconf.get("channel-sync-dir", CHANNELSDIR))
  File "/usr/lib/python2.5/site-packages/smart/plugins/channelsync.py",
line 50, in syncChannels
    descriptions = parseChannelsDescription(data)
  File "/usr/lib/python2.5/site-packages/smart/channel.py", line 266, in
parseChannelsDescription
    key, value = line.split("=")
ValueError: too many values to unpack

Luckily the fix is easy as well, simply change line 266 from:

    line.split("=")

to:

    line.split("=", 1)



Regards,
Cliff




More information about the Smart mailing list