6.0.0-git
2019-04-23

[#10113] Cannot create procmail rules with Maildir support
Summary Cannot create procmail rules with Maildir support
Queue Ingo
Queue Version 2.0.1
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester samuel.wolf (at) wolf-maschinenbau (dot) de
Created 2011-05-21 (2894 days ago)
Due
Updated 2012-08-29 (2428 days ago)
Assigned 2012-06-20 (2498 days ago)
Resolved 2012-06-21 (2497 days ago)
Milestone
Patch No

History
2012-08-29 12:39:13 Git Commit Comment #24 Reply to this comment
Changes have been made in Git (master):

commit 45a477ae970d3a52dbe2b16b760b4d8f50793060
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Jun 20 14:09:00 2012 -0600

     Revert "Revert "Fix folder names in Procmail rules if using 
Maildir (Bug 10113).""

     This reverts commit b3f34852cdce06001d6f3addb0551cd318a303d0.

     Returning to original broken commit.  Will fix by altering default
     configuration options instead.

  ingo/config/backends.php            |    2 ++
  ingo/docs/CHANGES                   |    1 +
  ingo/lib/Script/Procmail/Recipe.php |   15 +++++----------
  ingo/package.xml                    |    1 +
  4 files changed, 9 insertions(+), 10 deletions(-)

http://git.horde.org/horde-git/-/commit/45a477ae970d3a52dbe2b16b760b4d8f50793060
2012-08-29 12:39:10 Git Commit Comment #23 Reply to this comment
Changes have been made in Git (master):

commit b3f34852cdce06001d6f3addb0551cd318a303d0
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Jun 20 13:40:56 2012 -0600

     Revert "Fix folder names in Procmail rules if using Maildir (Bug 10113)."

     This reverts commit f42cae5d096f0307e27aaf3b9065dba176cd5694.

     Conflicts:
             ingo/docs/CHANGES
             ingo/package.xml

  ingo/config/backends.php            |    2 --
  ingo/docs/CHANGES                   |    1 -
  ingo/lib/Script/Procmail/Recipe.php |   15 ++++++++++-----
  ingo/package.xml                    |    1 -
  4 files changed, 10 insertions(+), 9 deletions(-)

http://git.horde.org/horde-git/-/commit/b3f34852cdce06001d6f3addb0551cd318a303d0
2012-06-25 21:26:59 Git Commit Comment #22 Reply to this comment
Changes have been made in Git (develop):

commit 5599f3052996002509b579f2608cab16bc8eec20
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Thu Jun 21 09:15:49 2012 -0600

     Only override procmail variables if using Maildir (Bug #10113)

  ingo/config/backends.php     |   12 ++++++------
  ingo/lib/Script/Procmail.php |   21 +++++++++++++++++++++
  2 files changed, 27 insertions(+), 6 deletions(-)

http://git.horde.org/horde-git/-/commit/5599f3052996002509b579f2608cab16bc8eec20
2012-06-21 15:27:20 Git Commit Comment #21 Reply to this comment
Changes have been made in Git (master):

commit 5599f3052996002509b579f2608cab16bc8eec20
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Thu Jun 21 09:15:49 2012 -0600

     Only override procmail variables if using Maildir (Bug #10113)

  ingo/config/backends.php     |   12 ++++++------
  ingo/lib/Script/Procmail.php |   21 +++++++++++++++++++++
  2 files changed, 27 insertions(+), 6 deletions(-)

http://git.horde.org/horde-git/-/commit/5599f3052996002509b579f2608cab16bc8eec20
2012-06-21 15:01:13 Michael Slusarz Comment #20
State ⇒ Resolved
Priority ⇒ 2. Medium
Reply to this comment
For testing I installed Ingo 2.0.4 (Filter (ingo) 2.0.4.)
Considering we are currently at Ingo 2.0.9, this is entirely irrelevant.

Marking as resolved again.
2012-06-21 07:13:42 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #19 Reply to this comment
That can not be work:
/home/user1/Maildir//.Testordner.sasa/
                                   ^^^
Sorry, should be pointed to the double slash after maildir.
2012-06-21 07:10:42 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #18 Reply to this comment
Your configuration must be totally hosed.  There is no way that ingo 
can generate this mailbox name.  From Ingo_Script_Procmail_Recipe:
For testing I installed Ingo 2.0.4 (Filter (ingo) 2.0.4.)

backends.local.php:
<?php
$backends['imap']['disabled'] = true;
$backends['procmail']['disabled'] = false;
$backends['procmail']['scriptparams']['path_style'] = 'maildir';
$backends['procmail']['scriptparams']['variables']['DEFAULT'] = 
'$HOME/Maildir/';
$backends['procmail']['scriptparams']['variables']['VACATION_DIR'] = '$HOME';

With this config Ingo generate the following script:

1: # Von Ingo erzeugtes procmail Script (June 21, 2012, 9:05 am)
   2: DEFAULT=$HOME/Maildir/
   3:
   4: VACATION_DIR=$HOME
   5:
   6: #### Neue Regel #####
   7:  :0
   8:  * ^From:.*root
   9:  "$DEFAULT/.Testordner.sasa/"
  10:

That can not be work:
/home/user1/Maildir//.Testordner.sasa/
                                   ^^^

Where is my configuration error?
2012-06-21 05:42:36 Michael Slusarz Comment #17 Reply to this comment
Ingo generate now wrong rules:
/home/user/Maildir//.Folder1.Subfolder/
Your configuration must be totally hosed.  There is no way that ingo 
can generate this mailbox name.  From Ingo_Script_Procmail_Recipe:

         if (isset($this->_params) &&
             ($this->_params['path_style'] == 'maildir')) {
             if (substr($folder, 0, 6) == 'INBOX.') {
                 $folder = substr($folder, 6);
             }
             return '".' . escapeshellcmd($folder) . '/"';
         }

There is no possible way in the code that  anything can be prepended 
before the '.'.
2012-06-21 01:51:32 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #16 Reply to this comment
@ Michael,

did you set DEFAULT=$HOME/Maildir/ in your backends.php?

Ingo generate now wrong rules:
/home/user/Maildir//.Folder1.Subfolder/

How did you solve that problem with procmail in your setup?
2012-06-20 20:14:02 Michael Slusarz Comment #15
State ⇒ Feedback
Priority ⇒ 3. High
Reply to this comment
Revert "Fix folder names in Procmail rules if using Maildir (Bug 10113)."
Yikes.  Not sure how I missed this commit originally, but this 
completely broke mail delivery for me, and I've lost a ton of messages 
since activating my new script yesterday.

Now mailboxes look are generated like:

[RULE DEFINITION]
".foo.bar/"

Which tells procmail to deliver to the foo.bar directory in the *base* 
home directory.  Which by default is the home directory (see $MAILDIR 
variable).

$MAILDIR can be used to change the base directory, but this is not 
documented in ingo and, worst of all, is a BC breaking change for 
existing scripts.

Not sure why we aren't delivering directly to the mailbox name itself anymore:

[RULE DEFINITION]
foo.bar

IIRC, this is the way we did it for years and it worked fine.

I've reverted the original change.  However, I am going to re-commit 
the original along with adding an explicit MAILDIR variable in 
backends.php and making both DEFAULT and MAILDIR active in the default 
backends configuration.
2012-06-20 20:13:54 Git Commit Comment #14 Reply to this comment
Changes have been made in Git (develop):

commit 93efe59890c2fe6c6f89b20173da639c0ed8d1e8
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Jun 20 14:12:31 2012 -0600

     [mms] Procmail driver now explicitly sets the base Maildir 
directory by default (Bug #10113).

  ingo/config/backends.php |   10 ++++++----
  ingo/docs/CHANGES        |    2 ++
  ingo/package.xml         |    2 ++
  3 files changed, 10 insertions(+), 4 deletions(-)

http://git.horde.org/horde-git/-/commit/93efe59890c2fe6c6f89b20173da639c0ed8d1e8
2012-06-20 20:12:46 Git Commit Comment #13 Reply to this comment
Changes have been made in Git (master):

commit 93efe59890c2fe6c6f89b20173da639c0ed8d1e8
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Jun 20 14:12:31 2012 -0600

     [mms] Procmail driver now explicitly sets the base Maildir 
directory by default (Bug #10113).

  ingo/config/backends.php |   10 ++++++----
  ingo/docs/CHANGES        |    2 ++
  ingo/package.xml         |    2 ++
  3 files changed, 10 insertions(+), 4 deletions(-)

http://git.horde.org/horde-git/-/commit/93efe59890c2fe6c6f89b20173da639c0ed8d1e8
2012-06-20 20:09:34 Git Commit Comment #12 Reply to this comment
Changes have been made in Git (develop):

commit 45a477ae970d3a52dbe2b16b760b4d8f50793060
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Jun 20 14:09:00 2012 -0600

     Revert "Revert "Fix folder names in Procmail rules if using 
Maildir (Bug 10113).""

     This reverts commit b3f34852cdce06001d6f3addb0551cd318a303d0.

     Returning to original broken commit.  Will fix by altering default
     configuration options instead.

  ingo/config/backends.php            |    2 ++
  ingo/docs/CHANGES                   |    1 +
  ingo/lib/Script/Procmail/Recipe.php |   15 +++++----------
  ingo/package.xml                    |    1 +
  4 files changed, 9 insertions(+), 10 deletions(-)

http://git.horde.org/horde-git/-/commit/45a477ae970d3a52dbe2b16b760b4d8f50793060
2012-06-20 19:47:13 Git Commit Comment #11 Reply to this comment
Changes have been made in Git (develop):

commit b3f34852cdce06001d6f3addb0551cd318a303d0
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Wed Jun 20 13:40:56 2012 -0600

     Revert "Fix folder names in Procmail rules if using Maildir (Bug 10113)."

     This reverts commit f42cae5d096f0307e27aaf3b9065dba176cd5694.

     Conflicts:
             ingo/docs/CHANGES
             ingo/package.xml

  ingo/config/backends.php            |    2 --
  ingo/docs/CHANGES                   |    1 -
  ingo/lib/Script/Procmail/Recipe.php |   15 ++++++++++-----
  ingo/package.xml                    |    1 -
  4 files changed, 10 insertions(+), 9 deletions(-)

http://git.horde.org/horde-git/-/commit/b3f34852cdce06001d6f3addb0551cd318a303d0
2012-04-19 06:10:01 Git Commit Comment #10 Reply to this comment
Changes have been made in Git (develop):

commit f42cae5d096f0307e27aaf3b9065dba176cd5694
Author: Jan Schneider <jan@horde.org>
Date:   Wed Apr 18 16:28:03 2012 +0200

     Fix folder names in Procmail rules if using Maildir (Bug 10113).

     In procmail rules, $DEFAULT should only be used for INBOX 
delivering. It's not
     necessary (and actually seems to cause problems) to use it to 
build folder path
     names.

  ingo/config/backends.php            |    2 ++
  ingo/docs/CHANGES                   |    1 +
  ingo/lib/Script/Procmail/Recipe.php |   15 +++++----------
  ingo/package.xml                    |    2 ++
  4 files changed, 10 insertions(+), 10 deletions(-)

http://git.horde.org/horde-git/-/commit/f42cae5d096f0307e27aaf3b9065dba176cd5694
2012-04-18 14:29:38 Git Commit Comment #9 Reply to this comment
Changes have been made in Git (master):

commit f42cae5d096f0307e27aaf3b9065dba176cd5694
Author: Jan Schneider <jan@horde.org>
Date:   Wed Apr 18 16:28:03 2012 +0200

     Fix folder names in Procmail rules if using Maildir (Bug 10113).

     In procmail rules, $DEFAULT should only be used for INBOX 
delivering. It's not
     necessary (and actually seems to cause problems) to use it to 
build folder path
     names.

  ingo/config/backends.php            |    2 ++
  ingo/docs/CHANGES                   |    1 +
  ingo/lib/Script/Procmail/Recipe.php |   15 +++++----------
  ingo/package.xml                    |    2 ++
  4 files changed, 10 insertions(+), 10 deletions(-)

http://git.horde.org/horde-git/-/commit/f42cae5d096f0307e27aaf3b9065dba176cd5694
2011-07-30 12:05:41 Jan Schneider Assigned to Jan Schneider
State ⇒ Resolved
 
2011-07-07 08:18:03 Jan Schneider Comment #8 Reply to this comment

[Show Quoted Text - 10 lines]
But if it's wrong for you, why don't you set it correctly? I.e. to: 
"DEFAULT=$HOME/Maildir/"
But what should be change/different with the comment #3?
The generated paths inside the script are set correctly when setting 
path_style to maildir.
2011-07-06 20:46:53 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #7 Reply to this comment
How about this, is this sufficient? You need to leave out the
trailing slash in backends.local.php and set path_style to maildir.
It's wrong, set "DEFAULT=$HOME/Maildir" again.
Not from Ingo. If you still have this in the generated Script, then 
you have set this in the 'variables' setting.
Yes that's true, its in variables because I need in my procmail script 
the home directory.
But what should be change/different with the comment #3?
2011-07-01 08:30:52 Jan Schneider Comment #6 Reply to this comment
How about this, is this sufficient? You need to leave out the
trailing slash in backends.local.php and set path_style to maildir.
It's wrong, set "DEFAULT=$HOME/Maildir" again.
Not from Ingo. If you still have this in the generated Script, then 
you have set this in the 'variables' setting.
2011-06-30 23:35:32 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #5 Reply to this comment
How about this, is this sufficient? You need to leave out the 
trailing slash in backends.local.php and set path_style to maildir.
It's wrong, set "DEFAULT=$HOME/Maildir" again.
2011-06-30 09:37:31 Jan Schneider Comment #4
State ⇒ Feedback
Reply to this comment
How about this, is this sufficient? You need to leave out the trailing 
slash in backends.local.php and set path_style to maildir.
2011-06-30 09:36:23 Git Commit Comment #3 Reply to this comment
Changes have been made in Git for this ticket:

Add trailing slash to $DEFAULT if using maildir format. Might fix bug #10113.

  1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/ffd0144566bdc86aadec97b36f55c61d561d5b39
2011-05-25 07:01:21 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #2 Reply to this comment
Found a solution for the problem, modify following in 
../ingo/lib/Script/Procmail/Recipe.php

#################################################################
return '"$DEFAULT/.' . escapeshellcmd($folder) . '/"';
#################################################################

to

#################################################################
return '"$DEFAULT.' . escapeshellcmd($folder) . '/"';
#################################################################

But I found another problem, my Maildir don't use / for subfolders it 
separate the folder with points.
"Folder1.Subfolder1.Subfolder2"

I can solve the problem by add following in 
../ingo/lib/Script/Procmail/Recipe.php
#################################################################
}
             return '"$DEFAULT.' . escapeshellcmd($folder) . '/"';
         } else {
#################################################################

to

#################################################################
}
             $folder = str_replace("/", ".", $folder);
             return '"$DEFAULT.' . escapeshellcmd($folder) . '/"';
         } else {
#################################################################

Don't know it's a good way, but still work.
2011-05-21 19:42:12 samuel (dot) wolf (at) wolf-maschinenbau (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ Cannot create procmail rules with Maildir support
Queue ⇒ Ingo
Milestone ⇒
Patch ⇒ No
Reply to this comment
Following DEFAULT variabels must be set to use procmail with Maildir:
"DEFAULT=$HOME/Maildir/"

("DEFAULT=$HOME/Maildir" this would equal mbox format!).

Ingo applies following filter rule:
# Von Ingo erzeugtes procmail Script (May 21, 2011, 9:33 pm)
DEFAULT=$HOME/Maildir/

##### test #####
:0
* ^From:.*root@server\.test\.intern
"$DEFAULT/.INBOX/Admin/"


Which leads to that Procmail cannot process the filter rules:
procmail: Unable to treat as directory "/home/user1/Maildir//.INBOX/Admin"
procmail: Error while writing to "/home/user1/Maildir//.INBOX/Admin"
From root@server.test.intern Sat May 21 20:46:17 2011
Subject: procmailtest
Folder: /home/user1/Maildir/new/1306003577.10892_0.mailserver 923


Correct would be the following filter rule:
# Procmail Script generated by Ingo (May 21, 2011, 8:46 pm)
...
"$DEFAULT.INBOX/Admin/"
--> without slash

backends.php:
'scriptparams' => array(
         // What path style does the IMAP server use ['mbox'|'maildir']?
         'path_style' => 'maildir',

Saved Queries