From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Erickson Date: Wed, 07 May 2008 07:01:09 -0700 Subject: [U-Boot-Users] [PATCH] Propagate Error Status to the Shell on fw_printenv Errors In-Reply-To: <1210145357.32216.66.camel@gentoo-jocke.transmode.se> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 5/7/08 12:29 AM, Joakim Tjernlund wrote: > On Tue, 2008-05-06 at 20:16 -0700, Grant Erickson wrote: >> root at kilauea# fw_printenv foobar >> ## Error: "foobar" not defined > > This error message should not be there. It is enough to return exit > status 1. Then one does not have to redirect stderr in scripts > >> root at kilauea# fw_printenv hostname ipaddr foobar >> hostname=kilauea >> ipaddr=192.168.1.12 >> ## Error: "foobar" not defined > > Same here. > >> root at kilauea# echo $? >> 1 >> > > Could you also remove the messages printed during fw_setenv(show below)? > root at jtd:~# fw_setenv kalle sven > Unlocking flash... > Done > Erasing old environment... > Done > Writing environment to /dev/mtd2... > Done > Locking ... > Done > > Perhaps hide them behind a -v(verbose) option? Joakim, Agreed that there should be a way to suppress or, alternatively, enable these verbose status messages. However, these messages were all in the code already. So, to the extent that the maintainer (Wolfgang?) is amenable to adding another option ("-v" or "-q"), I can evaluate working on this change as a separate patch. Another change I am also looking into is eliminating the write to flash even when a variable does not exist: root at kilauea# fw_printenv foobar ## Error: "foobar" not defined root at kilauea# echo $? 1 root at kilauea# fw_setenv foobar Unlocking flash... Done Erasing old environment... Done Writing environment to /dev/mtd4... Done Locking ... Done root at kilauea# echo $? 0 Regards, Grant