summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-06-17 21:06:40 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-06-17 21:06:40 (GMT)
commitfd8f55ffd25bfe4eed1524f3daba2f05f8dd373e (patch) (side-by-side diff)
treedbb51e7b22c9cb47401d5368d7290438e7b0bf0d
parent71c8a9513b43e30358a3c5f0448a768d908852f2 (diff)
downloadmailfromd-master.tar.gz
mailfromd-master.tar.bz2
Don't accept database types not supported by mailutilsHEADmaster
For details, see the last paragraph in: http://mail.gnu.org.ua/mailman/listarchive/bug-mailfromd/2019-06/msg00001.html * configure.ac (db_type_to_feature): Make sure empty string is never returned.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac18
1 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 54c9ebd..289a291 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
$db_map
+$key:$key
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
fi
fi
if test -n "$DEFAULT_DB_TYPE"; then

Return to:

Send suggestions and report system problems to the System administrator.