https://bugs.openldap.org/show_bug.cgi?id=9348
Issue ID: 9348 Summary: libldap uses deprecated symbols sys_errlist and sys_nerr Product: OpenLDAP Version: 2.4.53 Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: libraries Assignee: bugs@openldap.org Reporter: ditu.alexandru@gmail.com Target Milestone: ---
Starting with libc >= 2.32 the symbols sys_errlist and sys_nerr are removed:
From the release notes (https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS;hb=HEAD):
* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr are no longer available to newly linked binaries, and their declarations have been removed from from <stdio.h>. They are exported solely as compatibility symbols to support old binaries. All programs should use strerror or strerror_r instead.
Their usage should be removed from libldap (include/ac/errno.h) and replaced with strerror or strerror_r.
Otherwise any library that uses libldap compiled with libc < 2.32 won't run on systems that use newer libc versions (>= 2.32).
https://bugs.openldap.org/show_bug.cgi?id=9348
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #1 from Howard Chu hyc@openldap.org --- (In reply to ditu.alexandru from comment #0)
Starting with libc >= 2.32 the symbols sys_errlist and sys_nerr are removed:
From the release notes (https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS;hb=HEAD):
- The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr are no longer available to newly linked binaries, and their declarations have been removed from from <stdio.h>. They are exported solely as compatibility symbols to support old binaries. All programs should use strerror or strerror_r instead.
Their usage should be removed from libldap (include/ac/errno.h) and replaced with strerror or strerror_r.
Otherwise any library that uses libldap compiled with libc < 2.32 won't run on systems that use newer libc versions (>= 2.32).
sys_errlist is only used if autoconf finds them. If these symbols are no longer declared in glibc 2.32 then OpenLDAP will not use them.
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #2 from Howard Chu hyc@openldap.org --- (In reply to ditu.alexandru from comment #0)
Starting with libc >= 2.32 the symbols sys_errlist and sys_nerr are removed:
From the release notes (https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS;hb=HEAD):
- The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr are no longer available to newly linked binaries, and their declarations have been removed from from <stdio.h>. They are exported solely as compatibility symbols to support old binaries. All programs should use strerror or strerror_r instead.
Otherwise any library that uses libldap compiled with libc < 2.32 won't run on systems that use newer libc versions (>= 2.32).
False. The text you quoted above clearly says that the symbols will still be accessible on >= 2.32 for anything linked on an older version.
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #3 from ditu.alexandru@gmail.com --- You're right indeed: it should work if it's compiled on older libc and run with new ones.
The issue I've encountered was when I was building an executable using libc >= 2.32 and trying to link it with a version of libldap build with libc < 2.32. In this situation I was receiving the error: undefined reference to `sys_errlist'.
libldap does not provide any workaround for this situation. Is it possible to add a configure flag so I can force it to use only strerror instead of the deprecated symbols?
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #4 from Howard Chu hyc@openldap.org --- (In reply to ditu.alexandru from comment #3)
You're right indeed: it should work if it's compiled on older libc and run with new ones.
The issue I've encountered was when I was building an executable using libc
= 2.32 and trying to link it with a version of libldap build with libc <
2.32. In this situation I was receiving the error: undefined reference to `sys_errlist'.
libldap does not provide any workaround for this situation. Is it possible to add a configure flag so I can force it to use only strerror instead of the deprecated symbols?
Set ol_cv_have_sys_errlist=no when running configure.
But again, if you have to recompile libldap anyway, then just build it on new libc and forget about it.
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #5 from ditu.alexandru@gmail.com --- 1. I've tried setting the flag ol_cv_have_sys_errlist=no but it won't compile anymore (using libc < 2.32 which defines those symbols, so I believe it's conflicting with them):
2. I cannot build it with newer libc version and I cannot stop my library users to compile with newer libc...
That's why a configure flag would be nice :)
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #6 from ditu.alexandru@gmail.com --- (In reply to ditu.alexandru from comment #5)
- I've tried setting the flag ol_cv_have_sys_errlist=no but it won't
compile anymore (using libc < 2.32 which defines those symbols, so I believe it's conflicting with them):
Actually it compiles (I've confused it with option ol_cv_dcl_sys_errlist with wich I had problems).
If I compile with the flag ol_cv_have_sys_errlist=no I still encounter the issue:
nm libraries/libldap/.libs/libldap.a | grep sys_errlist U sys_errlist
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #7 from Howard Chu hyc@openldap.org --- (In reply to ditu.alexandru from comment #6)
(In reply to ditu.alexandru from comment #5)
- I've tried setting the flag ol_cv_have_sys_errlist=no but it won't
compile anymore (using libc < 2.32 which defines those symbols, so I believe it's conflicting with them):
Actually it compiles (I've confused it with option ol_cv_dcl_sys_errlist with wich I had problems).
If I compile with the flag ol_cv_have_sys_errlist=no I still encounter the issue:
nm libraries/libldap/.libs/libldap.a | grep sys_errlist U sys_errlist
You actually need to set both ol_cv_dcl_sys_errlist=no and ol_cv_have_sys_errlist=no.
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #8 from ditu.alexandru@gmail.com --- (In reply to Howard Chu from comment #7)
(In reply to ditu.alexandru from comment #6)
(In reply to ditu.alexandru from comment #5)
- I've tried setting the flag ol_cv_have_sys_errlist=no but it won't
compile anymore (using libc < 2.32 which defines those symbols, so I believe it's conflicting with them):
Actually it compiles (I've confused it with option ol_cv_dcl_sys_errlist with wich I had problems).
If I compile with the flag ol_cv_have_sys_errlist=no I still encounter the issue:
nm libraries/libldap/.libs/libldap.a | grep sys_errlist U sys_errlist
You actually need to set both ol_cv_dcl_sys_errlist=no and ol_cv_have_sys_errlist=no.
When using this config: ./configure ol_cv_have_sys_errlist=no ol_cv_dcl_sys_errlist=no --enable-shared=no --with-pic --enable-slapd=no --with-cyrus-sasl --prefix=/build-x86_64/tmp
I receive the following errors (about these errors I was talking about in the comment 5):
gcc -g -O2 -I../../include -I../../include -I/build-x86_64/tmp/include -DLDAP_LIBRARY -c util-int.c -fPIC -DPIC -o util-int.o In file included from util-int.c:31: ../../include/ac/errno.h:28:20: error: expected identifier or '(' before numeric constant # define sys_nerr 0 ^ ../../include/ac/errno.h:29:25: error: expected identifier or '(' before 'char' # define sys_errlist ((char **)0) ^~~~ ../../include/ac/errno.h:29:33: error: expected ')' before numeric constant # define sys_errlist ((char **)0) ^ Makefile:412: recipe for target 'util-int.lo' failed
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #9 from Howard Chu hyc@openldap.org --- Created attachment 765 --> https://bugs.openldap.org/attachment.cgi?id=765&action=edit Fix build without sys_errlist
(In reply to ditu.alexandru from comment #8)
(In reply to Howard Chu from comment #7)
You actually need to set both ol_cv_dcl_sys_errlist=no and ol_cv_have_sys_errlist=no.
When using this config: ./configure ol_cv_have_sys_errlist=no ol_cv_dcl_sys_errlist=no --enable-shared=no --with-pic --enable-slapd=no --with-cyrus-sasl --prefix=/build-x86_64/tmp
I receive the following errors (about these errors I was talking about in the comment 5):
gcc -g -O2 -I../../include -I../../include -I/build-x86_64/tmp/include -DLDAP_LIBRARY -c util-int.c -fPIC -DPIC -o util-int.o In file included from util-int.c:31: ../../include/ac/errno.h:28:20: error: expected identifier or '(' before numeric constant # define sys_nerr 0 ^ ../../include/ac/errno.h:29:25: error: expected identifier or '(' before 'char' # define sys_errlist ((char **)0) ^~~~ ../../include/ac/errno.h:29:33: error: expected ')' before numeric constant # define sys_errlist ((char **)0) ^ Makefile:412: recipe for target 'util-int.lo' failed
OK, I see these errors too. The attached patch will shut that up. Moving forward, all of these definitions should be removed, as only one place even uses this STRERROR stuff now. Everything else uses AC_STRERROR_R.
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #10 from ditu.alexandru@gmail.com --- I've tested the patch and it fixes the problem. Thank you!
Will this patch be included in the next release?
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #11 from Howard Chu hyc@openldap.org --- (In reply to ditu.alexandru from comment #10)
I've tested the patch and it fixes the problem. Thank you!
Will this patch be included in the next release?
This, or this other one https://git.openldap.org/openldap/openldap/-/merge_requests/162
https://bugs.openldap.org/show_bug.cgi?id=9348
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CONFIRMED Resolution|INVALID |--- Ever confirmed|0 |1
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #12 from ditu.alexandru@gmail.com --- Great, thanks again!
https://bugs.openldap.org/show_bug.cgi?id=9348
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.4.54
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #13 from Quanah Gibson-Mount quanah@openldap.org --- Commits: • c3131eb5 by Howard Chu at 2020-09-24T23:34:36+00:00 ITS#9348 replace all uses of STRERROR with AC_STRERROR_R
Avoid using sys_errlist unless there's no other choice
• 81e43a63 by Howard Chu at 2020-09-24T23:34:36+00:00 ITS#9348 cleanup strerr/sys_errlist detection
• 3f5293e1 by Ondřej Kuzník at 2020-09-24T23:34:36+00:00 ITS#5422 Save errno before passing it to Debug()
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #14 from Quanah Gibson-Mount quanah@openldap.org --- and earlier Commits: • 997b28d0 by Howard Chu at 2020-09-16T15:11:01+01:00 ITS#9348 don't declare sys_errlist if not present
If HAVE_SYS_ERRLIST is false, nothing uses them anyway, so the declarations serve no purpose. Just breaks the compile if the library actually defines them (and we are avoiding using them).
https://bugs.openldap.org/show_bug.cgi?id=9348
--- Comment #15 from Quanah Gibson-Mount quanah@openldap.org --- And more:
Commits: • 67d005ee by Ondřej Kuzník at 2020-09-25T12:47:46+01:00 ITS#9348 Stop using plain strerror()
https://bugs.openldap.org/show_bug.cgi?id=9348
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |RESOLVED Resolution|--- |TEST Target Milestone|2.4.54 |2.5.0
https://bugs.openldap.org/show_bug.cgi?id=9348
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED Resolution|TEST |FIXED