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

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Mon Aug 25 23:12:25 UTC 2014


On Mon, 2014-08-18 at 13:40 -0300, Aline Manera wrote:
> 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.
> 

The problem resides on numpy library used by the Python WebSocket
library (the file modified), and there is no solution provided in the
upstream numpy project. So, the modification is necessary in this file,
used by Kimchi. 

Reading the LGPLv3, I didn't see where the modification proposed could
be documented. From what I understood about the license, the
modification can be done using 2a or 4a statements (see file
COPYING.LGPL or https://www.gnu.org/copyleft/lesser.html) and a simple
note on README file mentioning that Python WebSocket library is used by
Kimchi and both are under LGPLv3 is sufficient. 

However, IMO, this should be covered by a different patch that mention
all other LGPLv3 third-part code imported into Kimchi, if exists.

> >
> > 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