[Bug 2881] New: getdelim definition in openbsd compat conflicts with /usr/include/stdio.h on Fedora 28 with master

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Wed Jul 4 00:52:59 AEST 2018


https://bugzilla.mindrot.org/show_bug.cgi?id=2881

            Bug ID: 2881
           Summary: getdelim definition in openbsd compat conflicts with
                    /usr/include/stdio.h on Fedora 28 with master
           Product: Portable OpenSSH
           Version: 7.7p1
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Build system
          Assignee: unassigned-bugs at mindrot.org
          Reporter: jjelen at redhat.com

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

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list