From: Alexander Dahl <ada@thorsis.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] tools: mkenvimage: Fix reading from slow pipe
Date: Mon, 01 Jul 2019 08:31:52 +0200 [thread overview]
Message-ID: <4009655.SipH91VE5i@ada> (raw)
In-Reply-To: <20190630014501.16027-2-andre.przywara@arm.com>
Hello Andre,
Am Sonntag, 30. Juni 2019, 02:45:00 CEST schrieb Andre Przywara:
> 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>
From reading the code and 'man 2 read' again, not tested locally:
Acked-by: Alexander Dahl <ada@thorsis.com>
Greets
Alex
next prev parent reply other threads:[~2019-07-01 6:31 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 [this message]
2019-07-18 23:57 ` Tom Rini
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=4009655.SipH91VE5i@ada \
--to=ada@thorsis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.