From: Tom Rini Date: Mon, 2 Jul 2018 11:16:23 -0400 Subject: [U-Boot] [PATCH] fw_printenv: Don't bail out directly after one env read error In-Reply-To: <20180630103549.66521240042@gemini.denx.de> References: <20180626093759.24018-1-adrian.ratiu@ni.com> <20180629105745.EE018240042@gemini.denx.de> <20180629181550.GG18596@bill-the-cat> <20180630103549.66521240042@gemini.denx.de> Message-ID: <20180702151623.GI4752@bill-the-cat.ec.rr.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, Jun 30, 2018 at 12:35:49PM +0200, Wolfgang Denk wrote: > Dear Tom, > > In message <20180629181550.GG18596@bill-the-cat> you wrote: > > > > > This patch can lead to reading incorrect (old, no longer valid) > > > values without any way for the user to see what is happening. > > > > > > This must not be done! > > > > I'm not 100% sure, after reading all of the code, if there's a problem. > > There is. > > > What we indeed do not want to do is be silent in seeing that the first > > environment location we read from failed. But AFAICT if flash_io > > returns non-zero we also output something useful to stderr, so it should > > be visible to the user that something went wrong. > > But there is no indication about the problem in the return code, so > any tools using this have no way to determine there was a problem. Ah, true, thanks! > > The next question is, > > if half of the redundant environment has failed, is the other half > > considered valid (so long as the crc passes) or would only the built-in > > be valid? I would think the other half is the valid one. > > It may be valid, but it is still not what we want. > > redundant environment is used to provide a fall-back in case of > poblems when _writing_ the environment, i. e. like a power-off while > a "saveenv" is running. The purpose is to make sute that even then > we will always have a valid environment, with correct checksum. > > But as soon as the saveenv has succesfully completed, we do not have > to equal, exchangable copies - instead, we have one which holds the > current data (and only this is what represents the "correct" state), > and another copy, which holds the old state, i. e. which is > obsolete. > > Sielntly swapping the current and the obsolete data is a serious > bug, which must never happen. It may be OK as part of some recovery > procedure to limit the damage, but it must never ever go unnoticed. > > Assume you switch to another boot device / boot partion as part of a > system update procedure. Then booting the wrong system is > definitely not what you want. > > Please revert! Joe, Ioan-Adrian, I've reverted this. Please re-work the changes such that the use case you need to support is handled in some manner (likely a new flag being passed to fw_printenv/setenv) such that the current behavior is still the default, given Wolfgang's explanations above, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: