Re: tty or script(1) weirdness?

2010-03-11 Thread Gary Jennejohn
On Wed, 10 Mar 2010 21:04:10 +0100
Ed Schouten e...@80386.nl wrote:

 * Ed Schouten e...@80386.nl wrote:
  Hmmm... It seems this is a TTY bug. When you close a TTY, the final
  close() call should get stuck until all data is actually drained. This
  doesn't seem to happen properly.
 
 Some further research: it's not a TTY bug, but a bug in script(1).
 The script parent process leaves a file descriptor open, which means
 output is never properly drained.
 
 I can't reproduce this issue after applying this patch:
 
 %%%
 Index: script.c
 ===
 --- script.c  (revision 204965)
 +++ script.c  (working copy)
 @@ -158,6 +158,8 @@
   }
   if (child == 0)
   doshell(argv);
 + else
 + close(slave);
  
   if (flushtime  0)
   tvp = tv;
 %%%
 

Looks very convincing.  I say commit it.

---
Gary Jennejohn
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: tty or script(1) weirdness?

2010-03-10 Thread Ed Schouten
Hi Alfred,

* Alfred Perlstein alf...@freebsd.org wrote:
  1) download the suite.
  2) run sh test.sh to see the bug
  3) run sh test.sh yes to not see the bug (sleep called)

Hmmm... It seems this is a TTY bug. When you close a TTY, the final
close() call should get stuck until all data is actually drained. This
doesn't seem to happen properly.

You can easily test this by performing a tcdrain() right after running
your perl script:

#include termios.h

| int
| main(int argc, char *argv[])
| {
| 
|   tcdrain(0);
| }

I'll see what I can do.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpDNzomltaDM.pgp
Description: PGP signature


Re: tty or script(1) weirdness?

2010-03-10 Thread Ed Schouten
* Ed Schouten e...@80386.nl wrote:
 Hmmm... It seems this is a TTY bug. When you close a TTY, the final
 close() call should get stuck until all data is actually drained. This
 doesn't seem to happen properly.

Some further research: it's not a TTY bug, but a bug in script(1).
The script parent process leaves a file descriptor open, which means
output is never properly drained.

I can't reproduce this issue after applying this patch:

%%%
Index: script.c
===
--- script.c(revision 204965)
+++ script.c(working copy)
@@ -158,6 +158,8 @@
}
if (child == 0)
doshell(argv);
+   else
+   close(slave);
 
if (flushtime  0)
tvp = tv;
%%%

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpo052DoqSPZ.pgp
Description: PGP signature