[Kimchi-devel] [PATCH 1/5] PowerKVM: Workaround of numpy byte order bug on PowerPC

Aline Manera alinefm at linux.vnet.ibm.com
Mon Aug 18 16:40:27 UTC 2014


On 08/15/2014 12:29 PM, Paulo Vital wrote:
> A numpy byte order bug cause the novnc handshake failure. To workaround
> this problem, we swap bytes after unmasking. After it's fixed on the
> numpy side,  we can drop this patch.
>
> Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
> Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
> ---
>   src/kimchi/websocket.py | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)

You are modifying a third-party code, ie, this code was imported into 
Kimchi.
As it is LGPLv3 and Kimchi backend is also LGPLv3, (*from my 
understanding*) there is any problem in change it UNLESS we properly 
document it.
Please, check LGPLv3 to do it and inform the changes you are doing here.

And do you have a plan when the original problem will be fixed? If it is 
soon, we can hold this patch by now.

>
> diff --git a/src/kimchi/websocket.py b/src/kimchi/websocket.py
> index a98fc6d..870c453 100644
> --- a/src/kimchi/websocket.py
> +++ b/src/kimchi/websocket.py
> @@ -16,7 +16,7 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates
>
>   '''
>
> -import os, sys, time, errno, signal, socket, traceback, select
> +import os, sys, time, errno, signal, socket, traceback, select, platform
>   import array, struct
>   from base64 import b64encode, b64decode
>
> @@ -251,7 +251,10 @@ Sec-WebSocket-Accept: %s\r
>                   data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
>                           offset=pstart, count=int(plen / 4))
>                   #b = numpy.bitwise_xor(data, mask).data
> -                b = numpy.bitwise_xor(data, mask).tostring()
> +                if platform.machine().startswith('ppc'):
> +                    b = numpy.bitwise_xor(data, mask).byteswap().tostring()
> +                else:
> +                    b = numpy.bitwise_xor(data, mask).tostring()
>
>               if plen % 4:
>                   #print("Partial unmask")




More information about the Kimchi-devel mailing list