[ovs-git] [openvswitch/ovs] c7ea0e: python: Fix a double encoding attempt on an Unicod...

GitHub noreply at github.com
Wed Apr 18 18:34:07 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: c7ea0e6b7991c94530636d92afb87d3dfee96056
      https://github.com/openvswitch/ovs/commit/c7ea0e6b7991c94530636d92afb87d3dfee96056
  Author: Jakub Sitnicki <jkbs at redhat.com>
  Date:   2018-04-18 (Wed, 18 Apr 2018)

  Changed paths:
    M python/ovs/stream.py

  Log Message:
  -----------
  python: Fix a double encoding attempt on an Unicode string

Encoding from 'unicode' to 'str' that has been added to the Stream class
in commit 2254074e3067 ("python: fix python3 encode/decode on Windows")
conflicts with SSLStream which already contains a quirk for pyopenssl
that does the same thing.

This results in a double encoding attempt when SSL is used and we crash
and burn due to:

Traceback (most recent call last):
  File "../.././test-ovsdb.py", line 874, in <module>
    main(sys.argv)
  File "../.././test-ovsdb.py", line 869, in main
    func(*args)
  File "../.././test-ovsdb.py", line 655, in do_idl
    idl_set(idl, command, step)
  File "../.././test-ovsdb.py", line 526, in idl_set
    status = txn.commit_block()
  File "/home/jkbs/src/ovs/python/ovs/db/idl.py", line 1405, in commit_block
    status = self.commit()
  File "/home/jkbs/src/ovs/python/ovs/db/idl.py", line 1388, in commit
    if not self.idl._session.send(msg):
  File "/home/jkbs/src/ovs/python/ovs/jsonrpc.py", line 540, in send
    return self.rpc.send(msg)
  File "/home/jkbs/src/ovs/python/ovs/jsonrpc.py", line 244, in send
    self.run()
  File "/home/jkbs/src/ovs/python/ovs/jsonrpc.py", line 203, in run
    retval = self.stream.send(self.output)
  File "/home/jkbs/src/ovs/python/ovs/stream.py", line 808, in send
    return super(SSLStream, self).send(buf)
  File "/home/jkbs/src/ovs/python/ovs/stream.py", line 391, in send
    buf = buf.encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 83: ordinal not in range(128)

Remove the quirk from SSLStream as the base class now does encoding.

Reported-by: Marcin Mirecki <mmirecki at redhat.com>
Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: 61845323cf3d996a64230aaba8443ccd7337d803
      https://github.com/openvswitch/ovs/commit/61845323cf3d996a64230aaba8443ccd7337d803
  Author: Jakub Sitnicki <jkbs at redhat.com>
  Date:   2018-04-18 (Wed, 18 Apr 2018)

  Changed paths:
    M tests/ovsdb-idl.at

  Log Message:
  -----------
  tests: Extend Python IDL checks to also run with SSL

Extend the macro for running a Python IDL test against an OVSDB server
that uses SSL so that it can be used for regular IDL tests and for the
notify tests.

This makes it easy to generate additional Python IDL tests that run
using SSL, so do it.

As it turns out, newly added SSL tests unearth a pre-existing issue with
unicode encoding when SSL is used, which will be fixed in the following
patch.

Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/b4273ac902c8...61845323cf3d


More information about the git mailing list