Bug 481540 - pydot crashes with character with accent
Summary: pydot crashes with character with accent
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pydot
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-26 08:04 UTC by Pierre-YvesChibon
Modified: 2009-07-29 09:20 UTC (History)
2 users (show)

Fixed In Version: 1.0.2-4.fc10
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-07-11 17:29:04 UTC


Attachments (Terms of Use)
Fix reversed return values from need_quote() (1.18 KB, patch)
2009-05-29 07:58 UTC, Toshio Ernie Kuratomi
no flags Details | Diff

Description Pierre-YvesChibon 2009-01-26 08:04:58 UTC
Description of problem:
Running this simple lines of code make pydot crash:

#!/usr/bin/python
#-*- coding: UTF-8 -*-


import pydot
g = pydot.Dot()
g.add_node(pydot.Node("Anne-Cécile"))
g.add_edge(pydot.Edge(src='Anne-Cécile', dst='Anne-Marie'))
g.write('test.jpg', format='raw')
g.write_jpeg('test.jpg')

Version-Release number of selected component (if applicable):
pydot-1.0.2-1.fc10.noarch


How reproducible:
Always

Steps to Reproduce:
1.Run the code given above
2.Enjoy :)
3.
  
Actual results:
>>> g.write_jpeg('test.jpg')
Anne-Cécile [195, 169]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/pydot.py", line 1603, in <lambda>
    lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog))
  File "/usr/lib/python2.5/site-packages/pydot.py", line 1697, in write
    dot_fd.write(self.create(prog, format))
  File "/usr/lib/python2.5/site-packages/pydot.py", line 1797, in create
    status, stderr_output) )
pydot.InvocationException: Program terminated with status: 6. stderr follows: Error: /tmp/tmpVEABbQ:2: syntax error near line 2
context:  >>> Anne- <<< Cécile;


Expected results:
>>> g.write_jpeg('test.jpg')
True


Additional info:
I managed to solve it by a dirty solution:

I commented these lines:
line 157
#    chars = [ord(c) for c in s if ord(c)>0x7f or ord(c)==0]
#    if chars:
#        print s, chars
#        return False
line 162
of the file /usr/lib/python2.5/site-packages/pydot.py

It's probably more a bug to report upstream but I have not find place where to do so...

Thanks for your help :)

Comment 1 Tom "spot" Callaway 2009-02-03 20:25:49 UTC
Filed upstream:

http://code.google.com/p/pydot/issues/detail?id=23

I poked this for a while and couldn't come up with a fix.

Comment 2 Pierre-YvesChibon 2009-02-03 20:36:31 UTC
Thanks for reporting it.

What do you think of the 4 lines I commented ?

Comment 3 Tom "spot" Callaway 2009-02-03 20:41:28 UTC
Well, its not a real fix, for sure. I tried all sorts of things in that section of code to fix it properly, but without success.

Comment 4 Toshio Ernie Kuratomi 2009-05-29 07:29:38 UTC
There's some sort of bug in needs_quotes() and quote_if_necessary() but I haven't unravelled it yet.  It almost looks like needs_quotes() is returning the opposite values as it should.  ie: Returning False when quotes are needed and True when they aren't.  But at least one of the tests (id_re_dbl_quoted.match) is wrong if I just change every True to False and False to True.  So I need to understand that section of code a little bit better.

Comment 5 Toshio Ernie Kuratomi 2009-05-29 07:58:15 UTC
Created attachment 345862 [details]
Fix reversed return values from need_quote()

I think this is right but if you use this module with any frequency, a bit of testing would be appreciated :-)

Some of the return values were reversed in needs_quote() but regex checks were returning the correct value.  This patch should fix things up.

Comment 6 Toshio Ernie Kuratomi 2009-05-29 08:00:37 UTC
My test case was:

#!/usr/bin/python
#-*- coding: UTF-8 -*-

import pydot
n1 = u'Th\xe9r\xe8se Doe'
n2 = u'Jean-Pierre Tou\xe9'
g = pydot.Dot()
g.add_node(pydot.Node(n1.encode('utf-8')))
g.add_edge(pydot.Edge(src=n1.encode('utf-8'), dst=n2.encode('utf-8')))
g.write('test.dot', format='raw')
g.write_jpeg('test.jpg')

Comment 7 Fedora Update System 2009-07-06 13:34:45 UTC
pydot-1.0.2-4.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/pydot-1.0.2-4.fc10

Comment 8 Fedora Update System 2009-07-06 13:34:50 UTC
pydot-1.0.2-4.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/pydot-1.0.2-4.fc11

Comment 9 Fedora Update System 2009-07-11 17:29:00 UTC
pydot-1.0.2-4.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2009-07-11 17:30:13 UTC
pydot-1.0.2-4.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Pierre-YvesChibon 2009-07-29 09:20:00 UTC
I just wanted to thank Toshio for the patch and Tom to push it, it works great for me :-)


Note You need to log in before you can comment on or make changes to this bug.