From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21670 invoked from network); 7 Sep 2001 17:12:51 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Sep 2001 17:12:51 -0000 Received: (qmail 1558 invoked by alias); 7 Sep 2001 17:12:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15746 Received: (qmail 1545 invoked from network); 7 Sep 2001 17:12:42 -0000 From: Bart Schaefer Message-Id: <1010907171112.ZM17629@candle.brasslantern.com> Date: Fri, 7 Sep 2001 17:11:12 +0000 In-Reply-To: <20010907115250.A26653@panix.com> Comments: In reply to Russell Hoover "Re: New mail notification not working" (Sep 7, 11:52am) References: <20010819143917.A28481@panix.com> <1010819185600.ZM18507@candle.brasslantern.com> <20010907115250.A26653@panix.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Russell Hoover Subject: Re: New mail notification not working Cc: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 7, 11:52am, Russell Hoover wrote: } } > try recompiling it with --enable-maildir-support. } } My sysadmin has done this, still not getting notification at the shell. } } do I need, e.g., "new" after ".mailspool/rj/" ? No, you don't need anything after the name of the directory; you don't even need the trailing slash, though it should be harmless. I just had a look at the mailstat() function [it get's #defined to be stat() when maildir support is not enabled]. Let me preface this by saying that this function was contributed back in 1999 by Miquel van Smoorenburg who sent it (as a Debian patch?) to Clint Adams . It was not thoroughly debugged by any of the regular zsh developers, none of whom (as far as I know) uses maildir. Anyway, mailstat() is using a single static structure to keep track of the last-modified time of the maildir "new" subdir. This means that it only works correctly if you have exactly one maildir directory in your mailpath -- if you have multiple maildirs, it gets confused about which modified-time to compare; it checks each maildir for new-ness against the modified time of the one preceding it in the mailpath, cycling to check the first maildir against the last on subsequent calls. So you ought to be getting notified some of the time, but it would seem random when you don't know what's going on. Unfortunately, I don't have time to work on a good patch for this. It'd have to e.g. keep a lookup table of stat structures keyed on path name. The quick fix is simply to delete the "optimization" that makes use of this static structure, but that makes the function hideously expensive; it may turn out to be too slow for you to use. Index: Src/utils.c =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/utils.c,v retrieving revision 1.6 diff -c -r1.6 utils.c --- Src/utils.c 2001/06/13 05:19:13 1.6 +++ Src/utils.c 2001/09/07 17:08:42 @@ -3745,7 +3745,7 @@ DIR *dd; struct dirent *fn; struct stat st_ret, st_tmp; - static struct stat st_new_last, st_ret_last; + static struct stat st_ret_last; char *dir, *file = 0; int i; time_t atime = 0, mtime = 0; @@ -3779,6 +3779,9 @@ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0; st_ret.st_mtime = st_tmp.st_mtime; +#if THERE_IS_EXACTLY_ONE_MAILDIR_IN_MAILPATH + { + static struct stat st_new_last; /* Optimization - if new/ didn't change, nothing else did. */ if (st_tmp.st_dev == st_new_last.st_dev && st_tmp.st_ino == st_new_last.st_ino && @@ -3788,6 +3791,8 @@ return 0; } st_new_last = st_tmp; + } +#endif /* Loop over new/ and cur/ */ for (i = 0; i < 2; i++) { -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net