alpine and OS X 10.5 (Leopard)

You may get the following error when compiling alpine or pine on OS X 10.5 (Leopard):

In file included from osdep.c:49:
env_unix.c: In function ‘dotlock_lock’:
env_unix.c:1188: error: too many arguments to function ‘setpgrp’
In file included from osdep.c:52:
tcp_unix.c: In function ‘tcp_aopen’:
tcp_unix.c:408: error: too many arguments to function ‘setpgrp’
make[4]: *** [osdep.o] Error 1
make[3]: *** [osx] Error 2
make[2]: *** [OSTYPE] Error 2
make[1]: *** [oxp] Error 2
make: *** [c-client] Error 2

To resolve this problem modify the source code to use setsid() instead of setpgrp(), you can use my patch as guidance (applied to alpine .9999):

diff -ruN alpine-0.9999/alpine/send.c alpine-0.9999-JST/alpine/send.c
--- alpine-0.9999/alpine/send.c	2007-08-30 15:33:35.000000000 -0700
+++ alpine-0.9999-JST/alpine/send.c	2007-11-06 14:04:47.000000000 -0800
@@ -3806,7 +3806,7 @@
 		    /*
 		     * Put us in new process group...
 		     */
-		    setpgrp(0, ps_global->post->pid);
+                    setsid();

 		    /* BUG: should fix argv[0] to indicate what we're up to */

diff -ruN alpine-0.9999/imap/src/osdep/unix/env_unix.c alpine-0.9999-JST/imap/src/osdep/unix/env_unix.c
--- alpine-0.9999/imap/src/osdep/unix/env_unix.c	2007-08-16 12:43:35.000000000 -0700
+++ alpine-0.9999-JST/imap/src/osdep/unix/env_unix.c	2007-11-06 14:05:38.000000000 -0800
@@ -1185,7 +1185,7 @@
 	    for (cf = max (20,max (max (pi[0],pi[1]),max(po[0],po[1])));
 		 cf >= 3; --cf) if (cf != fd) close (cf);
 				/* be our own process group */
-	    setpgrp (0,getpid ());
+             setsid();
 				/* now run it */
 	    _exit (execv (argv[0],argv));
 	  }
diff -ruN alpine-0.9999/imap/src/osdep/unix/tcp_unix.c alpine-0.9999-JST/imap/src/osdep/unix/tcp_unix.c
--- alpine-0.9999/imap/src/osdep/unix/tcp_unix.c	2007-08-16 12:43:35.000000000 -0700
+++ alpine-0.9999-JST/imap/src/osdep/unix/tcp_unix.c	2007-11-06 14:05:56.000000000 -0800
@@ -405,7 +405,7 @@
       dup2 (pipeo[0],0);	/* parent's output is my input */
 				/* close all unnecessary descriptors */
       for (cf = 3; cf < = maxfd; cf++) close (cf);
-      setpgrp (0,getpid ());	/* be our own process group */
+      setsid();
       _exit (execv (path,argv));/* now run it */
     }
     _exit (1);			/* child is done */
diff -ruN alpine-0.9999/web/src/alpined.d/alpined.c alpine-0.9999-JST/web/src/alpined.d/alpined.c
--- alpine-0.9999/web/src/alpined.d/alpined.c	2007-08-31 11:52:30.000000000 -0700
+++ alpine-0.9999-JST/web/src/alpined.d/alpined.c	2007-11-06 14:04:24.000000000 -0800
@@ -540,7 +540,7 @@
 			    close(0);		/* disassociate */
 			    close(1);
 			    close(2);
-			    setpgrp(0, 0);
+                            setsid();
 			    break;

 			  default :		/* parent */

Comment (1)

  1. John Wilkins wrote:

    Thank you! That’s just what I needed to get imap to compile on Leopard. Now on to PHP…

    Wednesday, November 21, 2007 at 4.49 pm #