Opened 15 years ago
Closed 15 years ago
#8546 closed defect (duplicate)
bugzilla2trac.py: Attachments are copied incorrectly
Reported by: | Owned by: | Jeroen Ruigrok van der Werven | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | ticket system | Version: | none |
Severity: | normal | Keywords: | bugzilla2trac |
Cc: | remke.rutgers@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I am using bugzilla2trac.py to convert existing bugzilla data into Trac and it works quite nice. I did have an issue with attachments however. The software versions I am using are (and I cannot upgrade, because I am not the system administrator):
- Python: 2.3.4
- Bugzilla: 3.0.2
- Mysql: 4.0.18
- Trac: 0.10.4
- bugzilla2trac.py: revision 8272
- MySQL-python: 1.2.1_p2
In my bugzilla2trac.py I used: BZ_VERSION = 2233
The script works, but all attachments are corrupt. Instead of the original bytes, I see the array representation in the newly created attachments. A gif file starts for example:
array('c', 'GIF89aD\x02\xff\x00\xf7\x00\x00\x00\x00\x00\x00+S\x0 …..
I am a complete Python newbie, but managed to get correct attachments by changing:
line 436 filedata = StringIO.StringIO(a['thedata'])
into:
filedata = StringIO.StringIO(a['thedata'].tostring())
Apparently,
a['thedata']
is a character array and StringIO.StringIO uses str(buffer) to construct a file object.
By the way (don't know if it is relevant): the data column in my 'attach_data' bugzilla table is a LONGBLOB and the table itself is a MyISAM table.
My change to line 436 works, but I don't understand why it is necessary. Is it simply because I am using old versions of Python or Trac? Is it because I am using a newer version of Mysql or a newer version of Bugzilla than anticipated?
Personally, I can manage with my local change as a workaround, but I would like somebody who really understands how things are working to judge if my change should be applied as a patch (or not).
Attachments (0)
Change History (6)
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 15 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:4 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
I think the issue I posted here is exactly the same as #6792.