VirtualBox

Ignore:
Timestamp:
Jul 10, 2019 8:40:51 AM (5 years ago)
Author:
vboxsync
Message:

ValidationKit/txsclient.py: Fix python 3.x incompatibility when handling stdin packets in the EXEC task. zlib.crc32 wants bytes or an array of bytes as the input type and creating a byte array requires the input string to be encoded as bytes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/txsclient.py

    r79474 r79662  
    770770                        break;
    771771                    if sInput:
    772                         oStdIn.uTxsClientCrc32 = zlib.crc32(sInput, oStdIn.uTxsClientCrc32);
    773772                        # Convert to a byte array before handing it of to sendMsg or the string
    774773                        # will get some zero termination added breaking the CRC (and injecting
    775774                        # unwanted bytes).
    776                         abInput = array.array('B', sInput);
     775                        abInput = array.array('B', sInput.encode('utf-8'));
     776                        oStdIn.uTxsClientCrc32 = zlib.crc32(abInput, oStdIn.uTxsClientCrc32);
    777777                        rc = self.sendMsg('STDIN', (long(oStdIn.uTxsClientCrc32 & 0xffffffff), abInput));
    778778                        if rc is not True:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette