pybootd icon indicating copy to clipboard operation
pybootd copied to clipboard

Maximum data size and string casting in python3

Open lucabodd opened this issue 6 years ago • 3 comments

As you can see on commits, I added in PXE casting from bytes to string that otherwise generates a TypeError on concatenating bytes (in python3 casting to string is not implicit). Fixing TFTP "wrap-around" on short ints, now TFTP can send files up to 16M (till 32 MB as defined by TFTP) but package now requires numpy

lucabodd avatar Sep 18 '19 11:09 lucabodd

Hi Luca,

I did not merge the PR per se but i think I fixed both issues based on your patch files - I do not have a way to test PXE for now, so if you can git it a try.

Thanks.

eblot avatar Sep 19 '19 08:09 eblot

I see..

About the bug on pxed, I don’t know, I was getting a TypeError concatenating string to bytes… About the tftp I also tried to set hH to buffer fmt but was not working … if you tested and it’s working it’s surely a better fix rather than import all numpy

Anyway, glad to have helped you… Thanks a lot

Luca

On 19 Sep 2019, at 10:17, Emmanuel Blot [email protected] wrote:

Hi Luca,

I did not merge the PR per se but i think I fixed both issues based on your patch files - I do not have a way to test PXE for now, so if you can git it a try.

Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eblot/pybootd/pull/14?email_source=notifications&email_token=AFOGSIAB4LYL52HRBFNWW43QKMYSVA5CNFSM4IX5I462YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7CUJPQ#issuecomment-533021886, or mute the thread https://github.com/notifications/unsubscribe-auth/AFOGSIC647MHBXMJU46ELPTQKMYSVANCNFSM4IX5I46Q.

lucabodd avatar Sep 19 '19 09:09 lucabodd

On 19 Sep 2019, at 11:41, Luca Bodini wrote:

I see..

About the bug on pxed, I don’t know, I was getting a TypeError concatenating string to bytes…

I think it was because of the first empty string (‘’ instead of b’’)

About the tftp I also tried to set hH to buffer fmt but was not working … if you tested and it’s working it’s surely a better fix rather than import all numpy

It is two fold:

  • only the last 16-bit should be preserved, and
  • struct is likely to reject a negative integer value if ‘H’ is specified. Conversely, only using 0xFFFF would generate integer > 32767, and struct would also reject those with ‘h’ encoding. As 0xFFFF should not generate a negative number, it should be ok.

Let me know if you can test all this.

Thanks Emmanuel.

eblot avatar Sep 19 '19 09:09 eblot