Project

General

Profile

Bug #2685

add warning for duplicate array keys in config

Added by glen almost 2 years ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
2015-11-27
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

using version 1.4.37
i would expected last item to override previous one, but result is quite unexpected, the alias does not work at all (files aren't taken from neither mapped paths).

# cat /tmp/julla.conf
alias.url += (
    "/jquery/" => "/usr/share/jquery/",
)
alias.url += (
        "/jquery/" => "/www/htdocs/cdn-js/legacy/current/dist/jquery/",
)
# lighttpd -pf /tmp/julla.conf
config {
    var.PID        = 2368
    var.CWD        = "/etc/lighttpd/webapps.d" 
    alias.url      = (
        "/jquery/" => "/usr/share/jquery/, /www/htdocs/cdn-js/legacy/current/dist/jquery/",
    )
    server.modules = ("mod_indexfile", "mod_dirlisting", "mod_staticfile")

}

Related issues

Related to Bug #1834: Invalid Content-Type sent when more than one mimetype.assign matchesFixed2008-11-30

Associated revisions

Revision 3103 (diff)
Added by stbuehler over 1 year ago

[core] configparser: error on duplicate keys in array merge (fixes #2685)

From: Glenn Strauss <>

Revision 43da5818 (diff)
Added by gstrauss over 1 year ago

[core] configparser: error on duplicate keys in array merge (fixes #2685)

From: Glenn Strauss <>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3103 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1 Updated by stbuehler almost 2 years ago

  • Status changed from New to Invalid

That is the way "+" has been implemented on arrays (it doesn't know anything about the context of "alias.url"); I'm not going to change that.

#2 Updated by gstrauss over 1 year ago

Submitted pull request https://github.com/lighttpd/lighttpd1.4/pull/28 to issue warning and ignore duplicate keys when merging arrays (for arrays without auto-generated keys). Please reopen this issue and review the patch in the pull request.

#3 Updated by gstrauss over 1 year ago

Related ticket with some discussion: http://redmine.lighttpd.net/issues/2597

#4 Updated by stbuehler over 1 year ago

  • Subject changed from weird outcome for duplicate alias map to add warning for duplicate array keys in config
  • Category changed from mod_alias to core
  • Status changed from Invalid to Reopened

#5 Updated by stbuehler over 1 year ago

  • Target version set to 1.4.40

#6 Updated by gstrauss over 1 year ago

FYI: it appears this issue was addressed in the 1.5.x branch back in 2005.

commit ed43eed7f29312065f786af684c5c00df2607a3c
Author: Jan Kneschke <jan@kneschke.de>
Date:   Sat Apr 9 16:33:19 2005 +0000

    duplication config-vars and duplicate array key are a error now

    git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@267 152afb58-edef-0310-8ab
b-c4023f1b3aa9

#7 Updated by stbuehler over 1 year ago

r267 is not the same problem, and was also applied in 1.4.x.

I modified the patch to throw an error; I don't see any sane semantics in ignoring the entry in the second array while still showing a warning (usually you would expect the second array to overwrite entries in the first).

#8 Updated by stbuehler over 1 year ago

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

Applied in changeset r3103.

#9 Updated by gstrauss over 1 year ago

  • Related to Bug #1834: Invalid Content-Type sent when more than one mimetype.assign matches added

Also available in: Atom