From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: util-linux-owner@vger.kernel.org Received: from mx1.redhat.com ([209.132.183.28]:46715 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbaJIMVm (ORCPT ); Thu, 9 Oct 2014 08:21:42 -0400 Date: Thu, 9 Oct 2014 14:21:23 +0200 From: Karel Zak To: Adam Sampson Cc: Thorsten Glaser , util-linux@vger.kernel.org Subject: Re: script from 2.25.1 may be broken (hangs) Message-ID: <20141009122123.GG8057@x2.net.home> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Sender: util-linux-owner@vger.kernel.org List-ID: On Thu, Oct 09, 2014 at 11:53:15AM +0100, Adam Sampson wrote: > Thorsten Glaser writes: > > > $ script -qc './test.sh -v' &1 | tee log > > For me, this doesn't hang, but it does exit before test.sh is actually > finished. Here's a simpler example that does the same thing: > > $ cat simpler.sh > #!/bin/sh > echo one > sleep 2 > echo two > $ script -c './simpler.sh' > Script started, file is typescript > one > two > Script done, file is typescript > $ script -c './simpler.sh' Script started, file is typescript > one > Script done, file is typescript > > The "wait for children" code at the end of doinput looks suspicious to > me -- finish() doesn't actually block, as the comment implies, just hmm.. because WNOHANG, it seems we need a one function for signal handler (with WNOHANG) and another function for the real program termination (without WNOHANG). Karel -- Karel Zak http://karelzak.blogspot.com