[libvirt] [PATCH] util: virrandom: make virRandomBits endian-safe

Pino Toscano ptoscano at redhat.com
Thu Aug 2 11:12:02 UTC 2018


On Thursday, 2 August 2018 12:28:45 CEST Daniel P. Berrangé wrote:
> On Thu, Aug 02, 2018 at 10:17:32AM +0200, Bjoern Walk wrote:
> > Pino Toscano <ptoscano at redhat.com> [2018-08-02, 10:02AM +0200]:
> > > I do not think this patch is correct: we are dealing with random bytes,
> > > so there is no "endianness" for them.
> > 
> > Well, it's not incorrect either, isn't it? I agree that endianness
> > doesn't matter for random data, but in the same time, it doesn't hurt to
> > have the same random data generated on big- and little-endian machines.

Not sure I understand -- since it's random data, you cannot have it
"the same", no matter which endianness the machine has.

> > And it gives an easy and future-proof fix for the mocked tests.

IMHO every mocked test has its own behaviour, and thus the mocking
needs to reflect that.

> Lets just modijfy tests/virrandommock.c to add mocking of virRandomBits
> alongside virRandomBytes.

I don't see how it will help, since all virRandomBits does is calling
virRandomBytes.

I still did not see any complaints about my patch to fix viriscsitest
(since the problem is specific for it), what about ACKing it then?

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180802/c8da8d74/attachment-0001.sig>


More information about the libvir-list mailing list