tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: odd script(1) behavior - script bug, man bug, ?



> Does script(1) (not specified by POSIX) require that stdin is a tty?

In practice, I think so.  I tried

% cat -u | script -c sh | cat -u

on NetBSD, both 5.2 and 9.1, and 5.2 gave

$ Script started, output file is typescript
Script started, output file is typescript
Script done, output file is typescript

whereas 9.1 gave

$ 
Script started, output file is typescript
Script started, output file is typescript
Script done, output file is typescript

In each case, this all occurred very fast, fast enough that, at the
human layer, I saw no delay.  Each case also waited for me to type
return before giving me my main shell prompt back, probably because the
first cat -u doesn't exit until it tries to write to the (broken) pipe
to script.

I tried ktracing the script process and it's still a mystery.  It tries
to TIOCSETAF on stdin and fails, but it still proceeds to fork the
shell.  script then gets SIGCHLD without doing anything with the pty.
I'd have to dig deeper - which I don't have the leisure to do at the
moment - to figure out what's gong on here.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index