From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Thu, 18 Jul 2019 19:57:31 -0400 Subject: [U-Boot] [PATCH 1/2] tools: mkenvimage: Fix reading from slow pipe In-Reply-To: <20190630014501.16027-2-andre.przywara@arm.com> References: <20190630014501.16027-1-andre.przywara@arm.com> <20190630014501.16027-2-andre.przywara@arm.com> Message-ID: <20190718235731.GA20116@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 Sun, Jun 30, 2019 at 02:45:00AM +0100, Andre Przywara wrote: > It is perfectly fine for the read(2) syscall to return with less than > the requested number of bytes read (short read, see the "RETURN VALUE" > section of the man page). This typically happens with slow input > (keyboard, network) or with complex pipes. > > So far mkenvimage expects the exact number of requested bytes to be > read, assuming an end-of-file condition otherwise. This wrong behaviour > can be easily shown with: > $ (echo "foo=bar"; sleep 1; echo "bar=baz") | mkenvimage -s 256 -o out - > The second line will be missing from the output. > > Correct this by checking for any positive, non-zero return value. > > This fixes a problem with a complex pipe in one of my scripts, where > the environment consist of two parts. > > Signed-off-by: Andre Przywara > Acked-by: Alexander Dahl Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: