Bug 18101 - Encoding-Traceback in UCR wenn nicht UTF-8 Zeichen in base.conf stehen
Encoding-Traceback in UCR wenn nicht UTF-8 Zeichen in base.conf stehen
Status: RESOLVED WORKSFORME
Product: UCS Test
Classification: Unclassified
Component: UCR
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
:
Depends on: 16637
Blocks: 18006
  Show dependency treegraph
 
Reported: 2010-04-12 11:11 CEST by Andreas Büsching
Modified: 2020-10-01 12:21 CEST (History)
7 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Büsching univentionstaff 2010-04-12 11:11:14 CEST
Es sollte ein Test-Skript geben, dass das Encoding der Werte in UCR überprüft. Wenn diese nicht UTF-8 kodiert sind, sollte es einen Fehler geben.

+++ This bug was initially created as a clone of Bug #16637 +++

Bei dem Versuch den AD-Connector über die UMC einzurichten trat der folgende
Fehler beim Speichern der Konfiguration auf:


------------
Die Ausführung des Kommandos 'adconnector/configure' ist fehlgeschlagen:

Traceback (most recent call last):
  File
"/usr/lib/python2.4/site-packages/univention/management/console/handlers/__init__.py",
line 180, in execute
    func( object )
  File
"/usr/lib/python2.4/site-packages/univention/management/console/handlers/adconnector/__init__.py",
line 212, in configure
    univention.config_registry.handler_set( [ u'%s=%s' % (ucrkey, val) ] )
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line
869, in handler_set
    reg.save()
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line
126, in save
    self._registry[ self._write_registry ].save()
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line
275, in save
    self.__save_file(filename)
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line
260, in __save_file
    fp.write(self.__str__())
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line
296, in __str__
    return '\n'.join(['%s: %s' % (key, self.removeInvalidChars (val)) for key,
val in self.items()])
  File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 15-18: invalid
data
-----------

Und hier der Relevante Ausschnitt aus der umc-modules.log Datei:
30.11.09 15:21:42  ADMIN       ( INFO    ) : modserver.py: _recv:
msg._id=125959089695400-16
UNIVENTION_DEBUG_BEGIN  : adconnector.handler.configure
30.11.09 15:21:42  ADMIN       ( INFO    ) : ...dconnector/__init__.py:174:
configure: options={'ad_mapping_group_language': u'de', 'ad_ldap_binddn':
u'cn=Administrator,cn=users,DC=w2k3', 'ad_windows_version': u'win2003',
'ad_poll_sleep': u'5', 'debug_level': u'_1_', 'ad_mapping_sync_mode': u'sync',
'ad_retry_rejected': u'10', 'ad_ldap_host': u'win2k3.ad2003.local',
'ad_ldap_base': u'DC=w2k3', 'ad_ldap_bindpw': u'univention', 'action': 'save',
'debug_function': u'_1_'}
30.11.09 15:21:42  ADMIN       ( INFO    ) : ...dconnector/__init__.py:211:
setting connector/ad/ldap/host=win2k3.ad2003.local
UNIVENTION_DEBUG_END    : adconnector.handler.configure



Der Connector war in Version 4.1.2-1.134.200910221141 installiert.
Comment 1 Janek Walkenhorst univentionstaff 2010-04-12 11:41:34 CEST
Vorschlag:
iconv -f utf-8 -t utf-8 > /dev/zero < /etc/univention/base.conf
Comment 2 Tobias Scherer univentionstaff 2010-05-31 12:09:45 CEST
Auch aufgetreten an Ticket#: 2010052510000817

Die AusfÃŒhrung des Kommandos 'wizard/mailserver/set' ist fehlgeschlagen:
 
 Traceback (most recent call last):
   File
 "/usr/lib/python2.4/site-packages/univention/management/console/handlers/__init__.py",
 line 180, in execute
     func( object )
   File
 "/usr/lib/python2.4/site-packages/univention/management/console/wizards/mailserver/__init__.py",
 line 121, in mailserver_set
     ub.handler_set( [ 'mail/messagesizelimit=%s' % object.options[ 'messagesizelimit' ] ]
 )
   File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 869, in
 handler_set
     reg.save()
   File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 126, in save
     self._registry[ self._write_registry ].save()
   File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 275, in save
     self.__save_file(filename)
   File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 260, in
 __save_file
     fp.write(self.__str__())
   File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 296, in
 __str__
     return '\n'.join(['%s: %s' % (key, self.removeInvalidChars (val)) for key, val in
 self.items()])
   File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
     return codecs.utf_8_decode(input, errors, True)
 UnicodeDecodeError: 'utf8' codec can't decode bytes in position 11-12: invalid data
Comment 3 Florian Best univentionstaff 2020-10-01 12:21:37 CEST
Via command line it seems not possible to set non-utf8 values:
ucr set foo=$(python -c "print u'ä'.encode('latin-1')")

And also not via handler_set():
python -c 'from univention.config_registry import handler_set; handler_set([u"foo=bär".encode("latin-1")])'