Roundup Tracker - Issues

Issue 2551066

classification
Title: Traceback in email gateway
Type: crash Severity: normal
Components: Mail interface Versions: 2.0.0alpha
process
Status: open Resolution: remind
Dependencies: Superseder:
Assigned To: schlatterbeck Nosy List: rouilj, schlatterbeck
Priority: Keywords: NeedsTesting

Created on 2019-10-09 13:59 by schlatterbeck, last changed 2019-10-25 00:10 by rouilj.

Messages
msg6719 Author: [hidden] (schlatterbeck) Date: 2019-10-09 13:59
With python2 I'm getting a traceback in the email gateway when
processing an IMAP mailbox:

roundup@tux5:~$ roundup-mailgw /var/lib/tracker/tracker-home/ imap
tracker@example.com:verysecret@tux2
Traceback (most recent call last):
  File "/usr/local/bin/roundup-mailgw", line 6, in <module>
    run()
  File
"/usr/local/lib/python2.7/dist-packages/roundup/scripts/roundup_mailgw.py",
line 226, in run
    sys.exit(main(sys.argv))
  File
"/usr/local/lib/python2.7/dist-packages/roundup/scripts/roundup_mailgw.py",
line 220, in main
    cram)
  File "/usr/local/lib/python2.7/dist-packages/roundup/mailgw.py", line
1363, in do_imap
    self.handle_Message(message_from_bytes(s, RoundupMessage))
  File "/usr/lib/python2.7/email/__init__.py", line 57, in
message_from_string
    return Parser(*args, **kws).parsestr(s)
  File "/usr/lib/python2.7/email/parser.py", line 82, in parsestr
    return self.parse(StringIO(text), headersonly=headersonly)
TypeError: StringIO() argument 1 must be string or buffer, not _io.BytesIO


It looks to me like a BytesIO instance is passed to the email package
message_from_string (aliased in roundup to message_from_bytes for
python2) instead of bytes, so this should use getvalue() on the BytesIO
instance for passing to the email Parser.

Didn't anybody use the email gateway so far?
I wonder how this could last so long without being detected?
msg6720 Author: [hidden] (rouilj) Date: 2019-10-09 14:30
Hi Ralf:

Email interfaces other than pipe and mailbox are untested
post python3 conversion.

See: https://issues.roundup-tracker.org/issue2550974

I have that as one of my CTA in the 2.0.0alpha announcements.

-- rouilj
msg6721 Author: [hidden] (schlatterbeck) Date: 2019-10-09 16:21
Pushed a fix in 7264b2e79a31
Adding a test is hard as it would have to somehow emulate imap (or
instrument the imap handling somehow).

Anybody could give this a check?
Works for me for now with python2, tested also with python3 in debug mode.

Leaving this open for now, should get some more testing.
msg6767 Author: [hidden] (rouilj) Date: 2019-10-25 00:10
I requested assistance in testing this in the 2.0.0alpha0 release notes.
History
Date User Action Args
2019-10-25 00:10:30rouiljsetmessages: + msg6767
2019-10-20 21:35:19rouiljsetkeywords: + NeedsTesting
resolution: fixed -> remind
2019-10-11 01:59:58rouiljsettype: crash
2019-10-09 16:21:25schlatterbecksetstatus: new -> open
resolution: fixed
messages: + msg6721
2019-10-09 14:30:05rouiljsetnosy: + rouilj
messages: + msg6720
2019-10-09 13:59:19schlatterbeckcreate