Public bug reported:

genimage 20-1 fails to build from source in stonking-proposed on arm64, armhf, 
ppc64el and s390x (amd64/amd64v3 build; riscv64 only built because it ran with 
nocheck):
https://launchpad.net/ubuntu/+source/genimage/20-1

Every failing architecture fails the same single test:

  FAIL: test/misc.test 11 - enable random-seed

The test builds a GPT image with a fixed randomseed and compares its
hexdump byte for byte with test/randomseed.expected, which was generated
on x86-64. The disk and partition GUIDs come from uuid_random() in
util.c:

  xasprintf(&uuid, "%04ux%04ux-...",
            random32() & 0xffff, random32() & 0xffff, ... /* 8 calls */);

The evaluation order of function arguments is unspecified in C and
random32() is stateful, so the same seed gives different GUIDs (and GPT
CRCs) depending on the order the compiler emits the calls. (The format
string is also wrong: %04ux is an unsigned decimal followed by a literal
'x'.)

Verified locally on amd64: unmodified 20 matches the reference; forcing
the 8 calls first-to-last changes the disk GUID, partition GUIDs and
header CRCs so the test fails; forcing last-to-first matches again. Not
run on the affected architectures themselves (no cross
toolchain/emulator available).

Already fixed:
- Upstream pengutronix/genimage (not yet in a release; latest tag v20):
  c96734f03c util: uuid_random: fix format string (also updates 
test/randomseed.expected)
https://github.com/pengutronix/genimage/commit/c96734f03
  5aa994a485 util: uuid_random: generate the radomness first
https://github.com/pengutronix/genimage/commit/5aa994a485
- Debian: genimage 20-2~exp1 in experimental, 'Fix randomseed test (Closes: 
#1141879)', based on upstream PR #339. Its test/randomseed.expected is 
byte-identical to the output of the two upstream commits.

- Upstream issue: https://github.com/pengutronix/genimage/issues/335

Suggested fix: sync genimage 20-2~exp1 from Debian experimental.
Alternatively upload 20-1ubuntu1 with the two upstream commits as quilt
patches (they apply cleanly to 20; test 11 passes with them on amd64;
full package build not done). Debian should also be asked to upload the
fix to unstable so Ubuntu can return to plain syncs.

** Affects: genimage (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: genimage (Debian)
     Importance: Unknown
         Status: Unknown


** Tags: stonking update-excuse

** Bug watch added: Debian Bug tracker #1141879
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141879

** Also affects: genimage (Debian) via
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141879
   Importance: Unknown
       Status: Unknown

** Description changed:

  genimage 20-1 fails to build from source in stonking-proposed on arm64, 
armhf, ppc64el and s390x (amd64/amd64v3 build; riscv64 only built because it 
ran with nocheck):
  https://launchpad.net/ubuntu/+source/genimage/20-1
  
  Every failing architecture fails the same single test:
  
-   FAIL: test/misc.test 11 - enable random-seed
+   FAIL: test/misc.test 11 - enable random-seed
  
  The test builds a GPT image with a fixed randomseed and compares its
  hexdump byte for byte with test/randomseed.expected, which was generated
  on x86-64. The disk and partition GUIDs come from uuid_random() in
  util.c:
  
-   xasprintf(&uuid, "%04ux%04ux-...",
-             random32() & 0xffff, random32() & 0xffff, ... /* 8 calls */);
+   xasprintf(&uuid, "%04ux%04ux-...",
+             random32() & 0xffff, random32() & 0xffff, ... /* 8 calls */);
  
  The evaluation order of function arguments is unspecified in C and
  random32() is stateful, so the same seed gives different GUIDs (and GPT
  CRCs) depending on the order the compiler emits the calls. (The format
  string is also wrong: %04ux is an unsigned decimal followed by a literal
  'x'.)
  
  Verified locally on amd64: unmodified 20 matches the reference; forcing
  the 8 calls first-to-last changes the disk GUID, partition GUIDs and
  header CRCs so the test fails; forcing last-to-first matches again. Not
  run on the affected architectures themselves (no cross
  toolchain/emulator available).
  
  Already fixed:
  - Upstream pengutronix/genimage (not yet in a release; latest tag v20):
-   c96734f03c util: uuid_random: fix format string (also updates 
test/randomseed.expected)
-   5aa994a485 util: uuid_random: generate the radomness first
+   c96734f03c util: uuid_random: fix format string (also updates 
test/randomseed.expected)
+ https://github.com/pengutronix/genimage/commit/c96734f03
+   5aa994a485 util: uuid_random: generate the radomness first
+ https://github.com/pengutronix/genimage/commit/5aa994a485
  - Debian: genimage 20-2~exp1 in experimental, 'Fix randomseed test (Closes: 
#1141879)', based on upstream PR #339. Its test/randomseed.expected is 
byte-identical to the output of the two upstream commits.
+ 
+ - Upstream issue: https://github.com/pengutronix/genimage/issues/335
  
  Suggested fix: sync genimage 20-2~exp1 from Debian experimental.
  Alternatively upload 20-1ubuntu1 with the two upstream commits as quilt
  patches (they apply cleanly to 20; test 11 passes with them on amd64;
  full package build not done). Debian should also be asked to upload the
  fix to unstable so Ubuntu can return to plain syncs.

** Tags added: stonking update-excuse

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2168952

Title:
  genimage 20-1 FTBFS on arm64/armhf/ppc64el/s390x: randomseed test
  depends on argument evaluation order

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/genimage/+bug/2168952/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to