NetBSD-Bugs archive

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

Re: bin/54514: script(1) sometimes swallows last line(s) of output



The following reply was made to PR bin/54514; it has been noted by GNATS.

From: Harold Gutch <logix%foobar.franken.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/54514: script(1) sometimes swallows last line(s) of output
Date: Tue, 9 May 2023 17:37:25 +0200

 On Sun, Sep 01, 2019 at 09:42:52PM +0200, Harold Gutch wrote:
 > On Sat, Aug 31, 2019 at 02:00:02AM +0000, Robert Elz wrote:
 > >  Please try again with the changes as suggested, and let us know
 > >  if my suggested variation for your patch fixes the problem.
 > 
 > Yes, your suggestion fixes the problem for me.
 > 
 > --- src/usr.bin/script/script.c	2011-09-06 18:29:56.000000000 +0000
 > +++ src/usr.bin/script/script.c	2019-08-31 12:41:26.368033644 +0000
 > @@ -173,6 +173,7 @@
 >  		fail();
 >  	}
 >  	if (child == 0) {
 > +		(void)signal(SIGCHLD, SIG_DFL);
 >  		subchild = child = fork();
 >  		if (child < 0) {
 >  			warn("fork");
 
 script.c has received a number of changes since, and in the meanwhile
 the symptomps of this have changed a bit and no longer swallow lines
 but instead duplicate the "done" line:
 
   $ script -c ./test.sh typescript
   Script started, output file is typescript
   1
   2
   3
   Script done, output file is typescript
   $ cat typescript
   Script started on Tue May  9 17:34:31 2023
   1
   2
   3
 
   Script done on Tue May  9 17:34:31 2023
 
   Script done on Tue May  9 17:34:31 2023
 
 resetting the SIGCHLD signal handler to SIG_DFL for the child process
 still fixes this.
 
 
   Harold
 


Home | Main Index | Thread Index | Old Index