Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2014 07:20:01 GMT
From:      Mikolaj Golub <to.my.trociny@gmail.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/161526: script(1) outputs corrupt if input is not from a terminal
Message-ID:  <201401080720.s087K16A088497@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/161526; it has been noted by GNATS.

From: Mikolaj Golub <to.my.trociny@gmail.com>
To: Karli =?utf-8?Q?Sj=C3=B6berg?= <Karli.Sjoberg@slu.se>
Cc: Brian Somers <brian@FreeBSD.org>,
	"bug-followup@FreeBSD.org" <bug-followup@FreeBSD.org>,
	"aw1@stade.co.uk" <aw1@stade.co.uk>,
	"stb@lassitu.de" <stb@lassitu.de>,
	"trociny@freebsd.org" <trociny@freebsd.org>
Subject: Re: bin/161526: script(1) outputs corrupt if input is not from a
 terminal
Date: Wed, 8 Jan 2014 09:17:13 +0200

 On Wed, Jan 08, 2014 at 06:25:31AM +0000, Karli Sjöberg wrote:
 > tis 2014-01-07 klockan 17:45 +0200 skrev Mikolaj Golub:
 > > On Tue, Jan 07, 2014 at 10:46:11AM +0000, Karli Sj"oberg wrote:
 > > > Hi!
 > > > 
 > > > This was reported two years back, with patch set to MFC after 3 days,
 > > > according to:
 > > > http://svnweb.freebsd.org/base?view=revision&amp;revision=226403
 > > > 
 > > > My systems are currently running 9.2-RELEASE and this patch still isn't
 > > > included, which I think is unfortunate, since it totally solves the
 > > > problem of running e.g. portupgrade somewhere not executed from a
 > > > terminal, which is awesome!
 > > 
 > > It was merged to stable/9 in r226591
 > > 
 > > http://svnweb.freebsd.org/base?view=revision&revision=226591
 > > 
 > > (and the commit was traced by this PR) so I beleive 9.2-RELEASE
 > > includes it.
 > > 
 > > If you still observe behavior that looks strange for you please
 > > provide more details.
 > 
 > I know, it should be there, but somehow it´s not included in 9.2-RELEASE
 > r256098. Here´s from a machine I just patched script.c:
 > 
 > # diff -u script.c.orig script.c
 > --- script.c.orig	2013-10-07 10:05:10.475326598 +0200
 > +++ script.c	2014-01-07 14:19:18.489087444 +0100
 > @@ -235,12 +235,15 @@
 >  		FD_SET(master, &rfd);
 >  		if (readstdin)
 >  			FD_SET(STDIN_FILENO, &rfd);
 > -		if ((!readstdin && ttyflg) || flushtime > 0) {
 > -			tv.tv_sec = !readstdin && ttyflg ? 1 :
 > -			    flushtime - (tvec - start);
 > +		if (!readstdin && ttyflg) {
 > +			tv.tv_sec = 1;
 >  			tv.tv_usec = 0;
 >  			tvp = &tv;
 >  			readstdin = 1;
 > +		} else if (flushtime > 0) {
 > +			tv.tv_sec = flushtime - (tvec - start);
 > +			tv.tv_usec = 0;
 > +			tvp = &tv;
 >  		} else {
 >  			tvp = NULL;
 >  		}
 > 
 > Where "script.c.orig" is what you get after installing, and "script.c"
 > is the now patched file.
 > 
 > And what´s more strange is that I have another system running 9.1-STABLE
 > r249580, and that system does have the code:
 >                 FD_SET(master, &rfd);
 >                 if (readstdin)
 >                         FD_SET(STDIN_FILENO, &rfd);
 >                 if (!readstdin && ttyflg) {
 >                         tv.tv_sec = 1;
 >                         tv.tv_usec = 0;
 >                         tvp = &tv;
 >                         readstdin = 1;
 >                 } else if (flushtime > 0) {
 >                         tv.tv_sec = flushtime - (tvec - start);
 >                         tv.tv_usec = 0;
 >                         tvp = &tv;
 >                 } else {
 >                         tvp = NULL;
 >                 }
 > 
 > So somewhere between r249580 and r256098, this very important piece of
 > code has gone missing?
 
 It looks this fix was reverted in r238896, when doing bin/114465. All
 branches are affected.
 
 Brian, did you have a reason for this or it was just an accident?
 Would you want to fix this?
 
 > 
 > PS. Why do my emails look like complete **** when viewed from:
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=161526&cat= ?
 
 It is base64 encoded. I suppose GNAT can't handle properly messages
 with 'Content-Transfer-Encoding: base64'.
 
 -- 
 Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401080720.s087K16A088497>