From: Jeremy Harris Date: Thu, 12 Oct 2017 13:03:08 +0000 (+0100) Subject: Fix queue_run_in_order to ignore the PID portion of the message ID X-Git-Tag: exim-4_90_RC1~40 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2540f2f8e450051e31f108bffb8c0da5b6dd8c22;p=exim.git Fix queue_run_in_order to ignore the PID portion of the message ID --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 5266cefc4..4f7f63818 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -169,6 +169,10 @@ JH/27 Fix SOCKS bug: an unitialized pointer was deref'd by the transport process JH/28 Logging: "next input sent too soon" now shows where input was truncated for log purposes. +JH/29 Fix queue_run_in_order to ignore the PID portion of the message ID. This + matters on fast-turnover and PID-randomising systems, which were getting + out-of-order delivery. + Exim version 4.89 ----------------- diff --git a/src/src/queue.c b/src/src/queue.c index 8b0494b26..dadd034d6 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -80,7 +80,11 @@ queue_filename *first = NULL; queue_filename **append = &first; while (a && b) - if (Ustrcmp(a->text, b->text) < 0) + { + int d; + if ((d = Ustrncmp(a->text, b->text, 6)) == 0) + d = Ustrcmp(a->text + 14, b->text + 14); + if (d < 0) { *append = a; append= &a->next; @@ -92,6 +96,7 @@ while (a && b) append= &b->next; b = b->next; } + } *append = a ? a : b; return first; @@ -278,7 +283,7 @@ for (; i <= *subcount; i++) if (root[j]) { next = merge_queue_lists(next, root[j]); - root[j] = (j == LOG2_MAXNODES - 1)? next : NULL; + root[j] = j == LOG2_MAXNODES - 1 ? next : NULL; } else { @@ -450,8 +455,8 @@ subsequent iterations. When the first argument of queue_get_spool_list() is -1 (for queue_run_in_ order), it scans all directories and makes a single message list. */ -for (i = (queue_run_in_order? -1 : 0); - i <= (queue_run_in_order? -1 : subcount); +for (i = queue_run_in_order ? -1 : 0; + i <= (queue_run_in_order ? -1 : subcount); i++) { queue_filename *f; diff --git a/src/src/receive.c b/src/src/receive.c index 65e9fb415..66d2d3fe0 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -2621,8 +2621,9 @@ letter and it is not used internally. NOTE: If ever the format of message ids is changed, the regular expression for checking that a string is in this format must be updated in a corresponding way. It appears in the initializing code in exim.c. The macro MESSAGE_ID_LENGTH -must also be changed to reflect the correct string length. Then, of course, -other programs that rely on the message id format will need updating too. */ +must also be changed to reflect the correct string length. The queue-sort code +needs to know the layout. Then, of course, other programs that rely on the +message id format will need updating too. */ Ustrncpy(message_id, string_base62((long int)(message_id_tv.tv_sec)), 6); message_id[6] = '-';