summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-10-02 19:39:55 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2018-10-02 19:39:55 +0100
commitae8f9024d8d4fad31457d758022e3186d782929c (patch)
treee44777d6310ee3f6c7fe3ef7d40de831e00eb14a /src
parenta3970a881934e1fc6be1993bfe544dd17abf6082 (diff)
Debug: noutf8 selector. Bug 2324
Diffstat (limited to 'src')
-rw-r--r--src/src/debug.c18
-rw-r--r--src/src/expand.c102
-rw-r--r--src/src/globals.c5
-rw-r--r--src/src/macros.h4
4 files changed, 86 insertions, 43 deletions
diff --git a/src/src/debug.c b/src/src/debug.c
index 35eb77c25..4b0765147 100644
--- a/src/src/debug.c
+++ b/src/src/debug.c
@@ -212,11 +212,19 @@ if (indent > 0)
{
int i;
for (i = indent >> 2; i > 0; i--)
- {
- Ustrcpy(debug_ptr, " " UTF8_VERT_2DASH);
- debug_ptr += 6; /* 3 spaces + 3 UTF-8 octets */
- debug_prefix_length += 6;
- }
+ DEBUG(D_noutf8)
+ {
+ Ustrcpy(debug_ptr, " !");
+ debug_ptr += 4; /* 3 spaces + shriek */
+ debug_prefix_length += 4;
+ }
+ else
+ {
+ Ustrcpy(debug_ptr, " " UTF8_VERT_2DASH);
+ debug_ptr += 6; /* 3 spaces + 3 UTF-8 octets */
+ debug_prefix_length += 6;
+ }
+
Ustrncpy(debug_ptr, " ", indent &= 3);
debug_ptr += indent;
debug_prefix_length += indent;
diff --git a/src/src/expand.c b/src/src/expand.c
index 4a88b4446..ca7d36838 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -4006,11 +4006,15 @@ BOOL resetok = TRUE;
expand_level++;
DEBUG(D_expand)
- debug_printf_indent(UTF8_DOWN_RIGHT "%s: %s\n",
- skipping
- ? UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ "scanning"
- : "considering",
- string);
+ DEBUG(D_noutf8)
+ debug_printf_indent("/%s: %s\n",
+ skipping ? "---scanning" : "considering", string);
+ else
+ debug_printf_indent(UTF8_DOWN_RIGHT "%s: %s\n",
+ skipping
+ ? UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ "scanning"
+ : "considering",
+ string);
f.expand_string_forcedfail = FALSE;
expand_string_message = US"";
@@ -4299,15 +4303,21 @@ while (*s != 0)
if (next_s == NULL) goto EXPAND_FAILED; /* message already set */
DEBUG(D_expand)
- {
- debug_printf_indent(UTF8_VERT_RIGHT UTF8_HORIZ UTF8_HORIZ
- "condition: %.*s\n",
- (int)(next_s - s), s);
- debug_printf_indent(UTF8_VERT_RIGHT UTF8_HORIZ UTF8_HORIZ
- UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
- "result: %s\n",
- cond ? "true" : "false");
- }
+ DEBUG(D_noutf8)
+ {
+ debug_printf_indent("|--condition: %.*s\n", (int)(next_s - s), s);
+ debug_printf_indent("|-----result: %s\n", cond ? "true" : "false");
+ }
+ else
+ {
+ debug_printf_indent(UTF8_VERT_RIGHT UTF8_HORIZ UTF8_HORIZ
+ "condition: %.*s\n",
+ (int)(next_s - s), s);
+ debug_printf_indent(UTF8_VERT_RIGHT UTF8_HORIZ UTF8_HORIZ
+ UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
+ "result: %s\n",
+ cond ? "true" : "false");
+ }
s = next_s;
@@ -7831,19 +7841,28 @@ if (resetok) store_reset(yield->s + (yield->size = yield->ptr + 1));
else if (resetok_p) *resetok_p = FALSE;
DEBUG(D_expand)
- {
- debug_printf_indent(UTF8_VERT_RIGHT UTF8_HORIZ UTF8_HORIZ
- "expanding: %.*s\n",
- (int)(s - string), string);
- debug_printf_indent("%s"
- UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
- "result: %s\n",
- skipping ? UTF8_VERT_RIGHT : UTF8_UP_RIGHT,
- yield->s);
- if (skipping)
- debug_printf_indent(UTF8_UP_RIGHT UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
- "skipping: result is not used\n");
- }
+ DEBUG(D_noutf8)
+ {
+ debug_printf_indent("|--expanding: %.*s\n", (int)(s - string), string);
+ debug_printf_indent("%sresult: %s\n",
+ skipping ? "|-----" : "\\_____", yield->s);
+ if (skipping)
+ debug_printf_indent("\\___skipping: result is not used\n");
+ }
+ else
+ {
+ debug_printf_indent(UTF8_VERT_RIGHT UTF8_HORIZ UTF8_HORIZ
+ "expanding: %.*s\n",
+ (int)(s - string), string);
+ debug_printf_indent("%s"
+ UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
+ "result: %s\n",
+ skipping ? UTF8_VERT_RIGHT : UTF8_UP_RIGHT,
+ yield->s);
+ if (skipping)
+ debug_printf_indent(UTF8_UP_RIGHT UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
+ "skipping: result is not used\n");
+ }
expand_level--;
return yield->s;
@@ -7865,16 +7884,25 @@ that is a bad idea, because expand_string_message is in dynamic store. */
EXPAND_FAILED:
if (left) *left = s;
DEBUG(D_expand)
- {
- debug_printf_indent(UTF8_VERT_RIGHT "failed to expand: %s\n",
- string);
- debug_printf_indent("%s" UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
- "error message: %s\n",
- f.expand_string_forcedfail ? UTF8_VERT_RIGHT : UTF8_UP_RIGHT,
- expand_string_message);
- if (f.expand_string_forcedfail)
- debug_printf_indent(UTF8_UP_RIGHT "failure was forced\n");
- }
+ DEBUG(D_noutf8)
+ {
+ debug_printf_indent("|failed to expand: %s\n", string);
+ debug_printf_indent("%serror message: %s\n",
+ f.expand_string_forcedfail ? "|---" : "\\___", expand_string_message);
+ if (f.expand_string_forcedfail)
+ debug_printf_indent("\\failure was forced\n");
+ }
+ else
+ {
+ debug_printf_indent(UTF8_VERT_RIGHT "failed to expand: %s\n",
+ string);
+ debug_printf_indent("%s" UTF8_HORIZ UTF8_HORIZ UTF8_HORIZ
+ "error message: %s\n",
+ f.expand_string_forcedfail ? UTF8_VERT_RIGHT : UTF8_UP_RIGHT,
+ expand_string_message);
+ if (f.expand_string_forcedfail)
+ debug_printf_indent(UTF8_UP_RIGHT "failure was forced\n");
+ }
if (resetok_p && !resetok) *resetok_p = FALSE;
expand_level--;
return NULL;
diff --git a/src/src/globals.c b/src/src/globals.c
index c18f6c163..cdf00e810 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -770,9 +770,11 @@ int debug_fd = -1;
FILE *debug_file = NULL;
int debug_notall[] = {
Di_memory,
+ Di_noutf8,
-1
};
-bit_table debug_options[] = { /* must be in alphabetical order */
+bit_table debug_options[] = { /* must be in alphabetical order and use
+ only the enum values from macro.h */
BIT_TABLE(D, acl),
BIT_TABLE(D, all),
BIT_TABLE(D, auth),
@@ -791,6 +793,7 @@ bit_table debug_options[] = { /* must be in alphabetical order */
BIT_TABLE(D, local_scan),
BIT_TABLE(D, lookup),
BIT_TABLE(D, memory),
+ BIT_TABLE(D, noutf8),
BIT_TABLE(D, pid),
BIT_TABLE(D, process_info),
BIT_TABLE(D, queue_run),
diff --git a/src/src/macros.h b/src/src/macros.h
index fd53de883..0d979d0c8 100644
--- a/src/src/macros.h
+++ b/src/src/macros.h
@@ -362,6 +362,7 @@ masks, alternating between sequential bit index and corresponding mask. */
/* Options bits for debugging. DEBUG_BIT() declares both a bit index and the
corresponding mask. Di_all is a special value recognized by decode_bits().
+These must match the debug_options table in globals.c .
Exim's code assumes in a number of places that the debug_selector is one
word, and this is exposed in the local_scan ABI. The D_v and D_local_scan bit
@@ -391,6 +392,7 @@ enum {
DEBUG_BIT(load),
DEBUG_BIT(lookup),
DEBUG_BIT(memory),
+ DEBUG_BIT(noutf8),
DEBUG_BIT(pid),
DEBUG_BIT(process_info),
DEBUG_BIT(queue_run),
@@ -412,6 +414,7 @@ enum {
#define D_any (D_all & \
~(D_v | \
+ D_noutf8 | \
D_pid | \
D_timestamp) )
@@ -422,6 +425,7 @@ enum {
D_load | \
D_local_scan | \
D_memory | \
+ D_noutf8 | \
D_pid | \
D_timestamp | \
D_resolver))