From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 29 Jan 2021 12:16:02 +0100 Subject: [PATCH] env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE In-Reply-To: References: <1610360847-21890-1-git-send-email-martin.fuzzey@flowbird.group> <692a008f-22d0-e206-9edb-7a5bad124ad5@denx.de> Message-ID: <67976a0a-e211-dad7-82fa-7a2bbeb862d6@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 1/29/21 8:42 AM, Fuzzey, Martin wrote: > On Fri, 29 Jan 2021 at 00:05, Marek Vasut wrote: >> >> On 1/28/21 8:37 PM, Fuzzey, Martin wrote: >>> Hi Marek, >> >> Hi, >> >>> On Thu, 28 Jan 2021 at 20:07, Marek Vasut wrote: >>>> >>>> Based on env/Kconfig description of this option: >>>> >>>> config ENV_ACCESS_IGNORE_FORCE >>>> bool "Block forced environment operations" >>>> default n >>>> help >>>> If defined, don't allow the -f switch to env set override >>>> variable >>>> access flags. >>>> >>>> I would think the code should look like this: >>>> >>>> #ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE >>>> if (flag & H_FORCE) { >>>> printf("## Error: Can't force access to \"%s\"\n", name); >>>> return 1; >>>> } >>>> #else >>>> if (flag & H_FORCE) >>>> return 0; >>>> #endif >>> >>> I don't think that is right. >>> >>> If you do that force update will be refused when >>> CONFIG_ENV_ACCESS_IGNORE_FORCE, regardless if the access would be >>> valid without the force >> >> That's how I understand the option was intended to work, based on the >> Kconfig help text. >> > > Ok we are understanding different things about what it's supposed to do then. > > But if everyone agrees that the option should completely disable -f > then I'm fine with that, in which case the version of the patch you > propose is good (and easier to understand). > > The problem I have is with the current 0f036bf4b87e which leads to log > spam on boards that *don't* have CONFIG_ENV_ACCESS_IGNORE_FORCE set > and do use -f. Yes, that should be fixed, one way or the other. (in fact, can you also write a test for this case ?)