LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   procmail: not sorting properly and cannot write to file (https://www.linuxquestions.org/questions/slackware-14/procmail-not-sorting-properly-and-cannot-write-to-file-4175663739/)

rshepard 11-05-2019 04:13 PM

procmail: not sorting properly and cannot write to file
 
Running 14.2/x86_64 and using mbox mail storage format. On this new desktop procmail is no longer sorting some incoming messages to the proper folder despite having multiple recipes in ~/.procmailrc. And for some folders the log shows an error writing to it despite all files in ~/mail/ having 666 permissions.

Here's an example for one mail list and what the log shows:
~/.procmailrc
[code]
:0:
* \[GRASS-user\]
spatial-analyses

:0:
* ^List-Id:.*<grass-user\.lists\.osgeo\.org>
spatial-analyses

:0:
* ^(From|Cc|To).*osgeo\.org
spatial-analyses
[\code]

~/procmail/log:
[code]
procmail: Match on "\[GRASS-user\]"
procmail: Locking "spatial-analyses.lock"
procmail: Assigning "LASTFOLDER=spatial-analyses"
procmail: Opening "spatial-analyses"
procmail: Acquiring kernel-lock
procmail: Error while writing to "spatial-analyses"
procmail: Truncated file to former size
[\code]

The file's permissions:
-rw-rw-rw- 1 rshepard users 54142630 Nov 5 14:03 spatial-analyses

As I don't know what other information to provide I'll wait for someone to ask for more.

I want to resolve these issues as soon as possible

Regards,

Rich

bathory 11-06-2019 06:22 AM

Quote:

Originally Posted by rshepard (Post 6054493)
Running 14.2/x86_64 and using mbox mail storage format. On this new desktop procmail is no longer sorting some incoming messages to the proper folder despite having multiple recipes in ~/.procmailrc. And for some folders the log shows an error writing to it despite all files in ~/mail/ having 666 permissions.

Here's an example for one mail list and what the log shows:
~/.procmailrc
[code]
:0:
* \[GRASS-user\]
spatial-analyses

:0:
* ^List-Id:.*<grass-user\.lists\.osgeo\.org>
spatial-analyses

:0:
* ^(From|Cc|To).*osgeo\.org
spatial-analyses
[\code]

~/procmail/log:
[code]
procmail: Match on "\[GRASS-user\]"
procmail: Locking "spatial-analyses.lock"
procmail: Assigning "LASTFOLDER=spatial-analyses"
procmail: Opening "spatial-analyses"
procmail: Acquiring kernel-lock
procmail: Error while writing to "spatial-analyses"
procmail: Truncated file to former size
[\code]

The file's permissions:
-rw-rw-rw- 1 rshepard users 54142630 Nov 5 14:03 spatial-analyses

As I don't know what other information to provide I'll wait for someone to ask for more.

I want to resolve these issues as soon as possible

Regards,

Rich

Without other info, I guess you're running postfix as MTA.
If that's the case, take a look here to see what the problem is and what you can do

BTW, change the spatial-analyses file attributes to just 600 (rw-------) for security reasons.


Regards

rshepard 11-06-2019 01:18 PM

Quote:

Originally Posted by bathory (Post 6054713)
Without other info, I guess you're running postfix as MTA.
If that's the case, take a look here to see what the problem is and what you can do

Well! Yes, I've been using postfix for a couple of decades and never paid attention to the mailbox_size_limit. Sure enough, the messages that won't file properly were to mbox files > 49M.

Thank you very much.

Best regards,

Rich

rshepard 11-06-2019 04:29 PM

I changed mailbox_size_limit to about 9G and the permissions in ~/mail/ to 600. Then I stopped and restarted postfix-3.4.7-x86_64-1. But, all mail list messages are now being placed in spatial-analyses. Here are the recipes in ~/.procmailrc:

# Catch SPAM
:0
* ^X-Spam-Flag: YES
* ^X-Spam-Level: \*\*\*\*\*\*
/dev/null

## Call SpamAssassin
:0fw: spamassassin.lock
* < 256000
| spamassassin

## Flagged as SPAM by spamassassin?
:0
* ^X-Spam-Status: Yes
/dev/null

:0:
* ^Subject: *****SPAM*****
/dev/null

:0:
* ^(To|Cc).*twodogs.us
personal

:0:
* ^TO_.*appl-ecosys.com
$DEFAULT

:0:
* \[GRASS-user\]
spatial-analyses

:0:
* ^List-Id:.*<grass-user\.lists\.osgeo\.org>
spatial-analyses

:0:
* ^(From|Cc|To).*osgeo\.org
spatial-analyses

:0:
* ^(From|Cc|To).*postgresql\.org
database

:0:
* ^(From|Cc|To).*gnucash\.org
accounting

:0:
* ^(From|Cc|To).*jpilot\.org
pda-jpilot

:0:
* ^(From|Cc|To).*lists\.lyx\.org
typesetting

:0:
* ^List-ID:.*<plug.*\.pdxlinux\.org>
* ^(From|Cc|To).*pdxlinux\.org
PLUG

:0:
* ^(From|Cc|To).*tug\.org
typesetting

:0:
* ^List-Id:.*<python-list\.python\.org>
programming

:0:
* \[sqlalchemy\]
programming

:0:
* ^(From|Cc|To).*sqlite\.org
database

:0:
* \[R\]
stats

:0:
* ^(From|Cc|To).*r-project\.org
stats

:0:
* \[R-sig-Geo\]
stats

:0:
* \[Slackbuilds-users\]
slackware

:0:
* ^(From|Cc|To).*slackbuilds\.org
slackware

:0:
* \[slackware\]
slackware

:0:
* ^(From|Cc|To).*mailman\.lug\.org\.uk
slackware

:0:
* ^(From|Cc|To).*@slackware\.com
slackware

:0:
* ^(From|Cc|To).*cups\.org
office

:0:
* \[taskjuggler-users\]
office

:0:
* postfix-users
mailhelp

:0:
* ^(From|Cc|To).*postfix\.org
mailhelp

:0:
* ^(From|Cc|To).*cloud9\.net
mailhelp

Despite my reading the man page and procmail configuration web pages I must still not have the recipes correctly written. I want to learn how to do them correctly.

bathory 11-07-2019 03:51 AM

Quote:

But, all mail list messages are now being placed in spatial-analyses. Here are the recipes in ~/.procmailrc:
Enable logging and see what happens with your recipes.
To do so, add in top of .procmailrc the following:
Code:

SHELL=/bin/sh
VERBOSE=on
LOGFILE=/tmp/procmail.log


rshepard 11-08-2019 10:59 AM

Quote:

Originally Posted by bathory (Post 6055127)
Enable logging and see what happens with your recipes.

I've been following the log and do not see where the errors occur. Here's one example from today:
[CODE]
From r-help-bounces@r-project.org Fri Nov 8 08:38:42 2019
Subject: Re: [R]
Folder: programming 13895
procmail: [5911] Fri Nov 8 08:48:20 2019
procmail: Assigning "LOGABSTRACT=all"
procmail: Assigning "MAILDIR=/home/rshepard/mail"
procmail: Assigning "DEFAULT=/var/spool/mail/rshepard"
procmail: Assigning "ORGMAIL=/var/spool/mail/rshepard"
procmail: Assigning "LOGFILE=/home/rshepard/procmail/log"
procmail: Opening "/home/rshepard/procmail/log"
procmail: Assigning "COMSAT=no"
procmail: Assigning "COMSAT=no"
procmail: No match on "^X-Spam-Flag: YES"
procmail: Match on "< 256000"
procmail: Locking "spamassassin.lock"
procmail: Executing "spamassassin"
procmail: [5911] Fri Nov 8 08:48:21 2019
procmail: Unlocking "spamassassin.lock"
procmail: No match on "^X-Spam-Status: Yes"
procmail: No match on "^Subject: *****SPAM*****"
procmail: No match on "^(To|Cc).*twodogs.us"
procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?).*appl-ecosys.com"
procmail: No match on "^(From|Cc|To).*postgresql\.org"
procmail: No match on "^(From|Cc|To).*gnucash\.org"
procmail: No match on "^(From|Cc|To).*jpilot\.org"
procmail: No match on "^(From|Cc|To).*lists\.lyx\.org"
procmail: No match on "^List-ID:.*<plug.*\.pdxlinux\.org>"
procmail: No match on "^(From|Cc|To).*tug\.org"
procmail: No match on "^List-Id:.*<python-list\.python\.org>"
procmail: Match on "\[sqlalchemy\]"
procmail: Locking "programming.lock"
procmail: Assigning "LASTFOLDER=programming"
procmail: Opening "programming"
procmail: Acquiring kernel-lock
procmail: Unlocking "programming.lock"
[\CODE]

The maibox_size_limit is huge so that's no longer the reason messages were mis-sorted.

How procmailrc finds a match on sqlalchemy from r-help-bounces escapes me.

Thanks,

Rich

Richard Cranium 11-08-2019 02:38 PM

Are you certain that's properly escaped? Otherwise, it'll match on finding any of s, q, l, a, c, h, e, m, or y.

bathory 11-09-2019 01:59 AM

Quote:

The maibox_size_limit is huge so that's no longer the reason messages were mis-sorted.

How procmailrc finds a match on sqlalchemy from r-help-bounces escapes me.
The maibox_size_limit has nothing to do with messages being mis-sorted

I don't know either why procmail finds a match with "[sqlalchemy]". Perhaps that string exists in the mail headers.
You may put that recipe last in procmailrc and see what you get.

rshepard 11-09-2019 08:27 AM

Bathory/Richard:

I have it fixed now. First, mailbox_size_limit was an issue. The default is 45M and the three folders that were originally not correctly sorted were larger. That was fixed but multiple mis-filings still existed.

Second, I replaced the multiple regex match strings for mail lists by a single recipe and tweaked that until I found one that consistently worked correctly. For some it was ^(From|Cc|To). and for others it was ^List-ID:.*.

mbox-by-mbox they began sorting properly. This morning none were in the wrong folder.

My thanks to both of you.

Regards,

Rich


All times are GMT -5. The time now is 03:37 PM.