Comment 10 for bug 1678018

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/452112
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=091157fc7f52acfeb24e87e26b7f142da9e50d6b
Submitter: Jenkins
Branch: master

commit 091157fc7f52acfeb24e87e26b7f142da9e50d6b
Author: Romain LE DISEZ <email address hidden>
Date: Fri Mar 31 11:21:13 2017 +0200

    Fix encoding issue in ssync_sender.send_put()

    EC object metadata can currently have a mixture of bytestrings and
    unicode. The ssync_sender.send_put() method raises an
    UnicodeDecodeError when it attempts to concatenate the metadata
    values, if any bytestring has non-ascii characters.

    The root cause of this issue is that the object server uses unicode
    for the keys of some object metadata items that are received in the
    footer of an EC PUT request, whereas all other object metadata keys
    and values are persisted as bytestrings.

    This patch fixes the bug by changing diskfile write_metadata()
    function to encode all unicode metadata keys and values as utf8
    encoded bytes before writing to disk. To cope with existing objects
    that have a mixture of unicode and bytestring metadata, the diskfile
    read_metadata() function is also changed so that all returned unicode
    metadata keys and values are utf8 encoded. This ensures that
    ssync_sender.send_put() (and any other caller of diskfile
    read_metadata) only reads bytestrings from object metadata.

    Closes-Bug: #1678018
    Co-Authored-By: Alistair Coles <email address hidden>
    Change-Id: Ic23c55754ee142f6f5388dcda592a3afc9845c39