Skip Menu |
 

This queue is for tickets about the PPerl CPAN distribution.

Report information
The Basics
Id: 21494
Status: open
Priority: 0/
Queue: PPerl

People
Owner: Nobody in particular
Requestors: VKHERA [...] cpan.org
Cc: imacat [...] cpan.org
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.25
Fixed in: (no value)



Subject: PPerl patch to work on amd64 platform
Download (untitled) / with headers
text/plain 260b
Attached patch updates the send_fd and recv_fd functions to work with 64-bit systems. Patch tested on FreeBSD 5.4 i386, FreeBSD 6.1 i386 and amd64. All self-tests pass with this patch. Code is based on that in postfix 2.3.3 so should be extremely portable.
Subject: pperl.64bit.patch
Download pperl.64bit.patch
text/x-diff 4.1k
diff -Nru PPerl-0.25/Makefile.PL PPerl-0.25.new/Makefile.PL --- PPerl-0.25/Makefile.PL Thu Jul 11 11:11:50 2002 +++ PPerl-0.25.new/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 PPerl-0.25/main.c PPerl-0.25.new/main.c --- PPerl-0.25/main.c Tue Mar 2 12:06:15 2004 +++ PPerl-0.25.new/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 PPerl-0.25/pass_fd.c PPerl-0.25.new/pass_fd.c --- PPerl-0.25/pass_fd.c Thu Aug 22 04:37:09 2002 +++ PPerl-0.25.new/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
Download (untitled) / with headers
text/plain 423b
Hi. This is imacat from Taiwan. I have confirmed that PPerl-0.25 does not work on Linux x86_64 platform, too. Also, the patch submitted by VKHERA does work on Linux x86_64 platform. Please apply this patch, as there are several packages rely on PPerl-0.25 and they may lock up whenever CPAN testers are testing them on our daily automated tests. Thank you. Please tell me if you need any more information.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.