Library Bugs

strtoll(3)/strtoull(3) is missing in libc

Use strtoq/strtouq instead. Their prototypes are: #ifdef __cplusplus extern "C" { #endif #include <sys/types.h> extern quad_t __cdecl strtoq(const char *, char **, int); extern u_quad_t __cdecl strtouq(const char *, char **, int); #ifdef __cplusplus } #endif You may compile with:
gcc -Dstrtoll=strtoq -Dstrtoull=strtouq ...
see also:
http://www.interopsystems.com/tools/tm.aspx?m=3697


libm's expf(3) is broken

expf(3) is broken, see the following
sample program: #include <math.h> #include <stdio.h> int main(void) { float a, b; a = 1; b = expf(a); printf("expf(%f)\n", a); printf("expected: 2.718282\n"); printf(" got: %f\n", b); return 0; } When run on Interix, ouput is as follows:
expf(1.000000)
expected: 2.718282
     got: 1.000000
see also: http://www.interopsystems.com/tools/tm.aspx?m=6107

Workaroud

On Debian/Interix, use libm-newlib.so from package libm-newlib-dev.


libm's frexp(3) is broken

frexp(3) is broken, see the following
sample program: #include <math.h> #include <stdio.h> int main(void) { int exp; double frac; double dval = 1179431913.979666L; printf("frexp(%lf)\n", dval); printf("expected: 0.549216, 31\n"); frac = frexp(dval, &exp); printf(" got: %lf, %d\n\n", frac, exp); dval = -1; printf("frexp(%lf)\n", dval); printf("expected: -0.5, 1\n"); frac = frexp(dval, &exp); printf(" got: %lf, %d\n\n", frac, exp); return 0; } When run on Interix, ouput is as follows:
frexp(1179431913.979666)
expected: 0.549216, 31
     got: 1.098432, 30
     
frexp(-1.000000)
expected: -0.5, 1
     got: -1.000000, 0
see also: http://www.interopsystems.com/tools/tm.aspx?m=11820

Workaroud

On Debian/Interix, use libm-newlib.so from package libm-newlib-dev.


libc's poll(3) doesn't work for all files (documented)

man 3 poll says: On Interix, poll() is supported only for use with ctl files (located in /proc/procID). No other file types are allowed.


libc's atof(3) doesn't support NaNs, atof("NaN") returns 0 instead of a NaN


libc's sscanf(3) doesn't support 64-bit ints

see:
http://www.interopsystems.com/tools/tm.aspx?m=3653 Reportedly, on SUA 6.0 both sscanf "%qd" and "%lld" are supported.


atoll(3) is missing in libc

Use strtoq instead. Its prototype is: #ifdef __cplusplus extern "C" { #endif #include <sys/types.h> extern quad_t __cdecl strtoq(const char *, char **, int); #ifdef __cplusplus } #endif You may define this macro:
#define atoll(p) strtoq(p,NULL,10)


libc's strftime(3) format %V (ISO week) is broken

strftime(3) format %V (ISO week number) is broken, see the following
sample program (taken from tcl test suite): #include <time.h> #include <stdio.h> #include <stdlib.h> int main(void) { char outstr[200]; time_t t; struct tm *tmp; char *fmt = "%Y-%m-%d %a %A %g %G %u %V %w"; t = 1009756800; tmp = localtime(&t); if (tmp == NULL) { perror("localtime"); exit(EXIT_FAILURE); } if (strftime(outstr, sizeof(outstr), fmt, tmp) == 0) { fprintf(stderr, "strftime returned 0"); exit(EXIT_FAILURE); } printf("Format string is \"%s\"\n", fmt); printf("Result string is \"%s\"\n", outstr); printf("Expected was \"2001-12-31 Mon Monday 02 2002 1 01 1\"\n"); exit(EXIT_SUCCESS); } When run on Interix, output is as follows:
Format string is "%Y-%m-%d %a %A %g %G %u %V %w"
Result string is "2001-12-31 Mon Monday 02 2002 1 53 1"
Expected was     "2001-12-31 Mon Monday 02 2002 1 01 1"


Bug database Debian Interix home

Last update of this document: Sunday, 26-Jul-2009 19:48:09 CEST
Copyright 2007-2009 Martin Köppe <mkoeppe 'at' gmx . de>