Patch for alpine to use lockspool(1) for proper mailbox locking and eliminate warning messages on startup. Tested on 7.6/amd64. Full credit for this patch goes to joe at sourceopen dot com.
ok? Index: patches/patch-imap_src_osdep_unix_Makefile =================================================================== RCS file: /cvs/ports/mail/alpine/patches/patch-imap_src_osdep_unix_Makefile,v retrieving revision 1.8 diff -u -p -u -p -r1.8 patch-imap_src_osdep_unix_Makefile --- patches/patch-imap_src_osdep_unix_Makefile 1 Jan 2023 21:02:07 -0000 1.8 +++ patches/patch-imap_src_osdep_unix_Makefile 23 Jan 2025 21:58:22 -0000 @@ -56,7 +56,7 @@ Index: imap/src/osdep/unix/Makefile SPOOLDIR=/var \ ACTIVEFILE=/usr/local/news/lib/active \ RSHPATH=/usr/bin/rsh \ -+ LOCKPGM=$(PREFIX)/libexec/mlock \ ++ LOCKPGM=/usr/libexec/lockspool \ BASECFLAGS="$(GCCCFLAGS)" cvx: # Convex Index: patches/patch-imap_src_osdep_unix_env_unix_c =================================================================== RCS file: /cvs/ports/mail/alpine/patches/patch-imap_src_osdep_unix_env_unix_c,v retrieving revision 1.6 diff -u -p -u -p -r1.6 patch-imap_src_osdep_unix_env_unix_c --- patches/patch-imap_src_osdep_unix_env_unix_c 11 Mar 2022 19:34:32 -0000 1.6 +++ patches/patch-imap_src_osdep_unix_env_unix_c 23 Jan 2025 21:58:22 -0000 @@ -31,3 +31,41 @@ Index: imap/src/osdep/unix/env_unix.c return myMailboxDir ? myMailboxDir : ""; } +@@ -1233,14 +1230,11 @@ long dotlock_lock (char *file,DOTLOCK *base,int fd) + case EACCES: /* protection failure? */ + MM_CRITICAL (NIL); /* go critical */ + if (closedBox || !lockpgm); /* can't do on closed box or disabled */ +- else if ((*lockpgm && stat (lockpgm,&sb)) || +- (!*lockpgm && stat (lockpgm = LOCKPGM1,&sb) && +- stat (lockpgm = LOCKPGM2,&sb) && stat (lockpgm = LOCKPGM3,&sb) && +- stat (lockpgm = LOCKPGM4,&sb))) ++ else if (*lockpgm && stat (lockpgm,&sb)) /* lockspool(1) on OBSD */ + lockpgm = NIL; /* disable if can't find lockpgm */ + else if (pipe (pi) >= 0) { /* make command pipes */ + long cf; +- char *argv[4],arg[20]; ++ char *argv[2]; /* lockspool(1) takes no addt'l arguments */ + /* if input pipes usable create output pipes */ + if ((pi[0] < FD_SETSIZE) && (pi[1] < FD_SETSIZE) && (pipe (po) >= 0)) { + /* make sure output pipes are usable */ +@@ -1249,9 +1243,7 @@ long dotlock_lock (char *file,DOTLOCK *base,int fd) + else if (!(j = fork ())) { + if (!fork ()) { /* make grandchild so it's inherited by init */ + /* prepare argument vector */ +- sprintf (arg,"%d",fd); +- argv[0] = lockpgm; argv[1] = arg; +- argv[2] = file; argv[3] = NIL; ++ argv[0] = lockpgm; argv[1] = NIL; /* no args for lockspool(1) */ + /* set parent's I/O to my O/I */ + dup2 (pi[1],1); dup2 (pi[1],2); dup2 (po[0],0); + /* close all unnecessary descriptors */ +@@ -1273,7 +1265,8 @@ long dotlock_lock (char *file,DOTLOCK *base,int fd) + grim_pid_reap (j,NIL);/* reap child; grandchild now owned by init */ + /* read response from locking program */ + if (select (pi[0]+1,&rfd,0,0,&tmo) && +- (read (pi[0],tmp,1) == 1) && (tmp[0] == '+')) { ++ (read (pi[0],tmp,1) == 1) && (tmp[0] == '1')) { ++ /* OpenBSD lockspool(1) writes 1 to stdout on success */ + /* success, record pipes */ + base->pipei = pi[0]; base->pipeo = po[1]; + /* close child's side of the pipes */