Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crc32 -CRC is not compatible with Linux #14532

Open
1 task done
shijogeorge24 opened this issue Oct 28, 2024 · 5 comments
Open
1 task done

crc32 -CRC is not compatible with Linux #14532

shijogeorge24 opened this issue Oct 28, 2024 · 5 comments
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: OS Components OS Components issues OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working

Comments

@shijogeorge24
Copy link

Description / Steps to reproduce the issue

I was working with a simple UART communication layer between Linux and NuttX and encountered an issue related to CRC32. When I compared the CRC implementations on Linux and NuttX, I found that they differ.

You can refer to the previous NuttX issue here: https://lists.apache.org/thread/hjw83nb1mwzh0d24oprpt0np7kfxwdrk.

What is the best way to resolve this?

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu23

NuttX Version

12.6.0

Issue Architecture

[Arch: arm]

Issue Area

[Area: OS Components]

Verification

  • I have verified before submitting the report.
@shijogeorge24 shijogeorge24 added the Type: Bug Something isn't working label Oct 28, 2024
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Area: OS Components OS Components issues OS: Linux Issues related to Linux (building system, etc) labels Oct 28, 2024
@xiaoxiang781216
Copy link
Contributor

add a new crc32 api like crc8 or crc16 which has many variants.

@acassis
Copy link
Contributor

acassis commented Oct 28, 2024

Seems like even in different versions of python the CRC32 is different:

https://stackoverflow.com/questions/30092226/calculate-crc32-correctly-with-python

And also when the file is bigger than 2GB:

python/cpython#105967

@xiaoxiang781216 I think we need to convert our default crc32 to become compatible with Linux and move the current to a different name and use it on existing subsystems that requires the current implementation.

What do you think?

@xiaoxiang781216
Copy link
Contributor

I am fine with this change since the compatibility with other popular POSIX OS is always my top priority.

@jlaitine
Copy link
Contributor

Is the difference just init value or polynomial itself? Maybe keep the default crc32, there is some reason why exactly that variant has selected (I don't know what), but blindly chaning the defaults would break it for people already using it.

There is no one "correct crc32", but many variants. If the difference is just init value, you can use "crc32part" directly to calculate it starting with whatever init value you want.

@acassis
Copy link
Contributor

acassis commented Oct 29, 2024

Hi @jlaitine actually it is not a blindly change, many people faced this issue in the past, but I agree it could break other people code and probably this modification will require changing the NuttX major number. As you said, there is not a "correct crc32", but it is important to select a default variant compatible with Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: OS Components OS Components issues OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants