Bug 160177 - Procmail H flag can't be unset once set
Summary: Procmail H flag can't be unset once set
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: procmail
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: Brock Organ
URL: http://www.xray.mpe.mpg.de/mailing-li...
Whiteboard: RHEL3U7NAK
Keywords:
Depends On:
Blocks: 170445
TreeView+ depends on / blocked
 
Reported: 2005-06-12 21:21 UTC by Damian Menscher
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2006-03-24 12:17:35 UTC


Attachments (Terms of Use)
patch that clears flags properly (491 bytes, patch)
2005-06-12 21:21 UTC, Damian Menscher
no flags Details | Diff

Description Damian Menscher 2005-06-12 21:21:31 UTC
Description of problem:
Once the H flag has been enabled for a procmail rule, it can't be disabled in
subsequent rules.

Version-Release number of selected component (if applicable):
procmail-3.22-9

How reproducible:
Every time

Steps to Reproduce:
Create the procmailrc:

:0HB:
* Subject: header_test
* message_body
rule1

:0B:
* Subject: header_test
rule2

Send yourself a message with subject header_test, and a random body.

Actual results:
Message gets delivered to rule2.

Expected results:
Message should not have matched rule2, since that should *only* egrep the body,
and not the header.

Additional info:
This is a known bug, and was fixed upstream in procmail-beta in September 2001(!)

I'll attach a patch taken from procmail-beta that fixes the problem. 
(Basically, that when clearing the flags, the for() loop counts backwards down
to 1, rather than down to 0.)  [Note: I haven't tested that this patch doesn't
break the header-checking by default, though I expect it will work properly.]

For others encountering this problem, the workaround is to NEVER use the H flag.
 Just get really creative and figure out ways around it (it's the default, so
workarounds aren't impossible, just annoying).

Comment 1 Damian Menscher 2005-06-12 21:21:31 UTC
Created attachment 115343 [details]
patch that clears flags properly

Comment 2 Philip Guenther 2005-09-20 06:40:34 UTC
The supplied patch works, but only because the flags array is of char.  The fix
in the (not yet released <sigh>) master source tree uses sizeof(flags) instead
of maxindex(flags) in the bbzero() call.


Comment 3 Peter Vrabec 2005-09-20 08:38:23 UTC
(In reply to comment #2)
> The supplied patch works, but only because the flags array is of char.  The fix
> in the (not yet released <sigh>) master source tree uses sizeof(flags) instead
> of maxindex(flags) in the bbzero() call.
> 
Yes, and that's how we fix it in FC and RHEL-4.



Note You need to log in before you can comment on or make changes to this bug.