summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2006-03-01 11:24:04 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2006-03-01 11:24:04 +0000
commitd35e429daf77293be8e2861de05c0f4312003737 (patch)
treed741a74eabc75ef4be29a3e59459d1f02058e4f5
parent50c99ba643be3b19677854101aca137bed084856 (diff)
Avoid unnecessary scan of maildir mailbox when mailbox_size is set but
mailbox_filecount and quota_filecount are not.
-rw-r--r--doc/doc-txt/ChangeLog9
-rw-r--r--src/src/transports/appendfile.c15
-rw-r--r--test/confs/500850
-rw-r--r--test/log/50086
-rw-r--r--test/scripts/5000-maildir/50089
-rw-r--r--test/stderr/500877
6 files changed, 158 insertions, 8 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 5344cbd01..ffdc0a165 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.317 2006/03/01 10:40:03 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.318 2006/03/01 11:24:04 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -245,6 +245,13 @@ PH/48 The ${prvs expansion was broken on systems where time_t was long long.
PH/49 Installed latest patch from the Sieve maintainer.
+PH/50 When an Exim quota was set without a file count quota, and mailbox_size
+ was also set, the appendfile transport was unnecessarily scanning a
+ directory of message files (e.g. for maildir delivery) to find the count
+ of files (along with the size), even though it did not need this
+ information. It now does the scan only if it needs to find either the
+ size of the count of files.
+
Exim version 4.60
-----------------
diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c
index 142d55703..7a415de7a 100644
--- a/src/src/transports/appendfile.c
+++ b/src/src/transports/appendfile.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.13 2006/02/21 16:24:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.14 2006/03/01 11:24:04 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2317,13 +2317,14 @@ else
}
#endif /* SUPPORT_MAILDIR */
- /* Otherwise (mailbox_size is not yet set), if we are going to do a quota
- check later on, find the current size of the mailbox. (We don't need to check
- ob->quota_filecount_value, because it can only be set if ob->quota_value is
- set.) */
+ /* Otherwise if we are going to do a quota check later on, and the mailbox
+ size is not set, find the current size of the mailbox. Ditto for the file
+ count. Note that ob->quota_filecount_value cannot be set without
+ ob->quota_value being set. */
- if ((mailbox_size < 0 || mailbox_filecount < 0) &&
- (ob->quota_value > 0 || THRESHOLD_CHECK))
+ if ((ob->quota_value > 0 || THRESHOLD_CHECK) &&
+ (mailbox_size < 0 ||
+ (mailbox_filecount < 0 && ob->quota_filecount_value > 0)))
{
off_t size;
int filecount = 0;
diff --git a/test/confs/5008 b/test/confs/5008
new file mode 100644
index 000000000..9e77ba09e
--- /dev/null
+++ b/test/confs/5008
@@ -0,0 +1,50 @@
+# Exim test configuration 5008
+
+QUOTA_FILECOUNT=0
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+
+# ----- Main settings -----
+
+delay_warning =
+qualify_domain = test.ex
+
+
+# ----- Routers -----
+
+begin routers
+
+r1:
+ driver = accept
+ transport = t1
+
+# ----- Transports -----
+
+begin transports
+
+t1:
+ driver = appendfile
+ directory = DIR/test-mail/$local_part
+ user = CALLER
+ maildir_format
+ mailbox_size = 100K
+ quota = 1M
+ quota_filecount = QUOTA_FILECOUNT
+
+
+# ----- Retry -----
+
+begin retry
+
+* * F,1d,1d
+
+
+# End
diff --git a/test/log/5008 b/test/log/5008
new file mode 100644
index 000000000..1f37fd399
--- /dev/null
+++ b/test/log/5008
@@ -0,0 +1,6 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaY-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
diff --git a/test/scripts/5000-maildir/5008 b/test/scripts/5000-maildir/5008
new file mode 100644
index 000000000..0c504234f
--- /dev/null
+++ b/test/scripts/5000-maildir/5008
@@ -0,0 +1,9 @@
+# mailbox_size and mailbox_filecount
+#
+exim -d-all+transport -odi userx@test.ex
+Test message
+****
+exim -DQUOTA_FILECOUNT=20 -d-all+transport -odi userx@test.ex
+Test message
+****
+no_message_check
diff --git a/test/stderr/5008 b/test/stderr/5008
new file mode 100644
index 000000000..5c2b23f8a
--- /dev/null
+++ b/test/stderr/5008
@@ -0,0 +1,77 @@
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: MAIN
+ <= CALLER@test.ex U=CALLER P=local S=sss
+created log directory TESTSUITE/spool/log
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+>>>>>>>>>>>>>>>> Local deliveries >>>>>>>>>>>>>>>>
+--------> userx@test.ex <--------
+appendfile transport entered
+appendfile: mode=600 notify_comsat=0 quota=1048576 warning=0
+ directory=TESTSUITE/test-mail/userx format=maildir
+ message_prefix=null
+ message_suffix=null
+ maildir_use_size_file=no
+ensuring maildir directories exist in TESTSUITE/test-mail/userx
+created directory TESTSUITE/test-mail/userx
+created directory TESTSUITE/test-mail/userx/tmp
+created directory TESTSUITE/test-mail/userx/new
+created directory TESTSUITE/test-mail/userx/cur
+delivering in maildir format in TESTSUITE/test-mail/userx
+writing to tmp/MAILDIR.myhost.test.ex
+Exim quota = 1048576 old size = sssss this message = sss (included)
+ file count quota = 0 count = -1
+writing data block fd=6 size=sss timeout=0
+renaming temporary file
+renamed tmp/MAILDIR.myhost.test.ex as new/MAILDIR.myhost.test.ex
+appendfile yields 0 with errno=dd more_errno=dd
+t1 transport returned OK for userx@test.ex
+LOG: MAIN
+ => userx <userx@test.ex> R=r1 T=t1
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: MAIN
+ <= CALLER@test.ex U=CALLER P=local S=sss
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+>>>>>>>>>>>>>>>> Local deliveries >>>>>>>>>>>>>>>>
+--------> userx@test.ex <--------
+appendfile transport entered
+appendfile: mode=600 notify_comsat=0 quota=1048576 warning=0
+ directory=TESTSUITE/test-mail/userx format=maildir
+ message_prefix=null
+ message_suffix=null
+ maildir_use_size_file=no
+ensuring maildir directories exist in TESTSUITE/test-mail/userx
+quota checks on directory TESTSUITE/test-mail/userx
+MUNGED: the check_dir_size lines have been sorted to ensure consistency
+check_dir_size: dir=TESTSUITE/test-mail/userx sum=dddd count=dd
+check_dir_size: dir=TESTSUITE/test-mail/userx/cur sum=0 count=dd
+check_dir_size: dir=TESTSUITE/test-mail/userx/new sum=dddd count=dd
+check_dir_size: dir=TESTSUITE/test-mail/userx/tmp sum=0 count=dd
+delivering in maildir format in TESTSUITE/test-mail/userx
+writing to tmp/MAILDIR.myhost.test.ex
+Exim quota = 1048576 old size = sssss this message = sss (included)
+ file count quota = 20 count = 4
+writing data block fd=6 size=sss timeout=0
+renaming temporary file
+renamed tmp/MAILDIR.myhost.test.ex as new/MAILDIR.myhost.test.ex
+appendfile yields 0 with errno=dd more_errno=dd
+t1 transport returned OK for userx@test.ex
+LOG: MAIN
+ => userx <userx@test.ex> R=r1 T=t1
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>