From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE44945594; Fri, 5 Jul 2024 11:37:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE66E42F21; Fri, 5 Jul 2024 11:37:12 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 0587042ED0 for ; Fri, 5 Jul 2024 11:37:11 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WFpFs1QCbzdZsw; Fri, 5 Jul 2024 17:32:33 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id 3D0271400D6; Fri, 5 Jul 2024 17:37:09 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Jul 2024 17:37:08 +0800 Subject: Re: [PATCH 4/4] cfgfile: add unique name flag To: Stephen Hemminger CC: , , References: <20240220035840.32978-1-fengchengwen@huawei.com> <20240220035840.32978-5-fengchengwen@huawei.com> <20240704143646.1f19b480@hermes.local> From: fengchengwen Message-ID: <72aca282-1e35-f857-b316-85bc78f6a1a7@huawei.com> Date: Fri, 5 Jul 2024 17:37:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20240704143646.1f19b480@hermes.local> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Stephen, On 2024/7/5 5:36, Stephen Hemminger wrote: > On Tue, 20 Feb 2024 03:58:40 +0000 > Chengwen Feng 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@dpdk.org >> >> Signed-off-by: Chengwen Feng > > 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 > . >