Bug 165460 - Issues when auto-create maildir folders in /var/mail
Issues when auto-create maildir folders in /var/mail
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: procmail (Show other bugs)
26
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jaroslav Škarvada
Brock Organ
bzcl34nup
: EasyFix, Patch, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-09 12:10 EDT by Dmitry Butskoy
Modified: 2017-02-28 04:27 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-07-14 13:12:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch for maildir auto-creation under /var/spool/mail (/var/mail) (917 bytes, patch)
2005-08-09 12:10 EDT, Dmitry Butskoy
no flags Details | Diff
second variant of the patch (1.12 KB, patch)
2005-09-21 08:53 EDT, Dmitry Butskoy
no flags Details | Diff

  None (edit)
Description Dmitry Butskoy 2005-08-09 12:10:19 EDT
Description of problem:

  We use procmail as local delivery agent. For more easy administration, we
always used procmail possibility to auto-create user mailboxes. (To do this with
current FC procmail, either /var/spool/mail should be set to -rwxrwxrwt, or
procmail binary should be -rwxr-sr-x ...)
  As now Fedora has changed mail storage format from mailbox to maildir/, we
have started to adapt out mail system to maildir/ format. Certainly, we would
like to continue to use auto-creation possibility.
  Procmail can create all that is necessary for maildir/ format, however there
is one very unpleasant problem. Procmail cannot create maildirs under "DEFAULT"
directory -- /var/spool/mail (or /var/mail). Old mailboxes are created instead!
In other places all is created correctly.

  Our admins are conservative enough, therefore we would like to continue to
store e-mail in the old place (under /var/spool/mail), just storage format
should be changed (i.e. instead of files just subdirectories will be used).

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

How reproducible:
Always

Steps to Reproduce:
 1. make sure that procmail is "-rwxr-sr-x  root mail", and /var/spool/mail is
"drwxrwxr-x  root mail" .
 2. Define a last recipe in /etc/procmail as:

:0
$DEFAULT/

(i.e., with "/" at the end. Last "/" means that maildir format must be used).
 3. Make sure that a user (choosed for this test) yet has no mailbox/maildir in
/var/spool/mail
 4. Send an e-mail to this user
  
Actual results:
  There is a mailbox for the user, with the sent e-mail in it.

Expected results:
  Maildir (a subdirectory with the "user" name) must be created, and the sent
e-mail should be somewhere under it.

More evident test:
  Change "$DEFAULT/" to "$DEFAULT.foo/" in the /etc/procmailrc, and repeat all
the "steps to reproduce".  A maildir named "user.foo/" appears in
/var/spool/mail (as it should be). Also, an empty file named "user" appears too.
  You may specify any other destination (but not $DEFAULT/), in any other
directory (with appropriate rights for "mail" group), the result will be the
same -- the specified maildir is auto-created, and an empty file appears in
/var/spool/mail .

  Note: if "$DEFAILT/" (/var/spool/mail/user/) maildir already exist, all
working OK. The issue appears only when we try to auto-create maildir in default
system mail spool directory with the default name (user logname).

  I have made a patch to resolve this issue.
  The problem is that procmail want to do some permission checks at early
invoking. When a destination (either mailbox or maildir) is yet not exist,
procmail always creates a file in the default directory /var/spool/mail (compile
time hardcoded), and checks this operation for success. After this test the file
remains in /var/spool/mail . When procmail delivers a mail, it sees this file,
interprets it as an pre-existing mailbox and works with it in mailbox format,
ignoring /etc/procmailrc specifications to use maildir/ format.
  Unfortunately, it is not obviously possible to change this algorithm somehow.
All is too hard coded. And we cannot just remove the empty file after the test,
because it leads to impossibility of auto-creation in old mailbox format! (which
must be supported too).
  The idea of patch is to delete the empty file at directory creation time, if
such "the same name" file prevents of directory creation. IMHO, it is safely
enough and will not lead to any losses.
Comment 1 Dmitry Butskoy 2005-08-09 12:10:19 EDT
Created attachment 117578 [details]
patch for maildir auto-creation under /var/spool/mail (/var/mail)
Comment 2 Philip Guenther 2005-09-20 02:21:08 EDT
If you want the default mailspool to be in Maildir format, you should set the
MAILSPOOLSUFFIX define in authenticate.c to "/".
Comment 3 Dmitry Butskoy 2005-09-20 06:55:34 EDT
(for comment #2)
It is not about changing the default maildir.

The issue is an impossibility to autocreate maildir under /var/spool/mail
location, both when maildir is default and when it is just caused by procmailrc.
Comment 4 Philip Guenther 2005-09-20 16:24:58 EDT
>The issue is an impossibility to autocreate maildir under /var/spool/mail
>location, both when maildir is default and when it is just caused by procmailrc.

It is not impossible to autocreate maildirs under /var/spool/mail when it is
compiled in using MAILSPOOLSUFFIX; I just tried it and it worked just fine. 
What were your results when you tried that make you say it doesn't work?

What is not currently supported by procmail is changing the type or location of
the default mailspool without recompilation.

The suggested patch is not safe as there is a race condition between the check
of the file size and the unlink() and this is not being done under a lock. 
Locking the mailbox to make this safe would defeat the "maildir doesn't require
locking" premise.
Comment 5 Dmitry Butskoy 2005-09-21 07:10:39 EDT
> It is not impossible to autocreate maildirs under /var/spool/mail when it is
> compiled in using MAILSPOOLSUFFIX; I just tried it and it worked just fine. 
> What were your results when you tried that make you say it doesn't work?
Yes, it autocreates maildirs fine.

But compiling with MAILSPOOLSUFFIX="/" leads to impossibility to autocreate
mailboxes, in any location. Try such /etc/procmailrc:

:0
/var/mail/$LOGNAME

and also this one:

:0
/var/mail/$LOGNAME.foo

and see the results under /var/mail ...


I guess Fedora would prefer to handle both maildir/ and mailbox formats by procmail.


> The suggested patch is not safe as there is a race condition between the check
> of the file size and the unlink() 
I originally wanted to unlink() the preventing file unconditionally, but have
then decided that such a check would be a little useful. I consider it optional.
OTOH the race conditional is formaly present. May be get rid of this check?



Comment 6 Dmitry Butskoy 2005-09-21 08:53:28 EDT
Created attachment 119070 [details]
second variant of the patch

  Philip,

  This is probably a better patch, using rnmbogus().

  I still try to unlink() an ugly empty bogus file, but if you consider that it
is unsafe, then let's admins manually remove them.
Comment 7 Bug Zapper 2008-04-03 12:16:30 EDT
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 8 Dmitry Butskoy 2008-04-04 08:08:50 EDT
Since the upstream version is not changed (still 3.22), the issue is going on.
Comment 9 Bug Zapper 2008-05-13 22:01:15 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 10 Bug Zapper 2009-06-09 18:02:36 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 11 Bug Zapper 2009-07-14 13:12:07 EDT
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 12 Dmitry Butskoy 2009-07-14 13:23:40 EDT
Reopen
Comment 13 Fedora Admin XMLRPC Client 2010-04-15 11:58:41 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 14 Bug Zapper 2010-04-27 07:37:23 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 15 Bug Zapper 2010-07-30 06:25:49 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 16 Fedora End Of Life 2013-04-03 15:53:52 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Comment 17 Fedora End Of Life 2015-01-09 16:35:26 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 18 Jan Kurik 2015-07-15 11:27:47 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
Comment 19 Fedora End Of Life 2016-11-24 05:15:21 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 20 Fedora End Of Life 2017-02-28 04:27:39 EST
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

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