Bug 51307

Summary: Build error: ldap/apr_ldap_rebind.c
Product: APR Reporter: Philipp <pippo>
Component: APR-utilAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: NEW ---    
Severity: major Keywords: FixedInTrunk
Priority: P2    
Version: 1.3.12   
Target Milestone: ---   
Hardware: HP   
OS: FreeBSD   
Attachments: Patch for apr_ldap_rebind.c

Description Philipp 2011-06-01 13:57:27 UTC
Created attachment 27100 [details]
Patch for apr_ldap_rebind.c

I run into this while upgrading ports on some FreeBSD 7.3 instances running apache with the APR. The former port compiled without problems: apr-nothr-devrandom-gdbm-db42-ldap24-1.4.2.1.3.10 (apr-utils 1.3.10)

The build options look like this:

┌────────────────────────────────────────────────────────────────────┐
│  Options for apr-nothr-devrandom-gdbm-db42-ldap24 1.4.5.1.3.12     │  
│ ┌────────────────────────────────────────────────────────────────┐ │  
│ │     [ ] THREADS    Enable Threads in apr                       │ │  
│ │     [ ] IPV6       Enable IPV6 Support in apr                  │ │  
│ │     [X] BDB        Enable Berkley BDB support in apr-util      │ │  
│ │     [X] GDBM       Enable GNU dbm support in apr-util          │ │  
│ │     [X] LDAP       Enable LDAP support in apr-util             │ │  
│ │     [ ] MYSQL      Enable MySQL suport in apr-util             │ │  
│ │     [ ] NDBM       Enable NDBM support in apr-util             │ │  
│ │     [ ] PGSQL      Enable Postgresql suport in apr-util        │ │  
│ │     [ ] SQLITE     Enable SQLite3 support in apr-util          │ │  
│ │     [X] DEVRANDOM  Use /dev/random or compatible in apr        │ │  
│ │                                                                │ │  
│ │                                                                │ │  
│ │                                                                │ │  
│ │                                                                │ │  
│ │                                                                │ │  
├─└────────────────────────────────────────────────────────────────┘─┤  
│                       [  OK  ]       Cancel                        │  
└────────────────────────────────────────────────────────────────────┘

Now, building the port stops with following error:
...
ldap/apr_ldap_rebind.c: In function 'apr__ldap_rebind_init':
ldap/apr_ldap_rebind.c:85: error: 'apr_ldap_xref_lock' undeclared (first use in this function)
ldap/apr_ldap_rebind.c:85: error: (Each undeclared identifier is reported only once
ldap/apr_ldap_rebind.c:85: error: for each function it appears in.)
...


I found this patch to be useful to me: (same in the attachment)


--- apr_ldap_rebind.c	2011-06-01 15:36:20.000000000 +0200
+++ apr_ldap_rebind.c.original	2011-05-10 23:34:43.000000000 +0200
@@ -81,12 +81,11 @@
     get_apd
 #endif
 
-#if APR_HAS_THREADS
     /* run after apr_thread_mutex_create cleanup */
     apr_pool_cleanup_register(pool, &apr_ldap_xref_lock, apr_ldap_pool_cleanup_set_null,
                               apr_pool_cleanup_null);
 
-
+#if APR_HAS_THREADS
     if (apr_ldap_xref_lock == NULL) {
         retcode = apr_thread_mutex_create(&apr_ldap_xref_lock, APR_THREAD_MUTEX_DEFAULT, pool);
     }


I built this on one machine and it is running without apparent problems so far. I've checked sources for apr-utils 1.4.2 too and I see the same potential error.

Thank you for your great work! Cheers,
Philipp
Comment 1 Eric Covener 2011-06-01 15:12:05 UTC
thanks for report, working on this now (including httpd trunk where the code was recently moved)
Comment 2 Stefan Fritsch 2011-07-23 17:57:59 UTC
Eric has commited the fix to the apr-util 1.[345] branches.