Mutt and Maildir oddness

William O'Higgins Witteman william.ohiggins-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Fri Aug 24 16:19:34 UTC 2007


On Thu, Aug 23, 2007 at 11:30:16AM -0400, William O'Higgins Witteman wrote:
>I am using mutt for mail reading, and I recently switched to using
>maildirs, rather than mbox files.  I have been happy with the switch,
>but I have found one thing that is odd.  When I get new mail, procmail
>puts it into folders based on several criteria.  That works just fine.
>
>The oddness comes when I look at the folder view in mutt.  For some
>folders, when new mail arrives it "touch"es the directory, and so those
>directories get bumped to the top of my list.  However, other
>directories don't get moved to the top of the list when mail is added.

In answer to my own question, I couldn't find a reason why this
behaviour was occurring, but I did find a work-around.  I am now using
an extra line in my .procmailrc to "touch" the directories as a side
effect of delivering mail to them.  It's working quite well, but it
wasn't easy to figure out, so I record it here for posterity.


:0:
* ^(From|To|Cc).*tlug
* ? /usr/bin/touch $MAILDIR/tlug || true
tlug/

First I look for my pattern match (in this case the string "tlug" in the
to, from or cc header).

Then, I pipe the message through a shell command (that's what the "?"
does), and if it returns true, you move to the next line, in this case
delivering the email to the appropriate folder.

The trick was that "touch"ing the directory doesn't use the email
message, and can't be counted on to return true, but the OR and calling
the "true" command does.  The behaviour is that the output of the last
command in the string is checked, so we get to run a command as a side
effect of the match line above.

It's quite handy, but it is a security risk - this report bears no
warranty express or implied.
-- 

yours,

William

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gtalug.org/pipermail/legacy/attachments/20070824/03924170/attachment.sig>


More information about the Legacy mailing list