Bug 161549

Summary: Bugs with aio_suspend configure test in net/samba35
Product: Ports & Packages Reporter: Enji Cooper <ngie>
Component: Individual Port(s)Assignee: Timur I. Bakeyev <timur>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
net-samba35-configure_in.patch.txt none

Description Enji Cooper freebsd_committer freebsd_triage 2011-10-13 17:50:06 UTC
The current autoconf test is written improperly per POSIX and fails as follows:

configure:33543: checking for aio_suspend
configure:33550: cc -o conftest -O2 -pipe -fno-strict-aliasing -pipe -O2 -march=core2 -DLDAP_DEPRECATED -I/usr/include -I/usr/include -I/usr/local/include -Iinclude -I./include  -I. -I. -I./../lib/replace -I./../lib/tevent -I./libaddns -I./librpc -I./.. -I./../lib/popt -I/usr/local/include -DLDAP_DEPRECATED  -L/usr/local/lib -L./bin -L/usr/local/lib conftest.c -lexecinfo      -liconv -lrt >&5
conftest.c: In function 'main':
conftest.c:462: error: 'NULL' undeclared (first use in this function)
conftest.c:462: error: (Each undeclared identifier is reported only once
conftest.c:462: error: for each function it appears in.)
conftest.c:462: warning: passing argument 1 of 'aio_suspend' from incompatible pointer type
configure:33550: $? = 1

The problem is two-fold:

1. NULL must be pulled in from an approved header. The OpenGroup manpages state that stdlib.h must define NULL so I will use that.
2. Better typing and pointer casting needs to be done with the struct aiocb* that's passed into aio_suspend.

Bottom line is that the following autoconf testcase should be used instead of the current one:

#include <aio.h>
#include <stdlib.h>
int main() {
    struct aiocb *a[1];
    return aio_suspend((const struct aiocb**)a, 1, NULL);
}

Fix: The revised net/samba35/files/patch-source3__configure.in is attached. Unfortunately my anoncvs is fubared and doesn't have this port for some odd reason.

Patch attached with submission follows:
How-To-Repeat: - Run 'make configure WITH_AIO_SUPPORT=y' on FreeBSD 8.x+.
- Check $WRKDIR/source3/config.log for errors related to aio_suspend.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-10-13 17:50:17 UTC
Responsible Changed
From-To: freebsd-ports-bugs->timur

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Enji Cooper freebsd_committer freebsd_triage 2011-10-13 18:07:00 UTC
 	The previously attached patch didn't work (the patch level doesn't 
appear to be consistent with other ports), and the quoting was wrong with 
m4.
Thanks,
-Garrett
Comment 3 Enji Cooper freebsd_committer freebsd_triage 2011-10-13 21:18:42 UTC
Thanks to another typo in the source, this is a non-issue for FreeBSD today:

int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[],
                 int n, const struct timespec *timeout)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64)
&& defined(HAVE_AIO_SUSPEND64)
        return aio_suspend64(cblist, n, timeout);
#elif defined(HAVE_AIO_FSYNC)
        return aio_suspend(cblist, n, timeout);
#else
        errno = ENOSYS;
        return -1;

That should probably be fixed though..
-Garrett
Comment 4 Timur I. Bakeyev freebsd_committer freebsd_triage 2013-02-23 20:01:30 UTC
State Changed
From-To: open->closed

Finally, fixed in upstream. Thanks!