Public bug reported: unifdef 2.12-1.1 fails to build in stonking on every architecture. Two of its own tests fail:
FAILED: whitespace-1.out / .err / .rc: unifdef -DFOO whitespace.c (rc 1, expected 2) FAILED: whitespace-2.out: unifdef -DBAR whitespace.c https://launchpad.net/ubuntu/+source/unifdef/2.12-1.1/+build/32793651 Cause: The test input is a #ifdef line followed by enough whitespace to fill unifdef's 4096-byte line buffer. parseline() then calls fgets(tline + len, MAXLINE - len, input) with only room for one byte (n == 1). glibc's fgets() and its fortified version disagree in that case: * plain fgets() (libio/iofgets.c) has an n == 1 special case: it stores an empty string and returns the buffer * __fgets_chk() (debug/fgets_chk.c), used with _FORTIFY_SOURCE >= 2, has no such case and returns NULL unifdef then takes its EOF path and the output differs. Reproduced on stonking amd64 with glibc 2.44-1ubuntu1: * a small C test of fgets(buf, 1, f) returns buf without fortify and NULL with -D_FORTIFY_SOURCE=2 * unifdef.c built with _FORTIFY_SOURCE unset or set to 1 gives the expected rc 2 on whitespace.c; with 2 or 3 it gives rc 1 Debian builds 2.12-1.1 fine. I haven't confirmed why: its log shows -D_FORTIFY_SOURCE=2 and the glibc sources look the same, but Debian has glibc 2.43 and Ubuntu 2.44. Fix for unifdef (2.12-1.1ubuntu1): d/p/fgets-one-byte.patch handles the n == 1 case explicitly in parseline() (store '\0' and continue), matching plain fgets(). All other cases still call fgets(), so fortification stays enabled. Tested on stonking amd64: the full test suite passes. The glibc inconsistency is worth reporting separately; other packages calling fgets() with n == 1 under fortification could be affected. ** Affects: unifdef (Ubuntu) Importance: Undecided Status: Fix Committed ** Tags: ftbfs update-excuse ** Tags added: ftbfs update-excuse ** Changed in: unifdef (Ubuntu) Status: New => Fix Committed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2170461 Title: unifdef 2.12-1.1 FTBFS: whitespace tests fail, fortified fgets() returns NULL for n == 1 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/unifdef/+bug/2170461/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
