Bug#810960: sngrep FTBFS on hppa/parisc architecture (with patch)

Helge Deller deller at gmx.de
Thu Jan 14 08:43:07 UTC 2016


Package: sngrep
Version: 1.2.0-1
Tags: patch

sngrep fails to build because the testcases test-004, test-005 and test-005 fail, e.g.:
https://buildd.debian.org/status/fetch.php?pkg=sngrep&arch=hppa&ver=1.2.0-1&stamp=1452639207

It turns out, that this is a bug in the C-code of the testcases of sngrep which affects only big-endian machines (e.g. s390x, ppc64 and hppa).

Testcases 1,2,3 and 7 defines the keystroke table correctly like this:
	const char keys[] = {...};
while testcases 4,5 and 6 define the keystrokes like this (with "int" type):
	const int keys[] = {...};

In tests/test_input.c each various key is then written with:
           unused = write(ppipe[1], &keys[i], sizeof(char));

Please note the usage of "char" vs. "int" in the keys tables above.
If "int" is used, then on big-endian machines the &keys[i] refers to the first byte of each 2-byte (int) value, which is
on big-endian machines the higher-8-bit value which is "0", while on little-endian machines the lower 8-bit-value which is the key which was actually defined.

So, the attached patch fixes this problem for all machines regardless of the endianess and adds a check to tests/test_input.c like this:
	const char keys[];
That way at least a compiler warning will be generated if new testcases with "int" usage would be added.

Can you please apply this patch to the next upload of sngrep and/or report this upstream ?

Thanks,
Helge

PS: I still wonder why the testcases 4-6 didn't broke on all other big-endian arches. I assume the compiler did some optimization of the "int"-based-keys table and as such just hided the coding problem...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sngrep.patch
Type: text/x-diff
Size: 1363 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-voip-maintainers/attachments/20160114/881b5c52/attachment.patch>


More information about the Pkg-voip-maintainers mailing list