From: Jeremy Harris Date: Sat, 20 Jul 2024 18:16:36 +0000 (+0100) Subject: Hintsdb: fix sqlite X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/48f733ce6670fb161d3ae194340f94d4d77eb69b Hintsdb: fix sqlite Broken-by: 3cee6033bae8 --- diff --git a/src/src/dbfn.c b/src/src/dbfn.c index 1f6989164..27bd9e56c 100644 --- a/src/src/dbfn.c +++ b/src/src/dbfn.c @@ -256,6 +256,7 @@ uschar dirname[PATHLEN], filename[PATHLEN]; DEBUG(D_hints_lookup) acl_level++; dbblock->lockfd = -1; +dbblock->readonly = (flags & O_ACCMODE) == O_RDONLY; db_dir_make(TRUE); dlen = snprintf(CS dirname, sizeof(dirname), "%s/db", spool_directory); @@ -295,11 +296,13 @@ return dbblock; } +/* Return: boolean success */ BOOL dbfn_transaction_start(open_db * dbp) { DEBUG(D_hints_lookup) debug_printf_indent("dbfn_transaction_start\n"); if (!dbp->readonly) return exim_dbtransaction_start(dbp->dbptr); +return FALSE; } void dbfn_transaction_commit(open_db * dbp) diff --git a/src/src/deliver.c b/src/src/deliver.c index ee7650243..8aeedc755 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -4794,6 +4794,10 @@ do_remote_deliveries par_reduce par_wait par_read_pipe */ /*XXX what about firsttime? */ + /*XXX also, ph1? Note tp->name would possibly change per message, + so a check/close/open would be needed. Might was to change that var name + "continue_wait_db" as we'd be using it for a non-continued-transport + context. */ if (continue_transport && !exim_lockfile_needed()) if (!continue_wait_db) { @@ -4804,7 +4808,7 @@ do_remote_deliveries par_reduce par_wait par_read_pipe continue_next_id[0] = '\0'; } - if ((pid = exim_fork(US"transport")) == 0) + if ((pid = exim_fork(f.queue_2stage ? US"transport ph1":US"transport")) == 0) { int fd = pfd[pipe_write]; host_item *h; diff --git a/test/log/0367 b/test/log/0367 index bfc366ac0..0e5352d0b 100644 --- a/test/log/0367 +++ b/test/log/0367 @@ -3,12 +3,12 @@ 1999-03-02 09:44:33 10HmaZ-000000005vi-0000 <= CALLER@test.ex U=CALLER P=local S=sss 1999-03-02 09:44:33 10HmbA-000000005vi-0000 <= CALLER@test.ex U=CALLER P=local S=sss 1999-03-02 09:44:33 Start queue run: pid=p1234 -qqf -1999-03-02 09:44:33 10HmaX-000000005vi-0000 => userx@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" +1999-03-02 09:44:33 10HmaX-000000005vi-0000 => userx1@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" 1999-03-02 09:44:33 10HmaX-000000005vi-0000 Completed -1999-03-02 09:44:33 10HmaY-000000005vi-0000 => userx@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1]* C="250 OK" +1999-03-02 09:44:33 10HmaY-000000005vi-0000 => userx2@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1]* C="250 OK" 1999-03-02 09:44:33 10HmaY-000000005vi-0000 Completed -1999-03-02 09:44:33 10HmaZ-000000005vi-0000 => userx@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1]* C="250 OK" +1999-03-02 09:44:33 10HmaZ-000000005vi-0000 => userx3@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1]* C="250 OK" 1999-03-02 09:44:33 10HmaZ-000000005vi-0000 Completed -1999-03-02 09:44:33 10HmbA-000000005vi-0000 => userx@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1]* C="250 OK" +1999-03-02 09:44:33 10HmbA-000000005vi-0000 => userx4@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1]* C="250 OK" 1999-03-02 09:44:33 10HmbA-000000005vi-0000 Completed 1999-03-02 09:44:33 End queue run: pid=p1234 -qqf diff --git a/test/runtest b/test/runtest index 6a00a4642..3b936de3d 100755 --- a/test/runtest +++ b/test/runtest @@ -1199,8 +1199,8 @@ RESET_AFTER_EXTRA_LINE_READ: s/(?:bdb|tdb|gdbm|ndbm|sqlite) _open\(flags\ 0x(\d) \ mode\ 0640\) - (?=\ No\ such\ file\ or\ directory$) - /hintsdb_open(flags 0x$1 mode 0640)/x; + \ (?:No\ such\ file\ or\ directory|unable\ to\ open\ database\ file)$ + /hintsdb_open(flags 0x$1 mode 0640) No such file or directory/x; # Lines with a leading pid. Only handle >= 4-digit PIDs to avoid converting SMTP respose codes s/^\s*(\d{4,})\s(?!(?:previous message|in\s|bytes remain in|SMTP accept process running))/new_value($1, "p%s", \$next_pid) . ' '/e; diff --git a/test/scripts/0000-Basic/0367 b/test/scripts/0000-Basic/0367 index 0c03b391b..a8a06b83c 100644 --- a/test/scripts/0000-Basic/0367 +++ b/test/scripts/0000-Basic/0367 @@ -1,16 +1,16 @@ # Multiple messages down one SMTP connection need_ipv4 # -exim -odq userx@domain1 +exim -odq userx1@domain1 Test message 1 **** -exim -odq userx@domain1 +exim -odq userx2@domain1 Test message 2 **** -exim -odq userx@domain1 +exim -odq userx3@domain1 Test message 3 **** -exim -odq userx@domain1 +exim -odq userx4@domain1 Test message 4 **** server PORT_S diff --git a/test/stderr/0218 b/test/stderr/0218 index 49afcdcc9..91d2c7104 100644 --- a/test/stderr/0218 +++ b/test/stderr/0218 @@ -13,14 +13,14 @@ test.ex in ""? no (end of list) CALLER@test.ex in senders? no (end of list) R: client (ACL) T: send_to_server (ACL) ->>>>>>>>>>>>>>>> Exim pid=p1237 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1237 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1238 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> delivering 10HmaY-000000005vi-0000 (queue run pid p1234) test.ex in ""? no (end of list) CALLER@test.ex in senders? no (end of list) R: client (ACL) T: send_to_server (ACL) ->>>>>>>>>>>>>>>> Exim pid=p1239 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1239 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1240 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> queue_run phase 2 start queue running combined directories @@ -95,14 +95,14 @@ test.ex in ""? no (end of list) CALLER@test.ex in senders? no (end of list) R: client (ACL) T: send_to_server (ACL) ->>>>>>>>>>>>>>>> Exim pid=p1244 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1244 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1245 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> delivering 10HmbA-000000005vi-0000 (queue run pid p1235) test.ex in ""? no (end of list) CALLER@test.ex in senders? no (end of list) R: client (ACL) T: send_to_server (ACL) ->>>>>>>>>>>>>>>> Exim pid=p1246 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1246 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1247 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> queue_run phase 2 start queue running combined directories @@ -172,7 +172,7 @@ test.ex in ""? no (end of list) CALLER@test.ex in senders? no (end of list) R: client (ACL) T: send_to_server (ACL) ->>>>>>>>>>>>>>>> Exim pid=p1253 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1253 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1254 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> delivering 10HmbB-000000005vi-0000 (queue run pid p1236) R: bounce (ACL) @@ -188,7 +188,7 @@ test.ex in ""? no (end of list) CALLER@test.ex in senders? no (end of list) R: client (ACL) T: send_to_server (ACL) ->>>>>>>>>>>>>>>> Exim pid=p1256 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1256 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1257 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> delivering 10HmbA-000000005vi-0000 (queue run pid p1236) test.ex in ""? no (end of list) diff --git a/test/stderr/1157 b/test/stderr/1157 index 95adc3960..3d55a28c5 100644 --- a/test/stderr/1157 +++ b/test/stderr/1157 @@ -5,11 +5,11 @@ admin user dropping to exim gid; retaining priv uid LOG: queue_run MAIN Start queue run: pid=p1234 -qqf ->>>>>>>>>>>>>>>> Exim pid=p1242 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1242 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1243 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>> Exim pid=p1244 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1244 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1245 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>> Exim pid=p1246 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1246 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1247 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> Connecting to 127.0.0.1 [127.0.0.1]:PORT_D ... connected @@ -100,11 +100,11 @@ admin user dropping to exim gid; retaining priv uid LOG: queue_run MAIN Start queue run: pid=p1235 -qqf ->>>>>>>>>>>>>>>> Exim pid=p1253 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1253 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1254 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>> Exim pid=p1255 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1255 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1256 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>> Exim pid=p1257 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1257 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1258 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> Connecting to 127.0.0.1 [127.0.0.1]:PORT_D ... connected @@ -195,11 +195,11 @@ admin user dropping to exim gid; retaining priv uid LOG: queue_run MAIN Start queue run: pid=p1236 -qqf ->>>>>>>>>>>>>>>> Exim pid=p1264 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1264 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1265 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>> Exim pid=p1266 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1266 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1267 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>> Exim pid=p1268 (transport) terminating with rc=0 >>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>> Exim pid=p1268 (transport ph1) terminating with rc=0 >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Exim pid=p1269 (qrun-p1-delivery) terminating with rc=0 >>>>>>>>>>>>>>>> Connecting to 127.0.0.1 [127.0.0.1]:PORT_D ... connected diff --git a/test/stdout/0367 b/test/stdout/0367 index 1f42f534a..86165b445 100644 --- a/test/stdout/0367 +++ b/test/stdout/0367 @@ -8,14 +8,14 @@ EHLO the.local.host.name 250 HELP MAIL FROM: 250 OK -RCPT TO: +RCPT TO: 250 OK DATA 354 More... Received: from CALLER by the.local.host.name with local (Exim x.yz) (envelope-from ) id 10HmaX-000000005vi-0000 - for userx@domain1; + for userx1@domain1; Tue, 2 Mar 1999 09:44:33 +0000 Message-Id: From: CALLER_NAME @@ -26,14 +26,14 @@ Test message 1 250 OK MAIL FROM: 250 OK -RCPT TO: +RCPT TO: 250 OK DATA 354 More... Received: from CALLER by the.local.host.name with local (Exim x.yz) (envelope-from ) id 10HmaY-000000005vi-0000 - for userx@domain1; + for userx2@domain1; Tue, 2 Mar 1999 09:44:33 +0000 Message-Id: From: CALLER_NAME @@ -44,14 +44,14 @@ Test message 2 250 OK MAIL FROM: 250 OK -RCPT TO: +RCPT TO: 250 OK DATA 354 More... Received: from CALLER by the.local.host.name with local (Exim x.yz) (envelope-from ) id 10HmaZ-000000005vi-0000 - for userx@domain1; + for userx3@domain1; Tue, 2 Mar 1999 09:44:33 +0000 Message-Id: From: CALLER_NAME @@ -62,14 +62,14 @@ Test message 3 250 OK MAIL FROM: 250 OK -RCPT TO: +RCPT TO: 250 OK DATA 354 More... Received: from CALLER by the.local.host.name with local (Exim x.yz) (envelope-from ) id 10HmbA-000000005vi-0000 - for userx@domain1; + for userx4@domain1; Tue, 2 Mar 1999 09:44:33 +0000 Message-Id: From: CALLER_NAME