Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.linux.slackware > #35614

Re: countmail.py

From Eli the Bearded <*@eli.users.panix.com>
Newsgroups alt.os.linux.slackware
Subject Re: countmail.py
Date 2026-06-02 03:17 +0000
Organization Some absurd concept
Message-ID <eli$2606012308@qaz.wtf> (permalink)
References <87mrxdzm6p.fsf@atr2.ath.cx>

Show all headers | View raw


In alt.os.linux.slackware, jayjwa  <jayjwa@atr2.ath.cx.invalid> wrote:
> Following the discussion of it on LQ, I re-wrote BSD countmail because
> that script is a bit bristly, requires eternal tools like "frm", and
> doesn't handle Alpine/Pine's placeholder messages properly. This
> version uses ANSI colors and works on SunOS too.

This doesn't work with maildirs. (NB: I am unfamiliar with "BSD
countmail". I use my own implementation of "frm", but not often,
preferring a "checkmail" script that tells me the latest message in
a group of mail boxes and works by parsing the procmail log for
delivery details instead of looking at the actual mail boxes. This
prevents reading the message from resetting the mail file atime.

> #!/usr/bin/python3
> ## countmail.py
> ## Rewrite of BSD countmail in basic Python to not use external tools
> ## and correctly handle Al/pine placeholder mails. Cross-platform for
> ## Linux, SunOS, probably others with Python3.
> ## $Id: countmail.py,v 1.1 2026/06/02 02:28:57 jayjwa Exp $
> import os, sys, re
[snip]
> # Regex to indicate that there is a mail message in the mail file. MUAs
> # like Alpine and Pine have a placeholder message that must be excluded
> # from the total count because it is not a real mail message.
> mailPattern = re.compile( r'^From: *[^Mail System Internal Data]' )

I have _immediate_ red flags going up. I don't know specifics of how
Python's "re.compile" works, but in normal Unix regex language the
"[^Mail System Internal Data]" bit is a character class that contains
the invert of the characters within. I am dubious that Python has
redefined what "[^...]" means.

Elijah
------
doesn't care much how _many_ messages there are

Back to alt.os.linux.slackware | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

countmail.py jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-06-01 22:54 -0400
  Re: countmail.py Eli the Bearded <*@eli.users.panix.com> - 2026-06-02 03:17 +0000
    Re: countmail.py jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-06-02 11:28 -0400
    Re: countmail.py (v2.1) jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-06-02 17:05 -0400

csiph-web