From: Wolfgang Denk Date: Wed, 16 Jul 2014 14:45:23 +0200 Subject: [U-Boot] [PATCH] cmd_nand/cmd_ubi/cmd_nboot: Set environment variable 'filesize' In-Reply-To: <1405500531-25486-1-git-send-email-lisovy@merica.cz> References: <1405500531-25486-1-git-send-email-lisovy@merica.cz> Message-ID: <20140716124523.84F393804B5@gemini.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 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. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Q: Do you know what the death rate around here is? A: One per person.