https://bugs.openldap.org/show_bug.cgi?id=9648
Issue ID: 9648 Summary: 'MAXPATHLEN' undeclared on some systems Product: OpenLDAP Version: 2.5.4 Hardware: All OS: Linux Status: UNCONFIRMED Severity: normal Priority: --- Component: libraries Assignee: bugs@openldap.org Reporter: git@freundtech.com Target Milestone: ---
Created attachment 834 --> https://bugs.openldap.org/attachment.cgi?id=834&action=edit Docker reproduction
I'm trying to compile OpenLDAP 2.5.7 on Alpine Linux, but have verified that the problem exists since 2.5.4. Version 2.4.59 compiles correctly with everything else equal.
Compilation fails with In file included from ldap-int.h:119, from request.c:53: request.c: In function 'ldap_dump_connection': ../../include/ldap_pvt.h:181:25: error: 'MAXPATHLEN' undeclared (first use in this function) 181 | #define LDAP_IPADDRLEN (MAXPATHLEN + sizeof("PATH=")) | ^~~~~~~~~~ request.c:859:17: note: in expansion of macro 'LDAP_IPADDRLEN' 859 | char from[LDAP_IPADDRLEN]; | ^~~~~~~~~~~~~~ ../../include/ldap_pvt.h:181:25: note: each undeclared identifier is reported only once for each function it appears in 181 | #define LDAP_IPADDRLEN (MAXPATHLEN + sizeof("PATH=")) | ^~~~~~~~~~ request.c:859:17: note: in expansion of macro 'LDAP_IPADDRLEN' 859 | char from[LDAP_IPADDRLEN]; | ^~~~~~~~~~~~~~ make[2]: Leaving directory '/tmp/openldap/libraries/libldap'
Thanks to JoBbZ on IRC I found out that including <ac/param.h> in ldap_pvt.h seems to fix the issue.
My best guess as to why this fails on Alpine Linux and not on other distributions is that Alpine uses musl instead of glibc as it's libc implementation.
I have attacked an (unfinished) dockerfile for reproduction of the issue.
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #1 from git@freundtech.com --- I just noticed that this should probably be filed under "build" instead of under "libraries". I filed it here because the build failure occurs in a libraries code. I don't have permissions to change the component after submitting the issue, so someone else will have to move this.
Also the last sentence above should obviously read "attached" instead of "attacked"
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Component|libraries |build Target Milestone|--- |2.5.8 Status|UNCONFIRMED |IN_PROGRESS
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- Thanks for filing the report
--Quanah (AKA JoBbZ)
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugs@openldap.org |quanah@openldap.org
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- https://git.openldap.org/openldap/openldap/-/merge_requests/383
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #4 from git@freundtech.com --- I'm commenting here because I can't comment on the merge request right now. I created an account on the gitlab, but it needs to be approved first.
I have verified that adding the include to request.c does also fix this issue. OpenLDAP compiles correctly and all tests pass. However when using --enable-balancer=yes compilation still succeeds, but the lloadd tests fail with
Executing all LDAP tests for the Load Balancer Starting test000-rootdse for mdb...
running defines.sh Starting slapd on TCP/IP port 9012... Starting a second slapd on TCP/IP port 9013... Starting a third slapd on TCP/IP port 9014... Starting lloadd on TCP/IP port 9011... Using ldapsearch to retrieve the root DSE... Waiting 7 seconds for lloadd to start... Waiting 7 seconds for lloadd to start... Waiting 7 seconds for lloadd to start... Waiting 7 seconds for lloadd to start... Waiting 7 seconds for lloadd to start... Waiting 7 seconds for lloadd to start... sh: can't kill pid 22101: No such process
Test failed test000-rootdse failed for mdb after 44 seconds
(exit 255)
I tried this because Quanah mentioned that LDAP_IPADDRLEN is also used in servers/lloadd/daemon.c. That may or may not be related to this issue. I'm still investigating. Test succeed on my main machine, but fail in the alpine container though. I'll attach an updated dockerfile for reproduction.
https://bugs.openldap.org/show_bug.cgi?id=9648
git@freundtech.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #834 is|0 |1 obsolete| |
--- Comment #5 from git@freundtech.com --- Created attachment 835 --> https://bugs.openldap.org/attachment.cgi?id=835&action=edit Updated dockerfile, which applies patch and runs tests
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #6 from git@freundtech.com --- Created attachment 836 --> https://bugs.openldap.org/attachment.cgi?id=836&action=edit The patch used by the dockerfile
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #7 from git@freundtech.com --- After some more investigation the lloadd issue seems unrelated. I opened https://bugs.openldap.org/show_bug.cgi?id=9650 for it.
The merge request on Gitlab seems to fix this issue.
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|IN_PROGRESS |RESOLVED
--- Comment #8 from Quanah Gibson-Mount quanah@openldap.org --- Commits: • 0412814c by Quanah Gibson-Mount at 2021-08-26T17:55:54+00:00 ITS#9648 - Include ac/param.h for MAXPATHLEN
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #9 from Quanah Gibson-Mount quanah@openldap.org --- RE25:
• 78212cb0 by Quanah Gibson-Mount at 2021-08-26T21:18:50+00:00 ITS#9648 - Include ac/param.h for MAXPATHLEN
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ryan@openldap.org
--- Comment #10 from Quanah Gibson-Mount quanah@openldap.org --- *** Issue 9658 has been marked as a duplicate of this issue. ***
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CONFIRMED Resolution|FIXED |---
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |IN_PROGRESS
--- Comment #11 from Quanah Gibson-Mount quanah@openldap.org --- https://git.openldap.org/openldap/openldap/-/merge_requests/392
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #12 from Quanah Gibson-Mount quanah@openldap.org --- *** Issue 9658 has been marked as a duplicate of this issue. ***
https://bugs.openldap.org/show_bug.cgi?id=9648
--- Comment #13 from Quanah Gibson-Mount quanah@openldap.org --- Commits: • 617e6974 by Quanah Gibson-Mount at 2021-08-31T16:33:57+00:00 ITS#9648 - Fix request.c for MAXPATHLEN not result.c Fixes 0412814c55e59890343cd4f224f16102bfedceec
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|IN_PROGRESS |RESOLVED
--- Comment #14 from Quanah Gibson-Mount quanah@openldap.org --- RE25:
Commits: • 5463adab by Quanah Gibson-Mount at 2021-08-31T17:35:50+00:00 ITS#9648 - Fix request.c for MAXPATHLEN not result.c Fixes 0412814c55e59890343cd4f224f16102bfedceec
https://bugs.openldap.org/show_bug.cgi?id=9648
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED