Broken on big-endian architectures
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- operating-systems, testing
Research direction
Start with the failing File transversal, Search for GCode blocks, and binary/ascii conversion tests, then inspect data-file reads in src/LibBGCode/core/core.cpp, including FileHeader::read. Reproduce the failures on a big-endian architecture using the linked Debian build logs as context. Done means the listed tests pass on big-endian systems without disabling the package.
Written by the indexing model from the issue text.
Description
The following tests fail in big-endian architectures:
The following tests FAILED:
1 - File transversal (Failed)
2 - Search for GCode blocks (Failed)
3 - Convert from binary to ascii (Failed)
4 - Convert from ascii to binary (Failed)
Downstream bug report in Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1062014
Some debugging reveals that this error happens due to mismatched endianness when reading data files.
diff --git a/src/LibBGCode/core/core.cpp b/src/LibBGCode/core/core.cpp @@ -126,8 +127,10 @@ EResult FileHeader::read(FILE& file, const uint32_t* const max_version) { if (!read_from_file(file, &magic, sizeof(magic))) return EResult::ReadError; + printf("data=0x%08x MAGIC=0x%08x\n", magic, MAGICi32); if (magic != MAGICi32) return EResult::InvalidMagicNumber; -> File:/build/libbgcode/tests/data/mini_cube_b.bgcode data=0x47434445 MAGIC=0x45444347It's likely that there are many more similar problems lurking in the source code.
If this issue can't be fixed, the package should probably be disabled on big endian architectures.
Sample build logs:
- Dominant language
- G-code
- Stars
- 73
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prusa3d/libbgcode
-
Extending bgcodeOpen
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
PyPI releaseMay be free again @tomasbedrich claimed this 1035 days ago, and no pull request is open. Open
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
All issues in prusa3d/libbgcode
Similar issues
-
[issue]: Ventoy2Disk.sh can leave the end of VTOYEFI unwritten (xzcat | dd without iflag=fullblock)Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existOpenarea:http kind:gate-defect
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
InauguralSystems/EigenScript#2397 ·
Maintainers usually reply within 1 day
-
Master: setting ACCCON bit 7 (IRR) should raise an IRQ, held while it's setPossibly taken @mattgodbolt claimed this today. Openbbc-master bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
mattgodbolt/jsbeeb#1886 ·
Maintainers usually reply within 1 day
-
load: Avg panics on Linux when /proc/loadavg has fewer than three fieldsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 8 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FreeRTOS/FreeRTOS-Kernel#1542 ·
Maintainers usually reply within 1 day