From jld@panix.com Thu Jan 12 17:35:28 2006 Flags: 000000000005 Return-Path: Received: from mail3.panix.com (mail3.panix.com [166.84.1.74]) by elderberry.cc.columbia.edu (8.13.0/8.13.0) with ESMTP id k0CMZSU6008588 for ; Thu, 12 Jan 2006 17:35:31 -0500 (EST) Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mail3.panix.com (Postfix) with ESMTP id 4B3FF13A87A; Thu, 12 Jan 2006 17:35:28 -0500 (EST) Received: (from jld@localhost) by panix5.panix.com (8.11.6p3/8.8.8/PanixN1.1) id k0CMZSl06621; Thu, 12 Jan 2006 17:35:28 -0500 (EST) Date: Thu, 12 Jan 2006 17:35:28 -0500 From: "Jed Davis [staff]" To: fdc@columbia.edu Cc: Ken Harrenstien Subject: MM Maildir patch Message-ID: <20060112223528.GC24694@panix.com> References: <20060112215121.GC7190.req@panix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline In-Reply-To: <20060112215121.GC7190.req@panix.com> X-User-Agent-Host: NetBSD panix5.panix.com 2.0.3 i386 User-Agent: Mutt/1.5.10i X-Spam-Score: 0 () X-Scanned-By: MIMEDefang 2.48 on 128.59.28.166 Status: --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 12, 2006 at 04:51:21PM -0500, Victoria O'Staff wrote: > ----- Forwarded message from Frank da Cruz ----- > From: Frank da Cruz > To: Ed Ravin > cc: support@panix.com, klh@panix.com > Subject: New MM on Panix > > I think I have all the MM_PANIX code still in place (in mm/newmail.c) and I > tried to replicate the Panix setup in mm/config.h. As far as I can tell, > everything is OK, but it doesn't pick up new mail, even though it seems to > be looking in the right place, in my case: > > /net/u/1/f/fdc/.maildir/ The problem is that, if it's just checking the mtime on that directory, that won't work: new mail is created in the "tmp" subdirectory and moved >From there to the "new" subdirectory, which will touch those dirs but not the top-level maildir. I have a patch for 0.91's newmail.c which... isn't the cleanest approach, I'll freely admit, but does work; I'm attaching it to this message. (I've been meaning to send it on for a while now, but there's been a lot of stuff on my various lists; sorry about that.) I also had to fix some uses of old-style varargs elsewhere, as NetBSD 2's cc doesn't support them, but it sounds like that's also been fixed upstream. -- Jed Davis [staff] jld@panix.com --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mm-maildir-newmail.patch" --- newmail.c.orig 2005-09-22 19:47:10.000000000 -0400 +++ newmail.c 2005-09-22 21:39:50.000000000 -0400 @@ -147,6 +147,28 @@ for(im = incoming_mail; im && *im; im++) { /* loop over inboxes */ if (stat(*im,&sbuf) < 0) continue; +#ifdef MM_PANIX + /* Minimal support for the Maildir format. */ + if (S_ISDIR(sbuf.st_mode)) { + static const char* mdsubdirs[] = { "/cur", "/new", "/tmp" }; + size_t iml = strlen(*im); + char *mdp = malloc(iml + 4 /*subdir*/ + 1 /*null*/); + struct stat mdbuf; + int sdi; + + strcpy(mdp, *im); + for (sdi=0; sdi<(sizeof(mdsubdirs)/sizeof(mdsubdirs[0])); ++sdi) { + strcpy(mdp + iml, mdsubdirs[sdi]); + if (stat(mdp, &mdbuf) < 0) goto out; + if (!S_ISDIR(mdbuf.st_mode)) goto out; + if (sbuf.st_mtime < mdbuf.st_mtime) + sbuf.st_mtime = mdbuf.st_mtime; + } + type = 0xDEADBEEF; + goto noprobe; + out: free(mdp); + } +#endif switch (mail_probe (*im, &type)) { /* can we read this? */ case PR_NAME: if (!quiet) @@ -166,6 +188,9 @@ continue; } +#ifdef MM_PANIX + noprobe: +#endif if (!getting_mail) { if (sbuf.st_mtime > oldbuf.st_mtime || !quiet) { printf("You have new mail in %s.\n", *im); --SUOF0GtieIMvvwua-- Return-Path: Received: from lmtpproxyd (tapioca-eth1.cc.columbia.edu [128.59.33.136]) by salmon.cc.columbia.edu (Cyrus v2.3.16) with LMTPA; Mon, 17 Feb 2014 18:05:53 -0500 X-Sieve: CMU Sieve 2.3 Received: from tapioca.cc.columbia.edu ([unix socket]) by mail.columbia.edu (Cyrus v2.3.16) with LMTPA; Mon, 17 Feb 2014 18:05:53 -0500 X-Sieve: CMU Sieve 2.3 Received: from sapodilla.cc.columbia.edu (sapodilla.cc.columbia.edu [128.59.28.172]) by tapioca.cc.columbia.edu (8.13.8/8.13.8) with ESMTP id s1HN5rBS001969 for ; Mon, 17 Feb 2014 18:05:53 -0500 Received: from mail1.panix.com (mail1.panix.com [166.84.1.72]) by sapodilla.cc.columbia.edu (8.14.4/8.14.3) with ESMTP id s1HN5ltg027605 for ; Mon, 17 Feb 2014 18:05:52 -0500 (EST) Received: from dw7.panix.com (dw7.panix.com [166.84.8.17]) by mail1.panix.com (Postfix) with ESMTP id A43E31F084 for ; Mon, 17 Feb 2014 18:05:47 -0500 (EST) Received: (from mailnbdy@localhost) by dw7.panix.com (8.11.6p2-a/8.8.8/PanixW1.0) id s1HN5lQ29704; Mon, 17 Feb 2014 18:05:47 -0500 (EST) X-Authentication-Warning: dw7.panix.com: mailnbdy set sender to rt-support@panix.com using -f Precedence: yes Subject: Re: [Panix #17036] MM From: "Brian Marcotte via RT" Reply-To: rt-support@panix.com In-Reply-To: <20140217230544.GA15731@panix.com> References: <20140217230544.GA15731@panix.com> Message-ID: X-RT-Loop-Prevention: Panix X-RT-Ticket: Panix #17036 X-Managed-BY: RT 4.2.2 (http://www.bestpractical.com/rt/) X-RT-Originator: marcotte@panix.com To: fdc@columbia.edu X-RT-Original-Encoding: utf-8 Content-Type: multipart/mixed; boundary="----------=_1392678347-20299-2" Date: Mon, 17 Feb 2014 18:05:47 -0500 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.1 () CU_RE X-Scanned-By: MIMEDefang 2.68 on 128.59.28.172 This is a multi-part message in MIME format... ------------=_1392678347-20299-2 Content-Type: text/plain; charset="utf-8" > I just discovered that I had exactly this same discussion with Ed Ravin > eight years ago and forgot all about it. There was a whole big discussion > between him, Ken Harrenstein, Jed Davis (Panix staff), and me, and some code > was floating around, but it was never resolved. So that clinches it: you > guys have working code, I don't. I'm including a diff between mm-ccmd-0.91 and the code that Panix is using. It was last built here in 2005, so somethings might need to change to be built today. -- - Brian ------------=_1392678347-20299-2 Content-Type: text/plain; charset="utf-8"; name="mm-ccmd-0.91.diff" Content-Disposition: attachment; filename="mm-ccmd-0.91.diff" Content-Transfer-Encoding: 7bit RT-Attachment: 17036/345073/225240 diff -ur mm-ccmd-0.91.virgin/work/ccmd/Makefile mm-ccmd-0.91/work/ccmd/Makefile --- mm-ccmd-0.91.virgin/work/ccmd/Makefile 2002-09-24 16:33:12.000000000 -0400 +++ mm-ccmd-0.91/work/ccmd/Makefile 2002-12-04 13:19:30.000000000 -0500 @@ -189,7 +189,7 @@ $(MAKE) OS=-DCCMD_OS_AIX OSLIBS= RANLIB=: all bsd44 freebsd: - $(MAKE) OS="-DCCMD_OS_BSD44" OSLIBS= all + $(MAKE) OS="-Dunix -DCCMD_OS_BSD44" OSLIBS= all netbsd openbsd: $(MAKE) OS="-DCCMD_OS_BSD44 -Dunix" OSLIBS= all diff -ur mm-ccmd-0.91.virgin/work/mm/Makefile mm-ccmd-0.91/work/mm/Makefile --- mm-ccmd-0.91.virgin/work/mm/Makefile 2002-09-24 16:32:01.000000000 -0400 +++ mm-ccmd-0.91/work/mm/Makefile 2005-09-22 20:39:06.000000000 -0400 @@ -34,8 +34,8 @@ # Installation locations - set defaults. # LOCLIB must match definition of LIBDIR in config.h # -BIN=/usr/local/bin -LOCLIB=/usr/local/lib/mm +BIN=/pkg/mm-0.91p1/bin +LOCLIB=/pkg/mm-0.91p1/libdata/mm-0.91 CCMD = ../ccmd CCMDLIB = $(CCMD)/ccmd.a @@ -124,14 +124,13 @@ bsd44 freebsd: @rm -f config.h @ln -s config.h-bsd44 config.h - $(MAKE) OS="-DMM_OS_BSD44" OSLIBS="-ltermcap" REGEXLIB=-lcompat all + $(MAKE) OS="-DMM_PANIX -Dunix -DMM_OS_BSD44" OSLIBS="-ltermcap" REGEXLIB=-lcompat all netbsd openbsd: @rm -f config.h @ln -s config.h-bsd44 config.h - $(MAKE) OS="-DMM_OS_BSD44 -Dunix" \ + $(MAKE) OS="-DMM_PANIX -Dunix -DMM_OS_BSD44" \ OSLIBS="-ltermcap" REGEXLIB=-lcompat all - bsd: @rm -f config.h @ln -s config.h-generic config.h @@ -206,9 +205,9 @@ # Panix uses NetBSD and added some mods # panix: - $(MAKE) OS="-DMM_OS_BSD44 -DMM_PANIX" OSLIBS="-ltermcap" \ + $(MAKE) OS="-DMM_OS_BSD44 -DMM_PANIX -Dunix -DMM_OS_BSD" OSLIBS="-ltermcap" REGEXLIB=-lcompat all\ BIN=$(BIN) \ - LOCLIB=/pkg/mm-0.90-20000926/lib \ + LOCLIB=/pkg/mm-0.91p1/libdata/mm-0.91p1/ \ all klhfb: diff -ur mm-ccmd-0.91.virgin/work/mm/config.h mm-ccmd-0.91/work/mm/config.h --- mm-ccmd-0.91.virgin/work/mm/config.h 2002-09-18 11:55:58.000000000 -0400 +++ mm-ccmd-0.91/work/mm/config.h 2005-09-22 21:57:51.000000000 -0400 @@ -17,7 +17,7 @@ /* First get general sys-dependent stuff for appropriate OS */ -#include "sysh/s-sun58.h" +#include "sysh/s-bsd44.h" /* Now apply any desired modifications to stuff from s-*.h */ @@ -37,8 +37,10 @@ */ /*#define HOSTNAME "myhost"*/ /* local hostname if cannot lookup */ /*#define LOCALDOMAIN ".mydomain.edu"*/ /* local domain if cannot lookup */ -/*#define HIDDENNET "mailhost.mydomain.edu"*/ /* fake outgoing host name */ +#define HIDDENNET "panix.com" /* fake outgoing host name */ +#ifndef MM_PANIX #define FORWARD_FILE ".forward" /* .forward file name if used */ +#endif #define GNUEMACS "emacs" /* name of GNU Emacs if present */ #undef HAVE_YP /* use yp? */ #define HAVE_NFS /* NFS used for some mail files? */ diff -ur mm-ccmd-0.91.virgin/work/mm/config.h-bsd44 mm-ccmd-0.91/work/mm/config.h-bsd44 --- mm-ccmd-0.91.virgin/work/mm/config.h-bsd44 2002-09-20 10:54:29.000000000 -0400 +++ mm-ccmd-0.91/work/mm/config.h-bsd44 2005-09-22 21:57:51.000000000 -0400 @@ -37,8 +37,10 @@ */ /*#define HOSTNAME "myhost"*/ /* local hostname if cannot lookup */ /*#define LOCALDOMAIN ".mydomain.edu"*/ /* local domain if cannot lookup */ -/*#define HIDDENNET "mailhost.mydomain.edu"*/ /* fake outgoing host name */ +#define HIDDENNET "panix.com" /* fake outgoing host name */ +#ifndef MM_PANIX #define FORWARD_FILE ".forward" /* .forward file name if used */ +#endif #define GNUEMACS "emacs" /* name of GNU Emacs if present */ #undef HAVE_YP /* use yp? */ #define HAVE_NFS /* NFS used for some mail files? */ diff -ur mm-ccmd-0.91.virgin/work/mm/dates.c mm-ccmd-0.91/work/mm/dates.c --- mm-ccmd-0.91.virgin/work/mm/dates.c 2002-02-22 20:12:08.000000000 -0500 +++ mm-ccmd-0.91/work/mm/dates.c 2003-04-17 15:07:22.000000000 -0400 @@ -204,18 +204,12 @@ t = localtime(&it); (void) gettimeofday(&tv, &tz); -#if MM_OS_SYSV asctime(t); -#endif sprintf(str,"%3.3s, %d %3.3s %d %d:%02d:%02d %s", day_names[t->tm_wday], t->tm_mday, month_names[t->tm_mon], t->tm_year + 1900, t->tm_hour, t->tm_min, t->tm_sec, -#if MM_OS_BSD && !defined(_POSIX_SOURCE) - timezone(tz.tz_minuteswest, t->tm_isdst) -#elif MM_OS_SYSV || defined(_POSIX_SOURCE) tzname[t->tm_isdst ? 1 : 0] -#endif ); return (char *) str; } diff -ur mm-ccmd-0.91.virgin/work/mm/newmail.c mm-ccmd-0.91/work/mm/newmail.c --- mm-ccmd-0.91.virgin/work/mm/newmail.c 2002-03-01 02:22:48.000000000 -0500 +++ mm-ccmd-0.91/work/mm/newmail.c 2005-09-22 21:39:50.000000000 -0400 @@ -147,6 +147,28 @@ for(im = incoming_mail; im && *im; im++) { /* loop over inboxes */ if (stat(*im,&sbuf) < 0) continue; +#ifdef MM_PANIX + /* Minimal support for the Maildir format. */ + if (S_ISDIR(sbuf.st_mode)) { + static const char* mdsubdirs[] = { "/cur", "/new", "/tmp" }; + size_t iml = strlen(*im); + char *mdp = malloc(iml + 4 /*subdir*/ + 1 /*null*/); + struct stat mdbuf; + int sdi; + + strcpy(mdp, *im); + for (sdi=0; sdi<(sizeof(mdsubdirs)/sizeof(mdsubdirs[0])); ++sdi) { + strcpy(mdp + iml, mdsubdirs[sdi]); + if (stat(mdp, &mdbuf) < 0) goto out; + if (!S_ISDIR(mdbuf.st_mode)) goto out; + if (sbuf.st_mtime < mdbuf.st_mtime) + sbuf.st_mtime = mdbuf.st_mtime; + } + type = 0xDEADBEEF; + goto noprobe; + out: free(mdp); + } +#endif switch (mail_probe (*im, &type)) { /* can we read this? */ case PR_NAME: if (!quiet) @@ -166,6 +188,9 @@ continue; } +#ifdef MM_PANIX + noprobe: +#endif if (!getting_mail) { if (sbuf.st_mtime > oldbuf.st_mtime || !quiet) { printf("You have new mail in %s.\n", *im); diff -ur mm-ccmd-0.91.virgin/work/mm/parse.c mm-ccmd-0.91/work/mm/parse.c --- mm-ccmd-0.91.virgin/work/mm/parse.c 2002-02-22 00:02:05.000000000 -0500 +++ mm-ccmd-0.91/work/mm/parse.c 2005-09-22 20:59:18.000000000 -0400 @@ -15,7 +15,7 @@ #include "mm.h" #include "parse.h" -#include +#include extern char *getwd(); @@ -63,23 +63,18 @@ * with malloc (the same is true of any call to a parsing routine). */ void -cmerr(va_alist) -va_dcl +cmerr(char* fmt, ...) { - char *fmt; va_list arg_ptr; + va_start(arg_ptr, fmt); if ((cmcsb._cmflg & CM_TTY) == 0) { - va_start(arg_ptr); - fmt = va_arg(arg_ptr, char *); fprintf(cmcsb._cmej, "%s: ", progname); vfprintf(cmcsb._cmej,fmt,arg_ptr); va_end(arg_ptr); cmerjnp(0); /* reprompt N.B. argument is ignored */ } else { - va_start(arg_ptr); - fmt = va_arg(arg_ptr, char *); cmflush(cmcsb._cmij); if (cmcpos() != 0) cmnl(cmcsb._cmoj); @@ -99,22 +94,16 @@ * sorry is identical to cmerr, except that it doesn't unwind. */ int -sorry (va_alist) -va_dcl +sorry (char* fmt, ...) { - char *fmt; va_list arg_ptr; + va_start(arg_ptr, fmt); if ((cmcsb._cmflg & CM_TTY) == 0) { - va_start(arg_ptr); - fmt = va_arg(arg_ptr, char *); fprintf(cmcsb._cmej, "%s: ", progname); vfprintf(cmcsb._cmej,fmt,arg_ptr); - va_end(arg_ptr); } else { - va_start(arg_ptr); - fmt = va_arg(arg_ptr, char *); cmflush(cmcsb._cmij); if (cmcpos() != 0) cmnl(cmcsb._cmoj); @@ -122,8 +111,8 @@ fputc('?', cmcsb._cmej); vfprintf(cmcsb._cmej,fmt,arg_ptr); fputc('\n', cmcsb._cmej); - va_end(arg_ptr); } + va_end(arg_ptr); return false; } diff -ur mm-ccmd-0.91.virgin/work/mm/parse.h mm-ccmd-0.91/work/mm/parse.h --- mm-ccmd-0.91.virgin/work/mm/parse.h 2000-01-02 16:25:52.000000000 -0500 +++ mm-ccmd-0.91/work/mm/parse.h 2005-09-22 20:58:21.000000000 -0400 @@ -77,7 +77,7 @@ time_t p_date(), key2time(); int try_parse (), cmargs (), yesno (), p_num (), pop_input (); -void noise (), confirm (), confirmit (), cmerr (), stack_input (); +void noise (), confirm (), confirmit (), cmerr (char *, ...), stack_input (); void brkch (), unbrk (); char *parse_text (), *parse_quoted (), *parse_directory (), *parse_input_file (), *parse_output_file (), *parse_username (), diff -ur mm-ccmd-0.91.virgin/work/mm/pathnames.h mm-ccmd-0.91/work/mm/pathnames.h --- mm-ccmd-0.91.virgin/work/mm/pathnames.h 2002-02-23 03:29:43.000000000 -0500 +++ mm-ccmd-0.91/work/mm/pathnames.h 2005-09-22 21:15:14.000000000 -0400 @@ -19,11 +19,15 @@ */ #ifndef TMPDIR -#define TMPDIR "/usr/tmp" +#define TMPDIR "/var/tmp" +#endif + +#ifndef SPOOL_DIRECTORY +#define SPOOL_DIRECTORY "/var/mail" #endif #ifndef EDITOR -#define EDITOR "emacs" +#define EDITOR "vi" #endif #ifndef PAGER #define PAGER "more" @@ -37,25 +41,26 @@ #endif #ifndef LIBDIR -#define LIBDIR "/usr/local/lib/mm" +#define LIBDIR "/pkg/mm-0.91p1/libdata/mm-0.91" #endif #ifndef SYSINIT -#define SYSINIT "/usr/local/lib/mm/mm.conf" +#define SYSINIT "/pkg/mm-0.91p1/libdata/mm-0.91/mm.conf" #endif #ifndef HELPFILE -#define HELPFILE "/usr/local/lib/mm/mm.help" +#define HELPFILE "/pkg/mm-0.91p1/libdata/mm-0.91/mm.help" #endif #ifndef HELPDIR -#define HELPDIR "/usr/local/lib/mm/help" +#define HELPDIR "/pkg/mm-0.91p1/libdata/mm-0.91/help" #endif #ifndef MMAIL_PATH -#define MMAIL_PATH "/usr/local/lib/mm/mmail.el" +#define MMAIL_PATH "/pkg/mm-0.91p1/libdata/mm-0.91/mmail.el" #endif #ifndef MOVEMAIL -#define MOVEMAIL "/usr/local/lib/mm/movemail" +/*#define MOVEMAIL "/pkg/mm-0.91p1/libdata/mm-0.91/movemail"*/ +#define MOVEMAIL "/usr/local/bin/mdmovemail" #endif #ifdef USAGE #ifndef USAGEFILE -#define USAGEFILE "/usr/local/lib/mm/usage.log" +#define USAGEFILE "/pkg/mm-0.91p1/libdata/mm-0.91/usage.log" #endif #endif diff -ur mm-ccmd-0.91.virgin/work/mm/token.c mm-ccmd-0.91/work/mm/token.c --- mm-ccmd-0.91.virgin/work/mm/token.c 1990-12-18 13:30:15.000000000 -0500 +++ mm-ccmd-0.91/work/mm/token.c 2005-09-22 20:59:39.000000000 -0400 @@ -865,4 +865,4 @@ } #endif /* TEST */ -#endif NOTMM +#endif /* NOTMM */ diff -ur mm-ccmd-0.91.virgin/work/mm/version.h mm-ccmd-0.91/work/mm/version.h --- mm-ccmd-0.91.virgin/work/mm/version.h 2002-10-05 13:39:15.000000000 -0400 +++ mm-ccmd-0.91/work/mm/version.h 2005-09-22 21:58:08.000000000 -0400 @@ -5,6 +5,6 @@ #include "mm-patchlevel.h" #define MM_MAJOR 0 #define MM_MINOR 91 -#define MM_EDIT 140 -#define MM_VERSION "Columbia MM, version 0.91.0(140)" -#define MM_COMPILED "by fdc@watsol on 5 Oct 2002 1:39pm" +#define MM_EDIT 152 +#define MM_VERSION "Columbia MM, version 0.91.0(152)" +#define MM_COMPILED "by root@juggler.panix.com on 22 Sep 2005 9:58pm" ------------=_1392678347-20299-2--