From: Tom Rini Date: Wed, 16 Jul 2014 16:50:54 -0400 Subject: [U-Boot] [PATCH] cmd_nand/cmd_ubi/cmd_nboot: Set environment variable 'filesize' In-Reply-To: <20140716124523.84F393804B5@gemini.denx.de> References: <1405500531-25486-1-git-send-email-lisovy@merica.cz> <20140716124523.84F393804B5@gemini.denx.de> Message-ID: <20140716205054.GS1847@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Jul 16, 2014 at 02:45:23PM +0200, Wolfgang Denk wrote: > Dear Rostislav Lisovy, > > In message <1405500531-25486-1-git-send-email-lisovy@merica.cz> you wrote: > > The environment variable 'filesize' is commonly used for > > storing information about the size of the last read/retrieved > > file. The variable is essential when writing U-boot scripts. > > This patch adds the capability of storing the information about > > the size of read data into the 'filesize' variable for other > > commands (nand read/ubi read/nboot) as well. > > I'm not happy with that. I think this is actually dangerous. > > First, you mix two different concepts here. As the name "FILEsize" > suggests, it is related to the size of a data object "file". This > comes as natural name when loading data from a TFTP server or when > reading a *file* from some file system. Extending this to mean any > amount of data looks inconsistent and even broken to me. > > Second, there might be scripts out there which get broken by your > modification. For example, when I download a file over TFTP to RAM, I > expect that "filesize" holds the exact amount of bytes of this file. > When I now use "nand write ... +${filesize}", the write size would be > rounded up to the next full erase block size of the NAND. Any later > reference to "filesize" will now see a different (larger) value than > expected. > > There are problably other scenarios which may get broken by such > unexpected (and new) behaviour. I agree we should NOT modify filesize on write. But what about on NAND/etc read? -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: