From ae46d958842c39ee739e30f9cb1e7f2b1214be9e Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Sun, 8 Mar 2009 19:09:55 +0000 Subject: [PATCH] Don't disable CR-to-NL translation when waiting for data to arrive. A difference between the old and the new TTY layer is that the new implementation does not perform any post-processing before returning data back to userspace when calling read(). sh(1)'s read turns the TTY into a raw mode before calling select(). This means that the first character will not receive any ICRNL processing. Inherit this flag from the original terminal attributes. Even though this issue is not present on RELENG_*, I'm MFCing it to make sh(1) in jails behave better. PR: bin/129566 MFC after: 2 weeks --- bin/sh/miscbltin.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index 6496f4aa40a0..88b7515d5364 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -147,6 +147,7 @@ readcmd(int argc __unused, char **argv __unused) if (tcgetattr(0, &told) == 0) { memcpy(&tnew, &told, sizeof(told)); cfmakeraw(&tnew); + tnew.c_iflag |= told.c_iflag & ICRNL; tcsetattr(0, TCSANOW, &tnew); tsaved = 1; }