Project

General

Profile

Actions

Bug #2704

closed

Slight improvement to the message format on duplicate array kes

Added by shevegen almost 9 years ago. Updated almost 9 years ago.

Status:
Fixed
Priority:
Low
Category:
-
Target version:
ASK QUESTIONS IN Forums:

Description

I accidentally had the same file extension twice, such as:

".md"           =>    "text/plain",
".md" => "text/plain",

As part of mimetype.assign.

I got this error:

"Duplicate array-key: .md
2016-01-01 00:25:48: (configfile.c.957) source: /serve/lighttpd.conf line: 168 pos: 9 parser failed somehow near here: (COMMA) "

I assume that you want to retain this as an error, so people have to fix it before, rather than lighttpd e. g. using
the last definition.

I do suggest to slightly modify the error message though.

Rather than:

"parser failed somehow near here"

To write something such as:

"duplicate array-key: .md detected. It is recommended to get rid of the duplicate entry."

Thanks.

Actions #1

Updated by stbuehler almost 9 years ago

  • Target version set to 1.4.40
Actions #2

Updated by gstrauss almost 9 years ago

Trivial request.
@stbuehler: can the error message be slightly extended?

diff --git a/src/configparser.y b/src/configparser.y
index b22dac1..0136e71 100644
--- a/src/configparser.y
+++ b/src/configparser.y
@@ -297,7 +297,8 @@ aelements(A) ::= aelements(C) COMMA aelement(B). {
       array_insert_unique(C, B);
       B = NULL;
     } else {
-      fprintf(stderr, "Duplicate array-key: %s\n",
+      fprintf(stderr, "Duplicate array-key: %s detected.  " 
+              "It is recommended to get rid of the duplicate entry.\n",
               B->key->ptr);
       ctx->ok = 0;
       B->free(B);
Actions #3

Updated by stbuehler almost 9 years ago

I'll extend it slightly; given how the parser works right now I don't think we can simply replace the parser error message.

Actions #4

Updated by stbuehler almost 9 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r3085.

Actions

Also available in: Atom