Page MenuHomePhorge

Bugs logged for pykolab
Closed, ResolvedPublic

Description

Centos 7/Winterfell
pykolab-0.9.0-2.2.el7.kolab_wf.noarch

Since some days every 5 Minutes an error gets logged by pykolab, everything works but it is quite annoying...

2022-09-03 08:33:22,375 pykolab.auth ERROR [20004] An error occured using _persistent_search: TypeError('an integer is required',)
2022-09-03 08:33:22,376 pykolab.auth ERROR [20004] Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 3219, in _search
    secondary_domains
  File "<string>", line 10, in <module>
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 2931, in _persistent_search
    secondary_domains=secondary_domains
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 2761, in _synchronize_callback
    eval("self._change_none_%s(entry, change_dict)" % (entry['type']))
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 2310, in _change_none_user
    if not self.imap.user_mailbox_exists(entry[result_attribute]):
  File "/usr/lib/python2.7/site-packages/pykolab/imap/__init__.py", line 862, in user_mailbox_exists
    return self.has_folder('user%s%s' %(self.get_separator(), mailbox_base_name))
  File "/usr/lib/python2.7/site-packages/pykolab/imap/__init__.py", line 898, in has_folder
    log.debug(_("Looking for folder '%s', we found folders: %r") % (folder, [self.folder_utf8(x) for x in folders]), level=8)
  File "/usr/lib/python2.7/site-packages/pykolab/imap/__init__.py", line 302, in folder_utf8
    return imap_utf7.decode(folder)
  File "/usr/lib/python2.7/site-packages/pykolab/imap_utf7.py", line 116, in decode
    res.append(chr(c))
TypeError: an integer is required

2022-09-03 08:33:22,444 pykolab.auth ERROR [20004] An error occured using _paged_search: TypeError('an integer is required',)
2022-09-03 08:33:22,445 pykolab.auth ERROR [20004] Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 3219, in _search
    secondary_domains
  File "<string>", line 10, in <module>
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 2983, in _paged_search
    callback(entry=_result_data)
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 2814, in _synchronize_callback
    eval("self._change_none_%s(entry, None)" % (entry['type']))
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/pykolab/auth/ldap/__init__.py", line 2310, in _change_none_user
    if not self.imap.user_mailbox_exists(entry[result_attribute]):
  File "/usr/lib/python2.7/site-packages/pykolab/imap/__init__.py", line 862, in user_mailbox_exists
    return self.has_folder('user%s%s' %(self.get_separator(), mailbox_base_name))
  File "/usr/lib/python2.7/site-packages/pykolab/imap/__init__.py", line 898, in has_folder
    log.debug(_("Looking for folder '%s', we found folders: %r") % (folder, [self.folder_utf8(x) for x in folders]), level=8)
  File "/usr/lib/python2.7/site-packages/pykolab/imap/__init__.py", line 302, in folder_utf8
    return imap_utf7.decode(folder)
  File "/usr/lib/python2.7/site-packages/pykolab/imap_utf7.py", line 116, in decode
    res.append(chr(c))
TypeError: an integer is required

Details

Ticket Type
Task

Event Timeline

I believe there's an integer conversion missing in line 116 of pykolab/imap_utf7.py - it should probably be:

res.append(chr(int(c)))

Correction: that simple fix apparently doesn't do the trick.

D3851

res.append(c)

Just remove chr()
c is single character of a string, but not an integer value of a character.
I could see via grep, decode(s) is used with folders in modules used for imap

for c in s:

See also https://git.kolab.org/diffusion/P/browse/pykolab-0.7/pykolab/imap_utf7.py line 52 , 74

The fix works when applied by hand but does not yet show up in update package.

The fix is accepted into git.
But as I ran into another Error, you should also use the latest Diff 11060.

# No buffer initialized yet, should be an ASCII printable char
elif isinstance(c, int):
    res.append(chr(c))
else:
    res.append(c)

The fix is first uploaded to git and needs to be reviewed and accepted into git, after packaging in OBS testing and some testing,
it is inserted into the official packages.

machniak lowered the priority of this task from Needs Triage to Normal.Sep 27 2023, 11:24 AM
machniak added a project: PyKolab.