From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Sep 14 19:50:20 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 571C516A40F for ; Thu, 14 Sep 2006 19:50:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCF4143D55 for ; Thu, 14 Sep 2006 19:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k8EJoJG7067395 for ; Thu, 14 Sep 2006 19:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k8EJoJA3067394; Thu, 14 Sep 2006 19:50:19 GMT (envelope-from gnats) Resent-Date: Thu, 14 Sep 2006 19:50:19 GMT Resent-Message-Id: <200609141950.k8EJoJA3067394@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vivek Khera Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 888FA16A403 for ; Thu, 14 Sep 2006 19:44:39 +0000 (UTC) (envelope-from khera@kcilink.com) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3162E43D45 for ; Thu, 14 Sep 2006 19:44:39 +0000 (GMT) (envelope-from khera@kcilink.com) Received: by yertle.kcilink.com (Postfix, from userid 1002) id 36D9BB810; Thu, 14 Sep 2006 15:44:38 -0400 (EDT) Message-Id: <20060914194438.36D9BB810@yertle.kcilink.com> Date: Thu, 14 Sep 2006 15:44:38 -0400 (EDT) From: Vivek Khera To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/103282: patch devel/p5-PPerl for amd64 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Vivek Khera List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2006 19:50:20 -0000 >Number: 103282 >Category: ports >Synopsis: patch devel/p5-PPerl for amd64 >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Thu Sep 14 19:50:19 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Vivek Khera >Release: FreeBSD 6.1-PRERELEASE amd64 >Organization: >Environment: System: FreeBSD yertle.int.kciLink.com 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #4: Thu Mar 2 13:53:40 EST 2006 khera@yertle.int.kciLink.com:/usr/obj/usr/src/sys/KCI64 amd64 >Description: devel/p5-PPerl port fails its self tests on amd64 due to the code that it uses for passing file descriptors over a socket. this patch fixes that issue, plus a minor bug in argument processing and compile flag settings. >How-To-Repeat: build PPerl on amd64 and run "make test" in the WRKSRC directory. >Fix: The below patches have been sent to the upstream author for inclusion in the next release. I submit to ports as a stop-gap measure until that release is issued. Add this file in the files subdir for the port as patch-pperl-64bit diff -Nru ./Makefile.PL ./Makefile.PL --- ./Makefile.PL Thu Jul 11 11:11:50 2002 +++ ./Makefile.PL Thu Sep 14 11:48:23 2006 @@ -69,7 +69,7 @@ main.o: Makefile main.c pperl.h pperl: main.o pass_fd.o -\t\$(CC) \$(CFLAGS) \$(LDFLAGS) \$(DEFINE) -o pperl main.o pass_fd.o $Config{libs} +\t\$(CC) \$(CCFLAGS) \$(OPTIMIZE) \$(LDFLAGS) \$(DEFINE) -o pperl main.o pass_fd.o $Config{libs} pass_fd.c: pass_fd.h diff -Nru ./main.c ./main.c --- ./main.c Tue Mar 2 12:06:15 2004 +++ ./main.c Thu Sep 14 11:42:42 2006 @@ -105,11 +105,11 @@ newval = atoi(pArg); if (newval > 0) prefork = newval; } - else if (!strncmp(pArg, "--logfile", 7) ) { + else if (!strncmp(pArg, "--logfile", 9) ) { int newval; char *filename; - if (pArg[7] == '=') /* --logfile=.... */ - pArg += 13; + if (pArg[9] == '=') /* --logfile=.... */ + pArg += 10; else pArg = argv[++i]; diff -Nru ./pass_fd.c ./pass_fd.c --- ./pass_fd.c Thu Aug 22 04:37:09 2002 +++ ./pass_fd.c Thu Sep 14 11:36:05 2006 @@ -93,73 +93,74 @@ #else -struct cmessage { - struct cmsghdr cmsg; - int fd; -}; +/* based on code from Postfix 2.3.3 (vk) */ + +union { + struct cmsghdr just_for_alignment; + char control[CMSG_SPACE(sizeof(int))]; +} control_un; int -send_fd(int over, int this) +send_fd(int over, int sendfd) { - struct iovec iov[1]; - struct msghdr msg; - struct cmessage cm; - char sendbuf[] = ""; - - iov[0].iov_base = (char *)&sendbuf; - iov[0].iov_len = sizeof(sendbuf); - - cm.cmsg.cmsg_type = SCM_RIGHTS; - cm.cmsg.cmsg_level = SOL_SOCKET; - cm.cmsg.cmsg_len = sizeof(struct cmessage); - cm.fd = this; - - msg.msg_iov = iov; - msg.msg_iovlen = 1; - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_control = (caddr_t)&cm; - msg.msg_controllen = sizeof(struct cmessage); - msg.msg_flags = 0; - - if (sendmsg(over, &msg, 0) < 0) - return -1; - return 0; + struct iovec iov[1]; + struct msghdr msg; + struct cmsghdr *cmptr; + + memset((char *) &msg, 0, sizeof(msg)); + + msg.msg_control = control_un.control; + msg.msg_controllen = CMSG_LEN(sizeof(sendfd)); + + cmptr = CMSG_FIRSTHDR(&msg); + cmptr->cmsg_len = CMSG_LEN(sizeof(sendfd)); + cmptr->cmsg_level = SOL_SOCKET; + cmptr->cmsg_type = SCM_RIGHTS; + *(int *) CMSG_DATA(cmptr) = sendfd; + + msg.msg_name = NULL; + msg.msg_namelen = 0; + + iov[0].iov_base = ""; + iov[0].iov_len = 1; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + + if (sendmsg(over, &msg, 0) < 0) + return -1; + return 0; } int recv_fd(int over) { - struct iovec iov[1]; struct msghdr msg; - struct cmessage cm; - ssize_t got; - char recbuf; - - /* in examples this was >1 but this causes too much to be read, - * causing sync issues */ + struct iovec iov[1]; + char buf[1]; + struct cmsghdr *cmptr; - iov[0].iov_base = &recbuf; - iov[0].iov_len = 1; + memset((char *) &msg, 0, sizeof(msg)); + msg.msg_control = control_un.control; + msg.msg_controllen = CMSG_LEN(sizeof(int)); - bzero((char *)&cm, sizeof(cm)); - bzero((char *)&msg, sizeof(msg)); + msg.msg_name = 0; + msg.msg_namelen = 0; + iov[0].iov_base = buf; + iov[0].iov_len = sizeof(buf); msg.msg_iov = iov; msg.msg_iovlen = 1; - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_control = (caddr_t)&cm; - msg.msg_controllen = sizeof(struct cmessage); - msg.msg_flags = 0; - - if ((got = recvmsg(over, &msg, 0)) < 0) - return -1; - if (cm.cmsg.cmsg_type != SCM_RIGHTS) - return -1; + if (recvmsg(over, &msg, 0) < 0) + return (-1); - return cm.fd; + if ((cmptr = CMSG_FIRSTHDR(&msg)) != 0 + && cmptr->cmsg_len == CMSG_LEN(sizeof(int))) { + if (cmptr->cmsg_level != SOL_SOCKET || cmptr->cmsg_type != SCM_RIGHTS) + return(-1); /* error */ + return (*(int *) CMSG_DATA(cmptr)); /* the file handle */ + } else + return (-1); } #endif >Release-Note: >Audit-Trail: >Unformatted: