bin/129566: behavioral change of "read" builtin for sh(1) on 8-CURRENT [regression]

Ed Schouten ed at 80386.nl
Sun Mar 8 12:10:04 PDT 2009


The following reply was made to PR bin/129566; it has been noted by GNATS.

From: Ed Schouten <ed at 80386.nl>
To: bug-followup at FreeBSD.org, mike at jellydonunt.org
Cc: jilles at stack.nl
Subject: Re: bin/129566: behavioral change of "read" builtin for sh(1) on
	8-CURRENT [regression]
Date: Sun, 8 Mar 2009 20:03:37 +0100

 --8Ioc0IVuiHZoupes
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 As Jilles pointed out, the new TTY layer does not perform any
 post-processing before returning data to userspace. This makes the
 design of the TTY layer a lot more simple, while still complying to the
 standards.
 
 This means sh(1)'s behaviour it not correct, because it calls select()
 with ICRNL disabled. The following patch should fix this:
 
 Index: miscbltin.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 --- miscbltin.c	(revision 189489)
 +++ miscbltin.c	(working copy)
 @@ -147,6 +147,7 @@
  		if (tcgetattr(0, &told) =3D=3D 0) {
  			memcpy(&tnew, &told, sizeof(told));
  			cfmakeraw(&tnew);
 +			tnew.c_iflag |=3D ICRNL;
  			tcsetattr(0, TCSANOW, &tnew);
  			tsaved =3D 1;
  		}
 
 Please let me know if it fixes your issue. If it does, I'll commit it to
 SVN and MFC it as well.
 
 --=20
  Ed Schouten <ed at 80386.nl>
  WWW: http://80386.nl/
 
 --8Ioc0IVuiHZoupes
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (FreeBSD)
 
 iEYEARECAAYFAkm0FokACgkQ52SDGA2eCwVVYwCcDDwXL2gw3GDE4Ak1iw9Jdabr
 ptoAnjIpxhLsoU4egBZvcVF2e8YB/TRa
 =xY6E
 -----END PGP SIGNATURE-----
 
 --8Ioc0IVuiHZoupes--


More information about the freebsd-bugs mailing list