From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux@vger.kernel.org
Subject: [PATCH] script: Fix mangled EOF and hang on big endian
Date: Thu, 14 May 2015 17:55:56 +0200 [thread overview]
Message-ID: <5554C58C.5080004@suse.cz> (raw)
On s390 and other big endian machines, doinput() sends NUL instead of
EOF to the tty master. NUL does not even reach the slave, and it is
waiting for more data forever.
If STDIN is not a tty, the bug caused "^@" being into the log, and since
commit 032228c it also causes hang.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
term-utils/script.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/term-utils/script.c b/term-utils/script.c
index 02ba596..e0083f2 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -377,9 +377,9 @@ doinput(void) {
* We usually use this when stdin is not a tty, for example:
* echo "ps" | script
*/
- int c = DEF_EOF;
+ char c = DEF_EOF;
- if (write_all(master, &c, 1)) {
+ if (write_all(master, &c, sizeof(char))) {
warn (_("write failed"));
fail();
}
--
2.3.7
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
next reply other threads:[~2015-05-14 15:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-14 15:55 Stanislav Brabec [this message]
2015-05-15 10:58 ` [PATCH] script: Fix mangled EOF and hang on big endian Karel Zak
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=5554C58C.5080004@suse.cz \
--to=sbrabec@suse.cz \
--cc=util-linux@vger.kernel.org \
/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