dpkt icon indicating copy to clipboard operation
dpkt copied to clipboard

bitfield unittest might be platform dependant

Open AiyionPrime opened this issue 1 year ago • 2 comments

This test gives me trouble.

https://github.com/kbandla/dpkt/blob/2d30526422d48f83d4f724221d9ae0dcd5ff57fe/dpkt/dpkt.py#L62-L65

I think it should not be called on ph_struct but a concat of the classes __byte_order__ and it, no?

On my system the test tells me L is expected to be 8*8bits instead of 32, I'd expect. https://docs.python.org/3/library/struct.html#format-characters

Am I just overlooking something? I'll provide a PR with a unittest with what I mean tomorrow, if wanted.

AiyionPrime avatar Oct 27 '22 16:10 AiyionPrime

A piece of code to replicate the issue would be helpful, yes. __byte_order__ isn't related to sizing, I don't think it needs to be involved.

obormot avatar Oct 27 '22 16:10 obormot

I'll provide the example tomorrow morning, then.

AiyionPrime avatar Oct 27 '22 17:10 AiyionPrime

I've got a working unittest, as well as a draft for a fix. It will take a little while longer though, due to company policies - sorry for the wait.

AiyionPrime avatar Nov 01 '22 13:11 AiyionPrime

@obormot This took way longer than anticipated. Future contributions should be faster.

AiyionPrime avatar Nov 09 '22 12:11 AiyionPrime