ParserError parsing vcard string where ORG attribute contains a comma ","

Bug #725839 reported by Diane Trout
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-vobject (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python-vobject

I'm using ubuntu 10.10 with python-vobject Version: 0.8.1c-3

I was parsing all the vcard files from evolution using python-evolution. I discovered that some of my entries had an ORG value with an embedded comma.

I was able to trigger the problem with this example vcard.

vobject.readOne('BEGIN:VCARD\r\nVERSION:3.0\r\nFN:fn\r\nN:n;;;;\r\nORG:Name\\, A&B.;\r\nEND:VCARD\r\n')

with the version in the ubuntu repository I get the stack trace.

Traceback (most recent call last):
  File "abeds.py", line 179, in <module>
    sys.exit(main())
  File "abeds.py", line 34, in main
    foaf([])
  File "abeds.py", line 48, in foaf
    vc_contact = vobject.readOne(vc_string)
  File "/usr/lib/pymodules/python2.6/vobject/base.py", line 1082, in readOne
    ignoreUnreadable, allowQP).next()
  File "/usr/lib/pymodules/python2.6/vobject/base.py", line 1059, in readComponents
    if transform: component.transformChildrenToNative()
  File "/usr/lib/pymodules/python2.6/vobject/base.py", line 601, in transformChildrenToNative
    childArray[i]=childArray[i].transformToNative()
  File "/usr/lib/pymodules/python2.6/vobject/base.py", line 122, in transformToNative
    return self.behavior.transformToNative(self)
  File "/usr/lib/pymodules/python2.6/vobject/vcard.py", line 290, in transformToNative
    obj.value = splitFields(obj.value)
  File "/usr/lib/pymodules/python2.6/vobject/vcard.py", line 213, in splitFields
    stringToTextValues(string, listSeparator=';', charList=';')]
  File "/usr/lib/pymodules/python2.6/vobject/icalendar.py", line 1681, in stringToTextValues
    raise ParseError("error: illegal escape sequence: '\\%s'" % (char,))
vobject.base.ParseError: At line 11: error: illegal escape sequence: '\,'

with the native version in the package before patches are applied I get:
print vobject.readOne('BEGIN:VCARD\r\nVERSION:3.0\r\nFN:fn\r\nN:n;;;;\r\nORG:Name\\, A&B.;\r\nEND:VCARD\r\n')
<VCARD| [<VERSION{}3.0>, <FN{}fn>, <N{} n >, <ORG{}[u'Name, A&B.']>]>
which is what was expecting (or at least hoping would happen)

This problem is introduced by commenting out the "leave characters in for later passes" append and adding the exception.
introduced by debian/patches/0003-Treat-untils-as-floating.patch

If I put the current.append back in and remove the raise error, the parser does read all my vcards.

I'm not sure what breaks elsewhere though.

Thanks, Diane

Revision history for this message
Michael Elkins (sigpipe) wrote :

This bug has been fixed in the debian package:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=569273#25

Hopefully we can get this changed issued for the ubuntu package.

Revision history for this message
Michael Elkins (sigpipe) wrote :

Just discovered that the -4 version of the .deb exists in pool/main/p/python-vobject. Installed and it works fine. Doesn't appear to be in maverick-proposed yet, however.

Revision history for this message
Diane Trout (diane-trout) wrote :

Yep I tried again with natty (11.04), the python-vobject installed by the upgrade process (0.8.1c-3) and my script threw the same error.

I downloaded python-vobject_0.8.1c-4_all.deb from pool/main/p/python-vobject and re-ran the script and it ran, producing output for all the random contact information that landed in my address book.

Revision history for this message
Maarten Bezemer (veger) wrote :

Precise now contains version 0.8.1c-4, which is the version that should have the fix included according to the Debian bug report. Although, later comments talk about the fix partly reverted. So, before closing this bug as fixed, could you check the latest precise version to see whether the problem is fixed or not?

Changed in python-vobject (Ubuntu):
status: New → Incomplete
Revision history for this message
Schwarzburg (stefan-schwarzburg) wrote :

in python-vobject 0.8.1c-4ubuntu1, the following does not give any error:

> print vobject.readOne('BEGIN:VCARD\r\nVERSION:3.0\r\nFN:fn\r\nN:n;;;;\r\nORG:Name\\, A&B.;\r\nEND:VCARD\r\n')

<VCARD| [<VERSION{}3.0>, <FN{}fn>, <N{} n >, <ORG{}[u'Name, A&B.']>]>

therefore I would conclude that this problem is fixed.

Revision history for this message
Maarten Bezemer (veger) wrote :

This bug report is being closed due to your last comment regarding this being fixed with an update. For future reference you can manage the status of your own bugs by clicking on the current status in the yellow line and then choosing a new status in the revealed drop down box. You can learn more about bug statuses at https://wiki.ubuntu.com/Bugs/Status. Thank you again for taking the time to report this bug and helping to make Ubuntu better. Please submit any future bugs you may find.

Changed in python-vobject (Ubuntu):
status: Incomplete → 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.