bin/161526: script(1) outputs corrupt if input is not from a terminal
Mikolaj Golub
to.my.trociny at gmail.com
Wed Jan 8 07:20:01 UTC 2014
The following reply was made to PR bin/161526; it has been noted by GNATS.
From: Mikolaj Golub <to.my.trociny at gmail.com>
To: Karli =?utf-8?Q?Sj=C3=B6berg?= <Karli.Sjoberg at slu.se>
Cc: Brian Somers <brian at FreeBSD.org>,
"bug-followup at FreeBSD.org" <bug-followup at FreeBSD.org>,
"aw1 at stade.co.uk" <aw1 at stade.co.uk>,
"stb at lassitu.de" <stb at lassitu.de>,
"trociny at freebsd.org" <trociny at 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&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
More information about the freebsd-bugs
mailing list