Re: script input redirection / eof handling

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

 



On Thu, Oct 31, 2013 at 10:21:10AM -0400, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I came across an old bug filed in debian about script being redirected
> from a file misbehaving. 

Do you mean something like:

   echo "ps uf" | script

.. if yes, then it's pretty unexpected usage. The code expects that
stdin is terminal. (For example it copy the current terminal
attributes the new pseudo-terminal.)

Unfortunately it does not check tcgetatt() return code so the problem 
is not visible. I'll fix it.

> It seems that when the master ( input )
> process hits eof, it exits immediately, orphaning the child ( output )
> and user processes.

Yep, I think it would be enough to add 

       kill(0, SIGTERM);

before done() in doinput() to avoid orphans.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux