From: Jeremy Harris Date: Mon, 6 May 2024 16:57:21 +0000 (+0100) Subject: Testsuite: munge retry DB dumps for long pathnames X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/cf9f324212bddcc09f405b94b9a01a5c99ffe19b Testsuite: munge retry DB dumps for long pathnames --- diff --git a/src/src/EDITME b/src/src/EDITME index 85d24f73f..4a33677d5 100644 --- a/src/src/EDITME +++ b/src/src/EDITME @@ -60,8 +60,8 @@ # for you by the OS-specific configuration. If Exim compiles without any # problems, you probably do not have to worry about the DBM library. If you # do want or need to change it, you should first read the discussion in the -# file doc/dbm.discuss.txt, which also contains instructions for testing Exim's -# interface to the DBM library. +# file doc/doc-txt/dbm.discuss.txt, which also contains instructions for testing +# Exim's interface to the DBM library. # In Local/Makefiles blank lines and lines starting with # are ignored. It is # also permitted to use the # character to add a comment to a setting, for diff --git a/src/src/hintsdb.h b/src/src/hintsdb.h index 2d7199eda..ed1b5566d 100644 --- a/src/src/hintsdb.h +++ b/src/src/hintsdb.h @@ -24,6 +24,10 @@ utilities as well as the main Exim binary. */ #if defined(USE_TDB) +# if defined(USE_DB) || defined(USE_GDBM) +# error USE_TDB conflict with alternate definition +# endif + /* ************************* tdb interface ************************ */ /*XXX https://manpages.org/tdb/3 mentions concurrent writes. Could we lose the file lock? */ @@ -157,6 +161,10 @@ d->dptr = NULL; #elif defined USE_DB +# if defined(USE_TDB) || defined(USE_GDBM) +# error USE_DB conflict with alternate definition +# endif + # include /* 1.x did no locking @@ -482,6 +490,10 @@ exim_datum_free(EXIM_DATUM * d) #elif defined USE_GDBM /*XXX TODO: exim's locfile not needed */ +# if defined(USE_TDB) || defined(USE_DB) +# error USE_GDBM conflict with alternate definition +# endif + # include /* Basic DB type */ @@ -609,7 +621,7 @@ static inline void exim_datum_free(EXIM_DATUM * d) { free(d->dptr); } -/* size limit */ +/* size limit. GDBM is int-max limited, but we want to be less silly */ # define EXIM_DB_RLIMIT 150 @@ -621,7 +633,7 @@ exim_datum_free(EXIM_DATUM * d) /* If none of USE_DB, USG_GDBM, or USE_TDB are set, the default is the NDBM -interface */ +interface (which seems to be a wrapper for GDBM) */ /********************* ndbm interface definitions **********************/ @@ -745,7 +757,7 @@ exim_datum_free(EXIM_DATUM * d) # define EXIM_DB_RLIMIT 150 -#endif /* USE_GDBM */ +#endif /* !USE_GDBM */ diff --git a/src/src/retry.c b/src/src/retry.c index 6b977dd58..6ccef4f98 100644 --- a/src/src/retry.c +++ b/src/src/retry.c @@ -678,7 +678,13 @@ for (int i = 0; i < 3; i++) ? US string_printing(rti->message) : US"unknown error"; message_length = Ustrlen(message); - if (message_length > EXIM_DB_RLIMIT) message_length = EXIM_DB_RLIMIT; + if (message_length > EXIM_DB_RLIMIT) + { + DEBUG(D_retry) + debug_printf_indent("truncating message from %u to %u bytes\n", + message_length, EXIM_DB_RLIMIT); + message_length = EXIM_DB_RLIMIT; + } /* Read a retry record from the database or construct a new one. Ignore an old one if it is too old since it was last updated. */ diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index 0279659f2..f495f9571 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -1368,7 +1368,7 @@ if (!isdirectory) && ob->create_file == create_belowhome) if (is_tainted(path)) { - DEBUG(D_transport) debug_printf("de-tainting path '%s'\n", path); + DEBUG(D_transport) debug_printf("below-home: de-tainting path '%s'\n", path); path = string_copy_taint(path, GET_UNTAINTED); } @@ -2207,7 +2207,7 @@ else if (is_tainted(path)) if (ob->create_file == create_belowhome) { - DEBUG(D_transport) debug_printf("de-tainting path '%s'\n", path); + DEBUG(D_transport) debug_printf("below-home: de-tainting path '%s'\n", path); path = string_copy_taint(path, GET_UNTAINTED); } else diff --git a/test/runtest b/test/runtest index e8f1933f2..afcdd0c2f 100755 --- a/test/runtest +++ b/test/runtest @@ -1061,6 +1061,9 @@ RESET_AFTER_EXTRA_LINE_READ: # gnutls version variances next if /^Error in the pull function./; + # Retry DB record gets truncated when TESTDIR is a long string + s/T:.*\(MTA-imposed quota exceeded while writing to\K.*$/ )/; + # optional IDN2 variant conversions. Accept either IDN1 or IDN2 s/conversion strasse.de/conversion xn--strae-oqa.de/; s/conversion: german.xn--strae-oqa.de/conversion: german.straße.de/; diff --git a/test/scripts/2300-DBM/2301 b/test/scripts/2300-DBM/2301 index 9ba0c5079..82ec19da7 100644 --- a/test/scripts/2300-DBM/2301 +++ b/test/scripts/2300-DBM/2301 @@ -1,4 +1,6 @@ # lookup dbmjz +# NB: the reference DB file is a Berkeley DB; +# builds for other hints-DB interface will fail # exim -be ${lookup{testid:test.example.invalid:userPassword}dbmjz{DIR/aux-fixed/TESTNUM.testsasldb}{$value}fail} diff --git a/test/scripts/2300-DBM/2302 b/test/scripts/2300-DBM/2302 index 4bdbc869e..4c8b7958b 100644 --- a/test/scripts/2300-DBM/2302 +++ b/test/scripts/2300-DBM/2302 @@ -1,4 +1,6 @@ # lookup dbmnz +# NB: the reference DB file is a Berkeley DB; +# builds for other hints-DB interface will fail # exim -be '[${lookup{test}dbmnz{DIR/aux-fixed/TESTNUM.emptydbmnzlookup}}]' **** diff --git a/test/stderr/0169 b/test/stderr/0169 index 55fd2bcb0..9295d32fd 100644 --- a/test/stderr/0169 +++ b/test/stderr/0169 @@ -17,7 +17,7 @@ appendfile: mode=600 notify_comsat=0 quota=52428800 warning=41% message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' lock name: TESTSUITE/test-mail/userx.lock hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp lock file created diff --git a/test/stderr/0386 b/test/stderr/0386 index ace0dc69c..03c432317 100644 --- a/test/stderr/0386 +++ b/test/stderr/0386 @@ -364,7 +364,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/2' +below-home: de-tainting path 'TESTSUITE/test-mail/2' lock name: TESTSUITE/test-mail/2.lock hitch name: TESTSUITE/test-mail/2.lock.test.ex.dddddddd.pppppppp lock file created @@ -561,7 +561,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/2' +below-home: de-tainting path 'TESTSUITE/test-mail/2' lock name: TESTSUITE/test-mail/2.lock hitch name: TESTSUITE/test-mail/2.lock.test.ex.dddddddd.pppppppp lock file created diff --git a/test/stderr/0393 b/test/stderr/0393 index 75f92b9e1..0a279503d 100644 --- a/test/stderr/0393 +++ b/test/stderr/0393 @@ -22,7 +22,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' lock name: TESTSUITE/test-mail/userx.lock hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp lock file created @@ -69,7 +69,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' lock name: TESTSUITE/test-mail/userx.lock hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp lock file created @@ -110,7 +110,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' lock name: TESTSUITE/test-mail/userx.lock hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp lock file created diff --git a/test/stderr/0404 b/test/stderr/0404 index bf8a60e5d..fc8ad68e4 100644 --- a/test/stderr/0404 +++ b/test/stderr/0404 @@ -18604,7 +18604,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/sender' +below-home: de-tainting path 'TESTSUITE/test-mail/sender' lock name: TESTSUITE/test-mail/sender.lock hitch name: TESTSUITE/test-mail/sender.lock.test.ex.dddddddd.pppppppp lock file created diff --git a/test/stderr/0408 b/test/stderr/0408 index bbe75fb92..d14b9ea86 100644 --- a/test/stderr/0408 +++ b/test/stderr/0408 @@ -157,7 +157,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' lock name: TESTSUITE/test-mail/userx.lock hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp lock file created diff --git a/test/stderr/0487 b/test/stderr/0487 index e703c88d9..d8b9bc1d9 100644 --- a/test/stderr/0487 +++ b/test/stderr/0487 @@ -159,7 +159,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=0 message_suffix=\n maildir_use_size_file=no locking by lockfile fcntl -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' lock name: TESTSUITE/test-mail/userx.lock hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp lock file created diff --git a/test/stderr/5005 b/test/stderr/5005 index d9041e69f..db4429ef0 100644 --- a/test/stderr/5005 +++ b/test/stderr/5005 @@ -124,7 +124,7 @@ appendfile: mode=600 notify_comsat=0 quota=500 warning=0 message_prefix=null message_suffix=null maildir_use_size_file=yes -de-tainting path 'TESTSUITE/test-mail/nofile' +below-home: de-tainting path 'TESTSUITE/test-mail/nofile' ensuring maildir directories exist in TESTSUITE/test-mail/nofile created directory TESTSUITE/test-mail/nofile created directory TESTSUITE/test-mail/nofile/tmp @@ -314,7 +314,7 @@ appendfile: mode=600 notify_comsat=0 quota=500 warning=0 message_prefix=null message_suffix=null maildir_use_size_file=yes -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' ensuring maildir directories exist in TESTSUITE/test-mail/userx created directory TESTSUITE/test-mail/userx/tmp created directory TESTSUITE/test-mail/userx/new @@ -506,7 +506,7 @@ appendfile: mode=600 notify_comsat=0 quota=500 warning=0 message_prefix=null message_suffix=null maildir_use_size_file=yes -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' ensuring maildir directories exist in TESTSUITE/test-mail/userx compiling RE '^(?:cur|new|\..*)$' using regex for maildir directory selection: ^(?:cur|new|\..*)$ @@ -716,7 +716,7 @@ appendfile: mode=600 notify_comsat=0 quota=500 warning=0 message_prefix=null message_suffix=null maildir_use_size_file=yes -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' ensuring maildir directories exist in TESTSUITE/test-mail/userx compiling RE '^(?:cur|new|\..*)$' using regex for maildir directory selection: ^(?:cur|new|\..*)$ diff --git a/test/stderr/5006 b/test/stderr/5006 index 864a726f5..a1c80c1a9 100644 --- a/test/stderr/5006 +++ b/test/stderr/5006 @@ -124,7 +124,7 @@ appendfile: mode=600 notify_comsat=0 quota=0 warning=50% message_prefix=null message_suffix=null maildir_use_size_file=yes -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' ensuring maildir directories exist in TESTSUITE/test-mail/userx created directory TESTSUITE/test-mail/userx created directory TESTSUITE/test-mail/userx/tmp diff --git a/test/stderr/5008 b/test/stderr/5008 index 648ebd046..a89631236 100644 --- a/test/stderr/5008 +++ b/test/stderr/5008 @@ -17,7 +17,7 @@ appendfile: mode=600 notify_comsat=0 quota=1048576 warning=0 message_prefix=null message_suffix=null maildir_use_size_file=no -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' ensuring maildir directories exist in TESTSUITE/test-mail/userx created directory TESTSUITE/test-mail/userx created directory TESTSUITE/test-mail/userx/tmp @@ -57,7 +57,7 @@ appendfile: mode=600 notify_comsat=0 quota=1048576 warning=0 message_prefix=null message_suffix=null maildir_use_size_file=no -de-tainting path 'TESTSUITE/test-mail/userx' +below-home: de-tainting path 'TESTSUITE/test-mail/userx' 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 diff --git a/test/stdout/0264 b/test/stdout/0264 index 159ebfabb..a4c1fb4ff 100644 --- a/test/stdout/0264 +++ b/test/stdout/0264 @@ -1,10 +1,10 @@ +++++++++++++++++++++++++++ - T:userx@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/userx) + T:userx@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 600 +++++++++++++++++++++++++++ - T:test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/notuser) + T:test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 1200 - T:userx@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/userx) + T:userx@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 600 Message 10HmaX-000000005vi-0000 has been removed Message 10HmbA-000000005vi-0000 has been removed diff --git a/test/stdout/0345 b/test/stdout/0345 index 1fa2305cd..a3c51fa64 100644 --- a/test/stdout/0345 +++ b/test/stdout/0345 @@ -1,14 +1,14 @@ +++++++++++++++++++++++++++ - T:a@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/a) + T:a@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 20 -rw------- 1 CALLER CALLER 0 May 10 2002 TESTSUITE/test-mail/a +++++++++++++++++++++++++++ - T:a@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/a) + T:a@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 0 * - T:CALLER@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/CALLER) + T:CALLER@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 20 +++++++++++++++++++++++++++ - T:a@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/a) + T:a@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 0 * - T:CALLER@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to TESTSUITE/test-mail/CALLER) + T:CALLER@test.ex -22 xxxx mailbox is full (MTA-imposed quota exceeded while writing to ) first failed = time last try = time2 next try = time2 + 20