Recent changes introduce bsd-getline.c compatibility, but the build fails for me when configured without any options: gcc -g -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -mfunction-return=thunk -mindirect-branch=thunk -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I.. -I. -I./.. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DHAVE_CONFIG_H -c bsd-getline.c bsd-getline.c:50:1: error: static declaration of ‘getdelim’ follows non-static declaration getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) ^~~~~~~~ In file included from /usr/include/resolv.h:58, from ../openbsd-compat/getrrsetbyname.h:59, from ../openbsd-compat/openbsd-compat.h:44, from ../includes.h:175, from bsd-getline.c:36: /usr/include/stdio.h:606:20: note: previous declaration of ‘getdelim’ was here extern _IO_ssize_t getdelim (char **__restrict __lineptr, ^~~~~~~~ make[1]: *** [Makefile:98: bsd-getline.o] Error 1 This function is just internal and therefore it should be defined with some compat prefix to not conflict with system functions, or it should not be built if the system one can be used. Reproducer: * configure && make master on current Fedora 28. Following patch allows me to build the current master: diff --git a/openbsd-compat/bsd-getline.c b/openbsd-compat/bsd-getline.c index 681062e8..1424c39e 100644 --- a/openbsd-compat/bsd-getline.c +++ b/openbsd-compat/bsd-getline.c @@ -47,7 +47,7 @@ #include <string.h> static ssize_t -getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) +xxx_getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) { char *ptr, *eptr; @@ -92,7 +92,7 @@ getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) ssize_t getline(char **buf, size_t *bufsiz, FILE *fp) { - return getdelim(buf, bufsiz, '\n', fp); + return xxx_getdelim(buf, bufsiz, '\n', fp); } #endif
No comments on proposed patch! Few lines after /usr/include/stdio.h:606: is getline declaration. For protocol in current master getdelim ( https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/stdio.h;h=731f8e56f4c115a1a507b85babaa22b21efb140c;hb=HEAD#l600 ) in online 600 while get;line on 610. Real question why on this system getline is not detected? Hints: - on linux configure script defines -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE; - if _DEFAULT_SOURCE is defined then _POSIX_C_SOURCE is set to 200809L (https://sourceware.org/git/?p=glibc.git;a=blob;f=include/features.h;h=d22c32eee6a98c350cad4267b15355fb271b9818;hb=HEAD#l258); - __USE_XOPEN2K8 is set to 1 if _POSIX_C_SOURCE > 200112L or POSIX_C_SOURCE >= 200809L ( https://sourceware.org/git/?p=glibc.git;a=blob;f=include/features.h;h=d22c32eee6a98c350cad4267b15355fb271b9818;hb=HEAD#l323 ) - if __USE_XOPEN2K8 is defined stdio.h header should declare getdelim and getline . I cannot reproduce issue on other GNU C-lib (old 2.23). Why detection fail on reported system?
(In reply to Jakub Jelen from comment #0) [...] > Reproducer: > * configure && make master on current Fedora 28. Interesting, that was one of the systems I tested on and it worked on mine. (In reply to Roumen Petrov from comment #1) > Real question why on this system getline is not detected? That's the question. Can you find that failure in config.log?
My bad. I probably did not regenerate configure so the checks were not performed in to configure at all. Sorry for the noise.
closing resolved bugs as of 8.6p1 release