Package: clearcut Version: 1.0.9-4 Severity: important Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu focal ubuntu-patch
Dear maintainers, When introducing glibc 2.31 in Ubuntu, the clearcut autopkgtest showed a regression on armhf: [...] autopkgtest [03:03:16]: test run-unit-test: [----------------------- Clearcut: Distance value out-of-range. Clearcut: Syntax error in distance matrix at offset 23. autopkgtest [03:03:18]: test run-unit-test: -----------------------] autopkgtest [03:03:20]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - run-unit-test FAIL non-zero exit status 253 [...] (https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac/autopkgtest-focal/focal/armhf/c/clearcut/20200312_030404_e5698@/log.gz) I've isolated this to a bug in clearcut itself, which is not handling errno properly when using it to check for errors from atof() (which is not standard anyway). Since glibc 2.31 is opportunistically using a newer syscall on armhf that's not present in Linux 4.15, errno winds up set to ENOSYS due to an earlier function call, and clearcut fails to correctly clear this prior to calling atof(), which has zero guarantee of resetting it on success. The attached patch fixes clearcut so that it will work more correctly in any situation where this occurs, including on armhf with glibc 2.31 and Linux 4.15. Thanks for considering, -- 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 clearcut-1.0.9/debian/patches/clear-errno-before-checking.patch clearcut-1.0.9/debian/patches/clear-errno-before-checking.patch --- clearcut-1.0.9/debian/patches/clear-errno-before-checking.patch 1969-12-31 16:00:00.000000000 -0800 +++ clearcut-1.0.9/debian/patches/clear-errno-before-checking.patch 2020-03-11 23:25:04.000000000 -0700 @@ -0,0 +1,26 @@ +Description: clear errno before using it to check failure from atof() + The atof() function is not guaranteed to clear errno on success, so if + any earlier errors have been set prior to calling atof(), these will + result in a spurious failure. On armhf, glibc 2.31 now opportunistically + calls a new syscall that may not be supported on older kernels (Linux 4.15), + resulting in errno == ENOSYS: + . + syscall_0x193(0x5, 0xffb2b650, 0xf77b7000, 0, 0x5, 0xffb2b650) = -1 ENOSYS (Function not implemented) + . + Therefore we should clear errno before calling atof() to make sure any + errors actually originate from this function. +Author: Steve Langasek <steve.langa...@ubuntu.com> +Last-Update: 2020-03-11 + +Index: clearcut-1.0.9/dmat.c +=================================================================== +--- clearcut-1.0.9.orig/dmat.c ++++ clearcut-1.0.9/dmat.c +@@ -570,6 +570,7 @@ + goto XIT_BAD; + } + ++ errno = 0; + val = atof(token->buf); + if(errno) { + fprintf(stderr, "Clearcut: Distance value out-of-range.\n"); diff -Nru clearcut-1.0.9/debian/patches/series clearcut-1.0.9/debian/patches/series --- clearcut-1.0.9/debian/patches/series 2019-03-28 22:16:52.000000000 -0700 +++ clearcut-1.0.9/debian/patches/series 2020-03-11 23:21:27.000000000 -0700 @@ -1,2 +1,3 @@ mothur_trivial_patch hardening.patch +clear-errno-before-checking.patch