Re: Procps-ng 4.0.0 released with newlib

"Dr. Werner Fink" <[email protected]> Wed, 30 Mar 2022 11:34:32 +0200
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
On 2022/03/30 11:18:44 +0200, Dr. Werner Fink wrote:
> On 2022/03/22 04:04:02 -0700, Craig Small wrote:
> > The procps team is pleased to announce the release of procps-ng 4.0.0. This
> > is a major change from previous versions because it uses the newlib branch.
> > The newlib branch is a major re-work of the procps/proc-2 library API and
> > has been an undertaking that started around 2015.
> > 
> > procps-ng v4.0.0 is probably not ready for the main path of most
> > distributions; for example, it will be packaged for Debian experimental,
> > not Debian Sid. We encourage people with all sorts of setups to test out
> > this new version and provide feedback.
> > 
> > Source code packages can be found at
> > GitLab Release: https://gitlab.com/procps-ng/procps/-/releases/v4.0.0
> > Sourceforge tarball:
> > https://sourceforge.net/projects/procps-ng/files/Production/procps-ng-4.0.0.tar.xz/download
> 
> Hi,
> 
> on our QA test suites we also try i686/i586 and this leads in the test suite
> to
> 
>   [   90s] + error=no
>   [   90s] + for log in test-suite.log testsuite/*.log
>   [   90s] + grep -E '^(XFAIL|FAIL|ERROR):' test-suite.log
>   [   90s] FAIL: lib/test_strtod_nol
>   [   90s] FAIL: strtod_nol_or_err("123") != 123.000000
>   [   90s] + cat test-suite.log
>   [   90s] =======================================
>   [   90s]    procps-ng 4.0.0: ./test-suite.log
>   [   90s] =======================================
>   [   90s] 
>   [   90s] # TOTAL: 7
>   [   90s] # PASS:  6
>   [   90s] # SKIP:  0
>   [   90s] # XFAIL: 0
>   [   90s] # FAIL:  1
>   [   90s] # XPASS: 0
>   [   90s] # ERROR: 0
>   [   90s] 
>   [   90s] .. contents:: :depth: 2
>   [   90s] 
>   [   90s] FAIL: lib/test_strtod_nol
>   [   90s] =========================
>   [   90s] 
>   [   90s] FAIL: strtod_nol_or_err("123") != 123.000000
>   [   90s] FAIL lib/test_strtod_nol (exit status: 1)
>   [   90s] 
> 
> ...
> 

Forwarding the lib/strutils.c from the old tree to procps-ng-4.0.0 helps
here

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
procps-ng-4.0.0-floats.dif (text/plain, 1.8 KB)
---
 lib/strutils.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

--- lib/strutils.c
+++ lib/strutils.c	2021-02-09 10:11:25.000000000 +0000
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+#include <float.h>
+#include <math.h>
 #include <stdlib.h>
 #include <ctype.h>
 
@@ -71,9 +73,9 @@ double strtod_or_err(const char *str, co
  */
 double strtod_nol_or_err(char *str, const char *errmesg)
 {
-    double num;
+    long double num;
     const char *cp, *radix;
-    double mult;
+    long double mult;
     int negative = 0;
 
     if (str != NULL && *str != '\0') {
@@ -95,29 +97,29 @@ double strtod_nol_or_err(char *str, cons
         mult=0.1;
         while(isdigit(*radix)) {
             radix++;
-            mult *= 10;
+            mult *= 10.0;
         }
         while(isdigit(*cp)) {
-            num += (*cp - '0') * mult;
-            mult /= 10;
+            num += (long double)(*cp - '0') * mult;
+            mult /= 10.0;
             cp++;
         }
         /* got the integers */
         if (*cp == '\0')
-            return (negative?-num:num);
+            return (double)(negative?-num:num);
         if (*cp != '.' && *cp != ',')
             error(EXIT_FAILURE, EINVAL, "%s: '%s'", errmesg, str);
 
         cp++;
         mult = 0.1;
         while(isdigit(*cp)) {
-            num += (*cp - '0') * mult;
-            mult /= 10;
+            num += (long double)(*cp - '0') * mult;
+            mult /= 10.0;
             cp++;
         }
         if (*cp == '\0')
-            return (negative?-num:num);
+            return (double)(negative?-num:num);
     }
     error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
-    return 0;
+    return (double)0;
 }
signature.asc (application/pgp-signature, 894 B)
-----BEGIN PGP SIGNATURE-----

iQJgBAABCABKFiEEGwa/WjgpkPvLonW+UOkNVR3Bay4FAmJEJCQsFIAAAAAAFQAO
cGthLWFkZHJlc3NAZ251cGcub3Jnd2VybmVyQHN1c2UuZGUACgkQUOkNVR3Bay5r
AxAA0GXc8r2kfcqmijkZpBelC+8lL6grzv+gS0bq0/5LmySK1CGbGqPzas/zw3cv
c40ZNYtopfbS9zv44Dh2K+dqRAENtTbTJJb4WkMcriCv2GHlDHTZ1+NTxdU2bmAk
a3l0ynQEV+d7vP3HrwiIYHMsB55VTbNv+ZNQy57fNXZGWLhsTfH2etmo9+62cppG
kdp0pfImws0zo8U2wtGXKorLldxK8rXUgXU/SiLDP2LKIolCCQpILBs6sPlt69rX
QzMCikxrWEs4upZ23CrA6FyqSDTGUVTZvX8w9VYRzx9u5xrn68IZFlDHqBraOvrz
ZNalpTtehD5/s4foY/u+OfmANderO1cUiWor0lQlUzCghI32ioOdUU2voHO8Qc8Q
qAz9TOyWDtlxWpbQGZLHKfOu5hMkSaD2RGQ0MaYFsZByZYEXxyk6Dhu6JfHA8Epu
Bn8TvkS7T4zcKRFweTt2ssJ3xqcwnefGDLPWl4NF4y2JHDqRdtSgetu5IfgCFcth
thvjTvYSuhX/gTf/+GM7emp3IihDzQ5HKvkGdQmyCjN+J3Q8UFyaUmCPeRyZxdRU
KEm8F6KUSUYCVJacb1FUYr7qTiSWtfuP5hebfznKAeRitwrSV/jb8mumf0580d/l
+w+zipU+x42ENR3jW3/Poyw173ng/NBUxkFNX7ciHACnm8Y=
=LFzY
-----END PGP SIGNATURE-----