authorSergey Poznyakoff <>2019-06-17 21:06:40 (GMT)
committer Sergey Poznyakoff <>2019-06-17 21:06:40 (GMT)
commitfd8f55ffd25bfe4eed1524f3daba2f05f8dd373e (patch) (side-by-side diff)
parent71c8a9513b43e30358a3c5f0448a768d908852f2 (diff)
Don't accept database types not supported by mailutils
For details, see the last paragraph in: * (db_type_to_feature): Make sure empty string is never returned.
Diffstat (more/less context) (ignore whitespace changes)
1 files changed, 17 insertions, 1 deletions
diff --git a/ b/
index 54c9ebd..289a291 100644
--- a/
+++ b/
@@ -146,8 +146,21 @@ ndbm:ndbm
# Convert database type to mailutils feature
db_type_to_feature() {
- sed -n /^$(echo "$1" | tr A-Z a-z)':/s/.*://p' <<EOF
+ # Normalize the input
+ key=$(echo "$1" | tr A-Z a-z)
+ # Augment db_map with the line "$key:$key" and select from the resulting
+ # input the first entry starting with "$key:". On output, replace it with
+ # the characters that follow : up to the newline.
+ # The first expression looks for the string in the first line of input.
+ # If found, it replaces it and branches to the end of script. The second
+ # expression then has no chance to catch, since the scanning resumes from
+ # line 2. Otherwise, if key is not found in the first line, the second
+ # expression searches for it in the remaining lines.
+ # The default entry "$key:$key" ensures the normalized key is returned
+ # if no match was found.
+ sed -n -e "1s/^$key"'://p;t' -e '1,//{s///p}' <<EOF
@@ -201,6 +214,9 @@ else
feature=$(mailutils info $fl | head -n 1 | sed 's/WITH_//')
if test -n "$feature"; then
DEFAULT_DB_TYPE=$(db_feature_to_type $feature)
+ if test -z "$DEFAULT_DB_TYPE"; then
+ AC_MSG_WARN([can't select database type $feature, falling back to default])
+ fi
if test -n "$DEFAULT_DB_TYPE"; then

Return to:

Send suggestions and report system problems to the System administrator.