[PATCH 4/4] cfgfile: add unique name flag

fengchengwen fengchengwen at huawei.com
Fri Jul 5 11:37:08 CEST 2024


Hi Stephen,

On 2024/7/5 5:36, Stephen Hemminger wrote:
> On Tue, 20 Feb 2024 03:58:40 +0000
> Chengwen Feng <fengchengwen at huawei.com> wrote:
> 
>> The cfgfile supports duplicate section name and entry name when parsing
>> config file, which may confused and hard to debug when accidentally set
>> duplicate name.
>>
>> So add unique name flag, it will treat as error if encounter duplicate
>> section name or entry name.
>>
>> Cc: stable at dpdk.org
>>
>> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> 
> https://en.wikipedia.org/wiki/INI_file
> 
> 	Interpretation of multiple section declarations with the same name also varies. 
> 	In some implementations, duplicate sections simply merge their properties, as if
> 	they occurred contiguously. Others may abort, or ignore some aspect of the INI file.
> 
> The standard reference for INI file parsing on Linux is the Python configparser
> https://docs.python.org/3/library/configparser.html
> 
> 	strict, default value: True
> 
> 	When set to True, the parser will not allow for any section or option duplicates while reading from a single source 	(using read_file(), read_string() or read_dict()). It is recommended to use strict parsers in new applications.
> 
> The problem I see is that cfgfile allows duplicates on names, and sections.
> Perhaps there should be a new strict flag for this.

It is important to keep the naming consistent, already sent v2 to fix it.

Thanks

> .
> 


More information about the dev mailing list