Package: apertium-recursive Version: 1.1.0-1 Severity: serious Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu kinetic ubuntu-patch
Dear maintainers, The new version of apertium-recursive FTBFS in Ubuntu on most archs because of incorrect handling of EOF condition from fgetc(): [...] g++ -DHAVE_CONFIG_H -I. -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/lttoolbox-3.6 -I/usr/include/apertium-3.8 -I/usr/lib/aarch64-linux-gnu/apertium-3.8/include -I/usr/include/libxml2 -Wall -Wextra -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -std=c++20 -c -o pattern.o pattern.cc rtx_comp.cc: In function ‘int main(int, char**)’: rtx_comp.cc:104:10: warning: comparison is always false due to limited range of data type [-Wtype-limits] 104 | if(c == EOF) | ^ [...] ====================================================================== FAIL: test_compiles (__main__.NoRules) ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/./run_tests.py", line 8, in test_compiles with self.assertRaises(subprocess.CalledProcessError): AssertionError: CalledProcessError not raised ---------------------------------------------------------------------- Ran 66 tests in 2.751s [...] (https://launchpad.net/ubuntu/+source/apertium-recursive/1.1.0-1/+build/23586338) I have no idea why the tests passed at build time in Debian! But the logic error in the C code is clear: fgetc() returns an int, not a char, and on many archs (but not x86), a bare 'char' is unsigned, so can never == EOF. The attached patch has been uploaded to Ubuntu to fix the build failure there, and complete the libapertium3-3.8-1 transition. Please consider applying it in Debian as well (and forwarding upstream). -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer https://www.debian.org/ slanga...@ubuntu.com vor...@debian.org
diff -Nru apertium-recursive-1.1.0/debian/patches/series apertium-recursive-1.1.0/debian/patches/series --- apertium-recursive-1.1.0/debian/patches/series 1969-12-31 16:00:00.000000000 -0800 +++ apertium-recursive-1.1.0/debian/patches/series 2022-05-17 13:49:42.000000000 -0700 @@ -0,0 +1 @@ +unsigned-char.patch diff -Nru apertium-recursive-1.1.0/debian/patches/unsigned-char.patch apertium-recursive-1.1.0/debian/patches/unsigned-char.patch --- apertium-recursive-1.1.0/debian/patches/unsigned-char.patch 1969-12-31 16:00:00.000000000 -0800 +++ apertium-recursive-1.1.0/debian/patches/unsigned-char.patch 2022-05-17 13:52:04.000000000 -0700 @@ -0,0 +1,29 @@ +Description: fgetc() returns an int, not a (unsigned) char + The code is wrongly assigning fgetc()'s return value to a char instead of an + int. On some architectures, this is doubly wrong because 'char' is + unsigned, meaning it can never hold the EOF value: + . + rtx_comp.cc: In function ‘int main(int, char**)’: + rtx_comp.cc:104:10: warning: comparison is always false due to limited range of data type [-Wtype-limits] + 104 | if(c == EOF) + | ^ + . + Fix the type, which removes the warning and also fixes build failures on + these unsigned char archs in Ubuntu. +Author: Steve Langasek <steve.langa...@ubuntu.com> +Last-Update: 2022-05-17 +Forwarded: no + +Index: apertium-recursive-1.1.0/src/rtx_comp.cc +=================================================================== +--- apertium-recursive-1.1.0.orig/src/rtx_comp.cc ++++ apertium-recursive-1.1.0/src/rtx_comp.cc +@@ -98,7 +98,7 @@ + cout << "Unable to open " << argv[optind] << " for reading." << endl; + exit(EXIT_FAILURE); + } +- char c; ++ int c; + while((c = fgetc(check)) != '<') + { + if(c == EOF)