Source: libbgcode
Version: 0.0~git20231219.7aaf717-1
Severity: serious
Tags: ftbfs
Justification: fails to build from source
Usertags: s390x
X-Debbugs-Cc: onit...@gmail.com

Dear Maintainer,

buildd reports failing unit tests on s390x and ppc64: [1] [2]

Example error:
1: Filters: "File transversal"
1: Randomness seeded to: 936238706
1: 
1: TEST: File transversal
1: File:/<<PKGBUILDDIR>>/tests/data/mini_cube_b.bgcode
1: 
1: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1: core_tests is a Catch2 v3.4.0 host application.
1: Run with -? for options
1: 
1: 
-------------------------------------------------------------------------------
1: File transversal
1: 
-------------------------------------------------------------------------------
1: ./tests/core/core_tests.cpp:85
1: 
...............................................................................
1: 
1: ./tests/core/core_tests.cpp:97: FAILED:
1:   REQUIRE( is_valid_binary_gcode(*file, true, checksum_verify_buffer, 
sizeof(checksum_verify_buffer)) == EResult::Success )
1: with expansion:
1:   3 == 0
1: 
1: 
===============================================================================
1: test cases: 1 | 1 failed
1: assertions: 2 | 1 passed | 1 failed
1: 
1/4 Test #1: File transversal .................***Failed    0.00 sec

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=0x45444347

It'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.

Thanks!

[1] 
https://buildd.debian.org/status/fetch.php?pkg=libbgcode&arch=s390x&ver=0.0%7Egit20231219.7aaf717-1%2Bb1&stamp=1704613965&raw=0
[2] 
https://buildd.debian.org/status/fetch.php?pkg=libbgcode&arch=ppc64&ver=0.0%7Egit20231219.7aaf717-1%2Bb1&stamp=1704984706&raw=0
[3] 

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: s390x

Kernel: Linux 6.5.0-4-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Reply via email to