From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] tools: mkenvimage: Fix reading from slow pipe
Date: Thu, 18 Jul 2019 19:57:31 -0400 [thread overview]
Message-ID: <20190718235731.GA20116@bill-the-cat> (raw)
In-Reply-To: <20190630014501.16027-2-andre.przywara@arm.com>
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 <andre.przywara@arm.com>
> Acked-by: Alexander Dahl <ada@thorsis.com>
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: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/202c2851/attachment.sig>
next prev parent reply other threads:[~2019-07-18 23:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-30 1:44 [U-Boot] [PATCH 0/2] tools: mkenvimage: Fixes for reading from pipes Andre Przywara
2019-06-30 1:45 ` [U-Boot] [PATCH 1/2] tools: mkenvimage: Fix reading from slow pipe Andre Przywara
2019-07-01 6:31 ` Alexander Dahl
2019-07-18 23:57 ` Tom Rini [this message]
2019-06-30 1:45 ` [U-Boot] [PATCH 2/2] tools: mkenvimage: Always consider non-regular files Andre Przywara
2019-07-18 23:57 ` Tom Rini
2019-06-30 14:40 ` [U-Boot] [PATCH 0/2] tools: mkenvimage: Fixes for reading from pipes Tom Rini
2019-07-01 9:22 ` Andre Przywara
2019-07-01 13:23 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190718235731.GA20116@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox