Edgewall Software

Opened 7 years ago

Last modified 5 months ago

#11538 assigned defect

Duplicate options are allowed in sections of trac.ini

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.5.2
Component: general Version:
Severity: normal Keywords: config python3
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

The sections of trac.ini allow duplicate options, with later values overwriting those that come first. Two patterns that could lead to confusing behavior when the user doesn't realize that the option's value is being changed later in the file are:

  1. Duplicate sections with the same option.
    default_handler = WikiModule
    default_handler = TicketModule
  2. Duplicate options within a section.
    default_handler = WikiModule
    default_handler = TicketModule

While Python 3.x has a much improved configparser module with a strict mode that raises an error when an option appears more than once, I'm not sure there is much we can do in Python 2.x using ConfigParser.

SO:5396653 suggests using a dict_type that allows multiple values with the same key, however dict_type is only supported in Python 2.6, so we wouldn't be able to apply as dict_type-based fix to 1.0-stable.

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 7 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 6 years ago

Keywords: python3 added

After #11982, which replaced use of ConfigObj with ConfigParser, an exception is no longer raised when there is a duplicate section or option in an authz_policy configuration file. One test is commented out: trunk/tracopt/perm/tests/authz_policy.py@13994:223-234#L223.

comment:3 by Ryan J Ollos, 6 months ago

Milestone: undecided1.5.2

comment:5 by Ryan J Ollos, 5 months ago

Owner: set to Ryan J Ollos
Status: newassigned

Modify Ticket

Change Properties
Set your email in Preferences
as assigned The owner will remain Ryan J Ollos.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.